mercurial/commands.py
changeset 7757 af6a63438a8a
parent 7743 ec9b726a9428
child 7762 fece056bf240
equal deleted inserted replaced
7756:db6a03225177 7757:af6a63438a8a
  1536 
  1536 
  1537     hexfunc = ui.debugflag and hex or short
  1537     hexfunc = ui.debugflag and hex or short
  1538     default = not (num or id or branch or tags)
  1538     default = not (num or id or branch or tags)
  1539     output = []
  1539     output = []
  1540 
  1540 
       
  1541     revs = []
  1541     if source:
  1542     if source:
  1542         source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
  1543         source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
  1543         srepo = hg.repository(ui, source)
  1544         repo = hg.repository(ui, source)
       
  1545 
       
  1546     if not repo.local():
  1544         if not rev and revs:
  1547         if not rev and revs:
  1545             rev = revs[0]
  1548             rev = revs[0]
  1546         if not rev:
  1549         if not rev:
  1547             rev = "tip"
  1550             rev = "tip"
  1548         if num or branch or tags:
  1551         if num or branch or tags:
  1549             raise util.Abort(
  1552             raise util.Abort(
  1550                 "can't query remote revision number, branch, or tags")
  1553                 "can't query remote revision number, branch, or tags")
  1551         output = [hexfunc(srepo.lookup(rev))]
  1554         output = [hexfunc(repo.lookup(rev))]
  1552     elif not rev:
  1555     elif not rev:
  1553         ctx = repo[None]
  1556         ctx = repo[None]
  1554         parents = ctx.parents()
  1557         parents = ctx.parents()
  1555         changed = False
  1558         changed = False
  1556         if default or id or num:
  1559         if default or id or num:
  1566         if default or id:
  1569         if default or id:
  1567             output = [hexfunc(ctx.node())]
  1570             output = [hexfunc(ctx.node())]
  1568         if num:
  1571         if num:
  1569             output.append(str(ctx.rev()))
  1572             output.append(str(ctx.rev()))
  1570 
  1573 
  1571     if not source and default and not ui.quiet:
  1574     if repo.local() and default and not ui.quiet:
  1572         b = util.tolocal(ctx.branch())
  1575         b = util.tolocal(ctx.branch())
  1573         if b != 'default':
  1576         if b != 'default':
  1574             output.append("(%s)" % b)
  1577             output.append("(%s)" % b)
  1575 
  1578 
  1576         # multiple tags for a single parent separated by '/'
  1579         # multiple tags for a single parent separated by '/'