##// END OF EJS Templates
identify: take a path to a remote repo...
Matt Mackall -
r4671:150afe6b default
parent child Browse files
Show More
@@ -321,7 +321,7 b' def dispatch(ui, args):'
321 try:
321 try:
322 repo = hg.repository(ui, path=path)
322 repo = hg.repository(ui, path=path)
323 ui = repo.ui
323 ui = repo.ui
324 if not repo.local() and cmd not in commands.remoterepo.split():
324 if not repo.local():
325 raise util.Abort(_("repository '%s' is not local") % path)
325 raise util.Abort(_("repository '%s' is not local") % path)
326 except hg.RepoError:
326 except hg.RepoError:
327 if cmd not in commands.optionalrepo.split():
327 if cmd not in commands.optionalrepo.split():
@@ -1432,10 +1432,13 b' def help_(ui, name=None, with_version=Fa'
1432 else:
1432 else:
1433 ui.write("%s\n" % first)
1433 ui.write("%s\n" % first)
1434
1434
1435 def identify(ui, repo, rev=None, num=None, id=None, branch=None, tags=None):
1435 def identify(ui, repo, source=None,
1436 rev=None, num=None, id=None, branch=None, tags=None):
1436 """identify the working copy or specified revision
1437 """identify the working copy or specified revision
1437
1438
1438 With no argument, print a summary of the current state of the repo.
1439 With no revision, print a summary of the current state of the repo.
1440
1441 With a path, do a lookup in another repository.
1439
1442
1440 This summary identifies the repository state using one or two parent
1443 This summary identifies the repository state using one or two parent
1441 hash identifiers, followed by a "+" if there are uncommitted changes
1444 hash identifiers, followed by a "+" if there are uncommitted changes
@@ -1447,13 +1450,17 b' def identify(ui, repo, rev=None, num=Non'
1447 default = not (num or id or branch or tags)
1450 default = not (num or id or branch or tags)
1448 output = []
1451 output = []
1449
1452
1450 if not repo.local():
1453 if source:
1454 source, revs = cmdutil.parseurl(ui.expandpath(source), [])
1455 srepo = hg.repository(ui, source)
1456 if not rev and revs:
1457 rev = revs[0]
1451 if not rev:
1458 if not rev:
1452 rev = "tip"
1459 rev = "tip"
1453 if num or branch or tags:
1460 if num or branch or tags:
1454 raise util.Abort(
1461 raise util.Abort(
1455 "can't query remote revision number, branch, or tags")
1462 "can't query remote revision number, branch, or tags")
1456 output = [hexfunc(repo.lookup(rev))]
1463 output = [hexfunc(srepo.lookup(rev))]
1457 elif not rev:
1464 elif not rev:
1458 ctx = repo.workingctx()
1465 ctx = repo.workingctx()
1459 parents = ctx.parents()
1466 parents = ctx.parents()
@@ -1473,7 +1480,7 b' def identify(ui, repo, rev=None, num=Non'
1473 if num:
1480 if num:
1474 output.append(str(ctx.rev()))
1481 output.append(str(ctx.rev()))
1475
1482
1476 if repo.local() and default and not ui.quiet:
1483 if not source and default and not ui.quiet:
1477 b = util.tolocal(ctx.branch())
1484 b = util.tolocal(ctx.branch())
1478 if b != 'default':
1485 if b != 'default':
1479 output.append("(%s)" % b)
1486 output.append("(%s)" % b)
@@ -2856,7 +2863,7 b' table = {'
2856 ('i', 'id', None, _('show global revision id')),
2863 ('i', 'id', None, _('show global revision id')),
2857 ('b', 'branch', None, _('show branch')),
2864 ('b', 'branch', None, _('show branch')),
2858 ('t', 'tags', None, _('show tags'))],
2865 ('t', 'tags', None, _('show tags'))],
2859 _('hg identify [-nibt] [-r REV]')),
2866 _('hg identify [-nibt] [-r REV] [SOURCE]')),
2860 "import|patch":
2867 "import|patch":
2861 (import_,
2868 (import_,
2862 [('p', 'strip', 1,
2869 [('p', 'strip', 1,
@@ -3063,7 +3070,6 b' table = {'
3063 norepo = ("clone init version help debugancestor debugcomplete debugdata"
3070 norepo = ("clone init version help debugancestor debugcomplete debugdata"
3064 " debugindex debugindexdot debugdate debuginstall")
3071 " debugindex debugindexdot debugdate debuginstall")
3065 optionalrepo = ("paths serve showconfig")
3072 optionalrepo = ("paths serve showconfig")
3066 remoterepo = ("identify")
3067
3073
3068 def dispatch(args):
3074 def dispatch(args):
3069 try:
3075 try:
General Comments 0
You need to be logged in to leave comments. Login now