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