Show More
@@ -1296,9 +1296,6 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1296 |
|
1296 | |||
1297 | wlock = repo.wlock() |
|
1297 | wlock = repo.wlock() | |
1298 | try: |
|
1298 | try: | |
1299 | # Fix up dirstate for copies and renames |
|
|||
1300 | duplicatecopies(repo, None, base.node()) |
|
|||
1301 |
|
||||
1302 | # First, do a regular commit to record all changes in the working |
|
1299 | # First, do a regular commit to record all changes in the working | |
1303 | # directory (if there are any) |
|
1300 | # directory (if there are any) | |
1304 | node = commit(ui, repo, commitfunc, pats, opts) |
|
1301 | node = commit(ui, repo, commitfunc, pats, opts) | |
@@ -1326,6 +1323,8 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1326 | date = ctx.date() |
|
1323 | date = ctx.date() | |
1327 | message = ctx.description() |
|
1324 | message = ctx.description() | |
1328 | extra = ctx.extra() |
|
1325 | extra = ctx.extra() | |
|
1326 | # Recompute copies (avoid recording a -> b -> a) | |||
|
1327 | copied = copies.pathcopies(base, ctx) | |||
1329 |
|
1328 | |||
1330 | # Prune files which were reverted by the updates: if old introduced |
|
1329 | # Prune files which were reverted by the updates: if old introduced | |
1331 | # file X and our intermediate commit, node, renamed that file, then |
|
1330 | # file X and our intermediate commit, node, renamed that file, then | |
@@ -1339,8 +1338,7 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1339 | if f in base.manifest(): |
|
1338 | if f in base.manifest(): | |
1340 | b = base.filectx(f) |
|
1339 | b = base.filectx(f) | |
1341 | return (a.data() == b.data() |
|
1340 | return (a.data() == b.data() | |
1342 | and a.flags() == b.flags() |
|
1341 | and a.flags() == b.flags()) | |
1343 | and a.renamed() == b.renamed()) |
|
|||
1344 | else: |
|
1342 | else: | |
1345 | return False |
|
1343 | return False | |
1346 | else: |
|
1344 | else: | |
@@ -1349,7 +1347,13 b' def amend(ui, repo, commitfunc, old, ext' | |||||
1349 |
|
1347 | |||
1350 | def filectxfn(repo, ctx_, path): |
|
1348 | def filectxfn(repo, ctx_, path): | |
1351 | try: |
|
1349 | try: | |
1352 |
|
|
1350 | fctx = ctx[path] | |
|
1351 | flags = fctx.flags() | |||
|
1352 | mctx = context.memfilectx(fctx.path(), fctx.data(), | |||
|
1353 | islink='l' in flags, | |||
|
1354 | isexec='x' in flags, | |||
|
1355 | copied=copied.get(path)) | |||
|
1356 | return mctx | |||
1353 | except KeyError: |
|
1357 | except KeyError: | |
1354 | raise IOError() |
|
1358 | raise IOError() | |
1355 | else: |
|
1359 | else: |
@@ -293,11 +293,23 b' Follow copies/renames:' | |||||
293 | $ hg cp a f |
|
293 | $ hg cp a f | |
294 | $ mv f.orig f |
|
294 | $ mv f.orig f | |
295 | $ hg ci --amend -m replacef |
|
295 | $ hg ci --amend -m replacef | |
296 |
saved backup bundle to $TESTTMP/.hg/strip-backup/ |
|
296 | saved backup bundle to $TESTTMP/.hg/strip-backup/20a7413547f9-amend-backup.hg | |
297 | $ hg st --change . --copies |
|
297 | $ hg st --change . --copies | |
298 | M f |
|
|||
299 | $ hg log -r . --template "{file_copies}\n" |
|
298 | $ hg log -r . --template "{file_copies}\n" | |
300 | f (a) |
|
299 | ||
|
300 | ||||
|
301 | Move added file (issue3410): | |||
|
302 | ||||
|
303 | $ echo g >> g | |||
|
304 | $ hg ci -Am g | |||
|
305 | adding g | |||
|
306 | $ hg mv g h | |||
|
307 | $ hg ci --amend | |||
|
308 | saved backup bundle to $TESTTMP/.hg/strip-backup/5daa77a5d616-amend-backup.hg | |||
|
309 | $ hg st --change . --copies h | |||
|
310 | A h | |||
|
311 | $ hg log -r . --template "{file_copies}\n" | |||
|
312 | ||||
301 |
|
313 | |||
302 | Can't rollback an amend: |
|
314 | Can't rollback an amend: | |
303 |
|
315 |
General Comments 0
You need to be logged in to leave comments.
Login now