mercurial/commands.py
changeset 14610 5d6244930559
parent 14604 b1a534335548
child 14611 adbf5e7df96d
equal deleted inserted replaced
14609:f53dc0787424 14610:5d6244930559
  3085                 # launch the editor
  3085                 # launch the editor
  3086                 message = None
  3086                 message = None
  3087             ui.debug('message:\n%s\n' % message)
  3087             ui.debug('message:\n%s\n' % message)
  3088 
  3088 
  3089             wp = repo.parents()
  3089             wp = repo.parents()
       
  3090             if len(wp) == 1:
       
  3091                 wp.append(repo[nullid])
  3090             if opts.get('exact'):
  3092             if opts.get('exact'):
  3091                 if not nodeid or not p1:
  3093                 if not nodeid or not p1:
  3092                     raise util.Abort(_('not a Mercurial patch'))
  3094                     raise util.Abort(_('not a Mercurial patch'))
  3093                 p1 = repo.lookup(p1)
  3095                 p1 = repo[p1]
  3094                 p2 = repo.lookup(p2 or hex(nullid))
  3096                 p2 = repo[p2 or nullid]
  3095 
       
  3096                 if p1 != wp[0].node():
       
  3097                     hg.clean(repo, p1)
       
  3098                 repo.dirstate.setparents(p1, p2)
       
  3099             elif p2:
  3097             elif p2:
  3100                 try:
  3098                 try:
  3101                     p1 = repo.lookup(p1)
  3099                     p1 = repo[p1]
  3102                     p2 = repo.lookup(p2)
  3100                     p2 = repo[p2]
  3103                     if p1 == wp[0].node():
       
  3104                         repo.dirstate.setparents(p1, p2)
       
  3105                 except error.RepoError:
  3101                 except error.RepoError:
  3106                     pass
  3102                     p1, p2 = wp
       
  3103             else:
       
  3104                 p1, p2 = wp
       
  3105 
       
  3106             if opts.get('exact') and p1 != wp[0]:
       
  3107                 hg.clean(repo, p1.node())
       
  3108             if p1 != wp[0] and p2 != wp[1]:
       
  3109                 repo.dirstate.setparents(p1.node(), p2.node())
       
  3110 
  3107             if opts.get('exact') or opts.get('import_branch'):
  3111             if opts.get('exact') or opts.get('import_branch'):
  3108                 repo.dirstate.setbranch(branch or 'default')
  3112                 repo.dirstate.setbranch(branch or 'default')
  3109 
  3113 
  3110             files = set()
  3114             files = set()
  3111             patch.patch(ui, repo, tmpname, strip=strip, files=files,
  3115             patch.patch(ui, repo, tmpname, strip=strip, files=files,