##// END OF EJS Templates
unamend: fix unamending of renamed rename...
Martin von Zweigbergk -
r41372:19c590ce default
parent child Browse files
Show More
@@ -93,13 +93,13 b' def _commitfiltered(repo, ctx, match, ke'
93 93 extra=ctx.extra())
94 94 return repo.commitctx(new)
95 95
96 def _fixdirstate(repo, oldctx, newctx, status):
96 def _fixdirstate(repo, oldctx, newctx, match=None):
97 97 """ fix the dirstate after switching the working directory from oldctx to
98 98 newctx which can be result of either unamend or uncommit.
99 99 """
100 100 ds = repo.dirstate
101 101 copies = dict(ds.copies())
102 s = status
102 s = newctx.status(oldctx, match=match)
103 103 for f in s.modified:
104 104 if ds[f] == 'r':
105 105 # modified + removed -> removed
@@ -121,11 +121,7 b' def _fixdirstate(repo, oldctx, newctx, s'
121 121 ds.remove(f)
122 122
123 123 # Merge old parent and old working dir copies
124 oldcopies = {}
125 for f in (s.modified + s.added):
126 src = oldctx[f].renamed()
127 if src:
128 oldcopies[f] = src[0]
124 oldcopies = copiesmod.pathcopies(newctx, oldctx, match)
129 125 oldcopies.update(copies)
130 126 copies = dict((dst, oldcopies.get(src, src))
131 127 for dst, src in oldcopies.iteritems())
@@ -181,8 +177,7 b' def uncommit(ui, repo, *pats, **opts):'
181 177
182 178 with repo.dirstate.parentchange():
183 179 repo.dirstate.setparents(newid, node.nullid)
184 s = old.p1().status(old, match=match)
185 _fixdirstate(repo, old, repo[newid], s)
180 _fixdirstate(repo, old, repo[newid], match)
186 181
187 182 scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True)
188 183
@@ -245,8 +240,7 b' def unamend(ui, repo, **opts):'
245 240
246 241 with dirstate.parentchange():
247 242 dirstate.setparents(newprednode, node.nullid)
248 s = repo.status(predctx, curctx)
249 _fixdirstate(repo, curctx, newpredctx, s)
243 _fixdirstate(repo, curctx, newpredctx)
250 244
251 245 mapping = {curctx.node(): (newprednode,)}
252 246 scmutil.cleanupnodes(repo, mapping, 'unamend', fixphase=True)
@@ -385,9 +385,9 b' Rename a->b, then amend b->c. After unam'
385 385 A b
386 386 a
387 387 R a
388 BROKEN: should indicate that b was renamed to c
389 388 $ hg st --copies
390 389 A c
390 b
391 391 R b
392 392 $ hg revert -qa
393 393 $ rm c
@@ -405,7 +405,7 b' Rename a->b, then amend b->c, and workin'
405 405 A b
406 406 a
407 407 R a
408 BROKEN: should indicate that b was renamed to d
409 408 $ hg st --copies
410 409 A d
410 b
411 411 R b
General Comments 0
You need to be logged in to leave comments. Login now