| 1 |
from mercurial.i18n import _ |
| 2 |
from mercurial import ( |
| 3 |
registrar, |
| 4 |
) |
| 5 |
from mercurial.repo import ( |
| 6 |
factory, |
| 7 |
) |
| 8 |
from mercurial.utils import ( |
| 9 |
urlutil, |
| 10 |
) |
| 11 |
|
| 12 |
cmdtable = {} |
| 13 |
command = registrar.command(cmdtable) |
| 14 |
|
| 15 |
|
| 16 |
@command(b'getflogheads', [], b'path') |
| 17 |
def getflogheads(ui, repo, path): |
| 18 |
""" |
| 19 |
Extension printing a remotefilelog's heads |
| 20 |
|
| 21 |
Used for testing purpose |
| 22 |
""" |
| 23 |
|
| 24 |
dest = urlutil.get_unique_pull_path_obj(b'getflogheads', ui) |
| 25 |
peer = factory.peer(repo, {}, dest) |
| 26 |
|
| 27 |
try: |
| 28 |
flogheads = peer.x_rfl_getflogheads(path) |
| 29 |
finally: |
| 30 |
peer.close() |
| 31 |
|
| 32 |
if flogheads: |
| 33 |
for head in flogheads: |
| 34 |
ui.write(head + b'\n') |
| 35 |
else: |
| 36 |
ui.write(_(b'EMPTY\n')) |