mercurial/commands.py
changeset 3658 d12c8668b102
parent 3657 4d988b7412f2
child 3659 025f68f22ae2
equal deleted inserted replaced
3657:4d988b7412f2 3658:d12c8668b102
  1612         parents = [p for p in repo.changelog.parents(n) if p != nullid]
  1612         parents = [p for p in repo.changelog.parents(n) if p != nullid]
  1613         if opts['no_merges'] and len(parents) == 2:
  1613         if opts['no_merges'] and len(parents) == 2:
  1614             continue
  1614             continue
  1615         displayer.show(changenode=n)
  1615         displayer.show(changenode=n)
  1616 
  1616 
  1617 def parents(ui, repo, file_=None, rev=None, **opts):
  1617 def parents(ui, repo, file_=None, **opts):
  1618     """show the parents of the working dir or revision
  1618     """show the parents of the working dir or revision
  1619 
  1619 
  1620     Print the working directory's parent revisions.
  1620     Print the working directory's parent revisions.
  1621     """
  1621     """
  1622     # legacy
  1622     rev = opts.get('rev')
  1623     if file_ and not rev:
       
  1624         try:
       
  1625             rev = repo.lookup(file_)
       
  1626             file_ = None
       
  1627         except hg.RepoError:
       
  1628             pass
       
  1629         else:
       
  1630             ui.warn(_("'hg parent REV' is deprecated, "
       
  1631                       "please use 'hg parents -r REV instead\n"))
       
  1632 
       
  1633     if rev:
  1623     if rev:
  1634         if file_:
  1624         if file_:
  1635             ctx = repo.filectx(file_, changeid=rev)
  1625             ctx = repo.filectx(file_, changeid=rev)
  1636         else:
  1626         else:
  1637             ctx = repo.changectx(rev)
  1627             ctx = repo.changectx(rev)