Skip to content
Snippets Groups Projects
Commit f6b047cf authored by Martin Geisler's avatar Martin Geisler
Browse files

histedit: use base for computing renames when folding (issue3729)

When a file was renamed in the very first changeset being histedited,
the rename was not detected. Consider a history like this:

   0  base: add a.txt
   1  first: rename a.txt to b.txt
   2  last: edit b.txt

When 1 and 2 are edited, copies.pathcopies(first, last) correctly
returns that nothing was renamed. We must instead use
copies.pathcopies(first, last) to detect the initial rename.
parent 347ccd93
Branches
Tags
No related merge requests found
......@@ -247,7 +247,7 @@
files.update(ctx.files())
# Recompute copies (avoid recording a -> b -> a)
copied = copies.pathcopies(first, last)
copied = copies.pathcopies(base, last)
# prune files which were reverted by the updates
def samefile(f):
......
......@@ -266,3 +266,37 @@
+6
$ cd ..
Folding with initial rename (issue3729)
---------------------------------------
$ hg init fold-rename
$ cd fold-rename
$ echo a > a.txt
$ hg add a.txt
$ hg commit -m a
$ hg rename a.txt b.txt
$ hg commit -m rename
$ echo b >> b.txt
$ hg commit -m b
$ hg logt --follow b.txt
2:e0371e0426bc b
1:1c4f440a8085 rename
0:6c795aa153cb a
$ hg histedit 1c4f440a8085 --commands - 2>&1 << EOF | fixbundle
> pick 1c4f440a8085 rename
> fold e0371e0426bc b
> EOF
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
reverting b.txt
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg logt --follow b.txt
1:cf858d235c76 rename
0:6c795aa153cb a
$ cd ..
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment