Show More
@@ -2906,7 +2906,14 b' def amend(ui, repo, old, extra, pats, op' | |||
|
2906 | 2906 | filestoamend = {f for f in wctx.files() if matcher(f)} |
|
2907 | 2907 | |
|
2908 | 2908 | changes = len(filestoamend) > 0 |
|
2909 |
|
|
|
2909 | changeset_copies = ( | |
|
2910 | repo.ui.config(b'experimental', b'copies.read-from') | |
|
2911 | != b'filelog-only' | |
|
2912 | ) | |
|
2913 | # If there are changes to amend or if copy information needs to be read | |
|
2914 | # from the changeset extras, we cannot take the fast path of using | |
|
2915 | # filectxs from the old commit. | |
|
2916 | if changes or changeset_copies: | |
|
2910 | 2917 | # Recompute copies (avoid recording a -> b -> a) |
|
2911 | 2918 | copied = copies.pathcopies(base, wctx, matcher) |
|
2912 | 2919 | if old.p2: |
@@ -2927,19 +2934,19 b' def amend(ui, repo, old, extra, pats, op' | |||
|
2927 | 2934 | |
|
2928 | 2935 | def filectxfn(repo, ctx_, path): |
|
2929 | 2936 | try: |
|
2937 | # Return None for removed files. | |
|
2938 | if path in wctx.removed(): | |
|
2939 | return None | |
|
2940 | ||
|
2930 | 2941 | # If the file being considered is not amongst the files |
|
2931 |
# to be amended, we should |
|
|
2942 | # to be amended, we should use the file context from the | |
|
2932 | 2943 | # old changeset. This avoids issues when only some files in |
|
2933 | 2944 | # the working copy are being amended but there are also |
|
2934 | 2945 | # changes to other files from the old changeset. |
|
2935 |
if path |
|
|
2936 |
|
|
|
2937 | ||
|
2938 |
|
|
|
2939 | if path in wctx.removed(): | |
|
2940 | return None | |
|
2941 | ||
|
2942 | fctx = wctx[path] | |
|
2946 | if path in filestoamend: | |
|
2947 | fctx = wctx[path] | |
|
2948 | else: | |
|
2949 | fctx = old.filectx(path) | |
|
2943 | 2950 | flags = fctx.flags() |
|
2944 | 2951 | mctx = context.memfilectx( |
|
2945 | 2952 | repo, |
@@ -324,7 +324,7 b' Existing copy information is preserved b' | |||
|
324 | 324 | $ hg ci --amend -m 'new description' |
|
325 | 325 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob) |
|
326 | 326 | $ hg showcopies |
|
327 | a -> l (no-extra !) | |
|
327 | a -> l | |
|
328 | 328 | $ cd .. |
|
329 | 329 | |
|
330 | 330 | Test rebasing a commit with copy information |
General Comments 0
You need to be logged in to leave comments.
Login now