comparison hgext/rebase.py @ 7954:b969611064ae

rebase: don't lose rename/copy data (Issue1423)
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Mon, 30 Mar 2009 18:26:32 +0200
parents b214066b7e1d
children c3d4ff03ec72
comparison
equal deleted inserted replaced
7953:8c6f823efcc9 7954:b969611064ae
12 For more information: 12 For more information:
13 http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject 13 http://www.selenic.com/mercurial/wiki/index.cgi/RebaseProject
14 ''' 14 '''
15 15
16 from mercurial import util, repair, merge, cmdutil, commands, error 16 from mercurial import util, repair, merge, cmdutil, commands, error
17 from mercurial import extensions, ancestor 17 from mercurial import extensions, ancestor, copies
18 from mercurial.commands import templateopts 18 from mercurial.commands import templateopts
19 from mercurial.node import nullrev 19 from mercurial.node import nullrev
20 from mercurial.i18n import _ 20 from mercurial.i18n import _
21 import os, errno 21 import os, errno
22 22
208 raise util.Abort(_('fix unresolved conflicts with hg resolve then ' 208 raise util.Abort(_('fix unresolved conflicts with hg resolve then '
209 'run hg rebase --continue')) 209 'run hg rebase --continue'))
210 else: # we have an interrupted rebase 210 else: # we have an interrupted rebase
211 repo.ui.debug(_('resuming interrupted rebase\n')) 211 repo.ui.debug(_('resuming interrupted rebase\n'))
212 212
213 213 # Keep track of renamed files in the revision that is going to be rebased
214 # Here we simulate the copies and renames in the source changeset
215 cop, diver = copies.copies(repo, repo[rev], repo[target], repo[p2], True)
216 m1 = repo[rev].manifest()
217 m2 = repo[target].manifest()
218 for k, v in cop.iteritems():
219 if k in m1:
220 if v in m1 or v in m2:
221 repo.dirstate.copy(v, k)
222 if v in m2 and v not in m1:
223 repo.dirstate.remove(v)
224
214 newrev = concludenode(repo, rev, p1, p2, state, collapse, 225 newrev = concludenode(repo, rev, p1, p2, state, collapse,
215 extrafn=extrafn) 226 extrafn=extrafn)
216 227
217 # Update the state 228 # Update the state
218 if newrev is not None: 229 if newrev is not None: