Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 4667:c7a81e3ae80f
identify: work with remote repos
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 21 Jun 2007 11:54:16 -0500 |
parents | 48c94bffdb28 |
children | 150afe6becf6 6858a7477a5e |
comparison
equal
deleted
inserted
replaced
4666:48c94bffdb28 | 4667:c7a81e3ae80f |
---|---|
1445 | 1445 |
1446 hexfunc = ui.debugflag and hex or short | 1446 hexfunc = ui.debugflag and hex or short |
1447 default = not (num or id or branch or tags) | 1447 default = not (num or id or branch or tags) |
1448 output = [] | 1448 output = [] |
1449 | 1449 |
1450 if not rev: | 1450 if not repo.local(): |
1451 if not rev: | |
1452 rev = "tip" | |
1453 if num or branch or tags: | |
1454 raise util.Abort( | |
1455 "can't query remote revision number, branch, or tags") | |
1456 output = [hexfunc(repo.lookup(rev))] | |
1457 elif not rev: | |
1451 ctx = repo.workingctx() | 1458 ctx = repo.workingctx() |
1452 parents = ctx.parents() | 1459 parents = ctx.parents() |
1453 changed = False | 1460 changed = False |
1454 if default or id or num: | 1461 if default or id or num: |
1455 changed = ctx.files() + ctx.deleted() | 1462 changed = ctx.files() + ctx.deleted() |
1464 if default or id: | 1471 if default or id: |
1465 output = [hexfunc(ctx.node())] | 1472 output = [hexfunc(ctx.node())] |
1466 if num: | 1473 if num: |
1467 output.append(str(ctx.rev())) | 1474 output.append(str(ctx.rev())) |
1468 | 1475 |
1469 if default and not ui.quiet: | 1476 if repo.local() and default and not ui.quiet: |
1470 b = util.tolocal(ctx.branch()) | 1477 b = util.tolocal(ctx.branch()) |
1471 if b != 'default': | 1478 if b != 'default': |
1472 output.append("(%s)" % b) | 1479 output.append("(%s)" % b) |
1473 | 1480 |
1474 # multiple tags for a single parent separated by '/' | 1481 # multiple tags for a single parent separated by '/' |
3054 } | 3061 } |
3055 | 3062 |
3056 norepo = ("clone init version help debugancestor debugcomplete debugdata" | 3063 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
3057 " debugindex debugindexdot debugdate debuginstall") | 3064 " debugindex debugindexdot debugdate debuginstall") |
3058 optionalrepo = ("paths serve showconfig") | 3065 optionalrepo = ("paths serve showconfig") |
3066 remoterepo = ("identify") | |
3059 | 3067 |
3060 def dispatch(args): | 3068 def dispatch(args): |
3061 try: | 3069 try: |
3062 u = ui.ui(traceback='--traceback' in args) | 3070 u = ui.ui(traceback='--traceback' in args) |
3063 except util.Abort, inst: | 3071 except util.Abort, inst: |