mercurial/commands.py
changeset 13878 a8d13ee0ce68
parent 13855 3c43dd85d3d1
child 13891 1bd9f3a6a0d0
equal deleted inserted replaced
13877:653121e6941f 13878:a8d13ee0ce68
   594 
   594 
   595     Returns 0 on success.
   595     Returns 0 on success.
   596     """
   596     """
   597 
   597 
   598     if opts.get('clean'):
   598     if opts.get('clean'):
   599         label = repo[None].parents()[0].branch()
   599         label = repo[None].p1().branch()
   600         repo.dirstate.setbranch(label)
   600         repo.dirstate.setbranch(label)
   601         ui.status(_('reset working directory to branch %s\n') % label)
   601         ui.status(_('reset working directory to branch %s\n') % label)
   602     elif label:
   602     elif label:
   603         if not opts.get('force') and label in repo.branchtags():
   603         if not opts.get('force') and label in repo.branchtags():
   604             if label not in [p.branch() for p in repo.parents()]:
   604             if label not in [p.branch() for p in repo.parents()]:
  1676     if revs and change:
  1676     if revs and change:
  1677         msg = _('cannot specify --rev and --change at the same time')
  1677         msg = _('cannot specify --rev and --change at the same time')
  1678         raise util.Abort(msg)
  1678         raise util.Abort(msg)
  1679     elif change:
  1679     elif change:
  1680         node2 = cmdutil.revsingle(repo, change, None).node()
  1680         node2 = cmdutil.revsingle(repo, change, None).node()
  1681         node1 = repo[node2].parents()[0].node()
  1681         node1 = repo[node2].p1().node()
  1682     else:
  1682     else:
  1683         node1, node2 = cmdutil.revpair(repo, revs)
  1683         node1, node2 = cmdutil.revpair(repo, revs)
  1684 
  1684 
  1685     if reverse:
  1685     if reverse:
  1686         node1, node2 = node2, node1
  1686         node1, node2 = node2, node1
  1903     found = False
  1903     found = False
  1904     follow = opts.get('follow')
  1904     follow = opts.get('follow')
  1905 
  1905 
  1906     def prep(ctx, fns):
  1906     def prep(ctx, fns):
  1907         rev = ctx.rev()
  1907         rev = ctx.rev()
  1908         pctx = ctx.parents()[0]
  1908         pctx = ctx.p1()
  1909         parent = pctx.rev()
  1909         parent = pctx.rev()
  1910         matches.setdefault(rev, {})
  1910         matches.setdefault(rev, {})
  1911         matches.setdefault(parent, {})
  1911         matches.setdefault(parent, {})
  1912         files = revfiles.setdefault(rev, [])
  1912         files = revfiles.setdefault(rev, [])
  1913         for fn in fns:
  1913         for fn in fns:
  1938                 except error.LookupError:
  1938                 except error.LookupError:
  1939                     pass
  1939                     pass
  1940 
  1940 
  1941     for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
  1941     for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
  1942         rev = ctx.rev()
  1942         rev = ctx.rev()
  1943         parent = ctx.parents()[0].rev()
  1943         parent = ctx.p1().rev()
  1944         for fn in sorted(revfiles.get(rev, [])):
  1944         for fn in sorted(revfiles.get(rev, [])):
  1945             states = matches[rev][fn]
  1945             states = matches[rev][fn]
  1946             copy = copies.get(rev, {}).get(fn)
  1946             copy = copies.get(rev, {}).get(fn)
  1947             if fn in skip:
  1947             if fn in skip:
  1948                 if copy:
  1948                 if copy:
  2838                 'branch \'%s\' has %d heads - '
  2838                 'branch \'%s\' has %d heads - '
  2839                 'please merge with an explicit rev\n'
  2839                 'please merge with an explicit rev\n'
  2840                 '(run \'hg heads .\' to see heads)')
  2840                 '(run \'hg heads .\' to see heads)')
  2841                 % (branch, len(bheads)))
  2841                 % (branch, len(bheads)))
  2842 
  2842 
  2843         parent = repo.dirstate.parents()[0]
  2843         parent = repo.dirstate.p1()
  2844         if len(bheads) == 1:
  2844         if len(bheads) == 1:
  2845             if len(repo.heads()) > 1:
  2845             if len(repo.heads()) > 1:
  2846                 raise util.Abort(_(
  2846                 raise util.Abort(_(
  2847                     'branch \'%s\' has one head - '
  2847                     'branch \'%s\' has one head - '
  2848                     'please merge with an explicit rev\n'
  2848                     'please merge with an explicit rev\n'
  3749     if revs and change:
  3749     if revs and change:
  3750         msg = _('cannot specify --rev and --change at the same time')
  3750         msg = _('cannot specify --rev and --change at the same time')
  3751         raise util.Abort(msg)
  3751         raise util.Abort(msg)
  3752     elif change:
  3752     elif change:
  3753         node2 = repo.lookup(change)
  3753         node2 = repo.lookup(change)
  3754         node1 = repo[node2].parents()[0].node()
  3754         node1 = repo[node2].p1().node()
  3755     else:
  3755     else:
  3756         node1, node2 = cmdutil.revpair(repo, revs)
  3756         node1, node2 = cmdutil.revpair(repo, revs)
  3757 
  3757 
  3758     cwd = (pats and repo.getcwd()) or ''
  3758     cwd = (pats and repo.getcwd()) or ''
  3759     end = opts.get('print0') and '\0' or '\n'
  3759     end = opts.get('print0') and '\0' or '\n'