comparison mercurial/cmdutil.py @ 48978:c80544aa4971

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 21 Mar 2022 10:55:50 +0100
parents 642e31cb55f0 877d7e1a4223
children 9be7da341885
comparison
equal deleted inserted replaced
48972:6b31c0676147 48978:c80544aa4971
2903 mergeutil.checkunresolved(ms) 2903 mergeutil.checkunresolved(ms)
2904 2904
2905 filestoamend = {f for f in wctx.files() if matcher(f)} 2905 filestoamend = {f for f in wctx.files() if matcher(f)}
2906 2906
2907 changes = len(filestoamend) > 0 2907 changes = len(filestoamend) > 0
2908 if changes: 2908 changeset_copies = (
2909 repo.ui.config(b'experimental', b'copies.read-from')
2910 != b'filelog-only'
2911 )
2912 # If there are changes to amend or if copy information needs to be read
2913 # from the changeset extras, we cannot take the fast path of using
2914 # filectxs from the old commit.
2915 if changes or changeset_copies:
2909 # Recompute copies (avoid recording a -> b -> a) 2916 # Recompute copies (avoid recording a -> b -> a)
2910 copied = copies.pathcopies(base, wctx, matcher) 2917 copied = copies.pathcopies(base, wctx, matcher)
2911 if old.p2: 2918 if old.p2:
2912 copied.update(copies.pathcopies(old.p2(), wctx, matcher)) 2919 copied.update(copies.pathcopies(old.p2(), wctx, matcher))
2913 2920
2924 if (f not in filestoamend or not samefile(f, wctx, base)) 2931 if (f not in filestoamend or not samefile(f, wctx, base))
2925 ] 2932 ]
2926 2933
2927 def filectxfn(repo, ctx_, path): 2934 def filectxfn(repo, ctx_, path):
2928 try: 2935 try:
2936 # Return None for removed files.
2937 if path in wctx.removed():
2938 return None
2939
2929 # If the file being considered is not amongst the files 2940 # If the file being considered is not amongst the files
2930 # to be amended, we should return the file context from the 2941 # to be amended, we should use the file context from the
2931 # old changeset. This avoids issues when only some files in 2942 # old changeset. This avoids issues when only some files in
2932 # the working copy are being amended but there are also 2943 # the working copy are being amended but there are also
2933 # changes to other files from the old changeset. 2944 # changes to other files from the old changeset.
2934 if path not in filestoamend: 2945 if path in filestoamend:
2935 return old.filectx(path) 2946 fctx = wctx[path]
2936 2947 else:
2937 # Return None for removed files. 2948 fctx = old.filectx(path)
2938 if path in wctx.removed():
2939 return None
2940
2941 fctx = wctx[path]
2942 flags = fctx.flags() 2949 flags = fctx.flags()
2943 mctx = context.memfilectx( 2950 mctx = context.memfilectx(
2944 repo, 2951 repo,
2945 ctx_, 2952 ctx_,
2946 fctx.path(), 2953 fctx.path(),