# HG changeset patch # User Matt Mackall # Date 1182444856 18000 # Node ID c7a81e3ae80f3e862e75636bf96808c29dce7ef3 # Parent 48c94bffdb28e332802736313af327b47f8fdab1 identify: work with remote repos diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -316,7 +316,7 @@ def dispatch(ui, args): try: repo = hg.repository(ui, path=path) ui = repo.ui - if not repo.local(): + if not repo.local() and cmd not in commands.remoterepo.split(): raise util.Abort(_("repository '%s' is not local") % path) except hg.RepoError: if cmd not in commands.optionalrepo.split(): diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1447,7 +1447,14 @@ def identify(ui, repo, rev=None, num=Non default = not (num or id or branch or tags) output = [] - if not rev: + if not repo.local(): + if not rev: + rev = "tip" + if num or branch or tags: + raise util.Abort( + "can't query remote revision number, branch, or tags") + output = [hexfunc(repo.lookup(rev))] + elif not rev: ctx = repo.workingctx() parents = ctx.parents() changed = False @@ -1466,7 +1473,7 @@ def identify(ui, repo, rev=None, num=Non if num: output.append(str(ctx.rev())) - if default and not ui.quiet: + if repo.local() and default and not ui.quiet: b = util.tolocal(ctx.branch()) if b != 'default': output.append("(%s)" % b) @@ -3056,6 +3063,7 @@ table = { norepo = ("clone init version help debugancestor debugcomplete debugdata" " debugindex debugindexdot debugdate debuginstall") optionalrepo = ("paths serve showconfig") +remoterepo = ("identify") def dispatch(args): try: