Patchwork [Bug,5830] New: Record on a moved file ignores chunk selection

login
register
mail settings
Submitter mercurial-bugs@mercurial-scm.org
Date March 29, 2018, 3:11 a.m.
Message ID <bug-5830-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/29932/
State Not Applicable
Headers show

Comments

mercurial-bugs@mercurial-scm.org - March 29, 2018, 3:11 a.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=5830

            Bug ID: 5830
           Summary: Record on a moved file ignores chunk selection
           Product: Mercurial
           Version: 4.5
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: record
          Assignee: bugzilla@mercurial-scm.org
          Reporter: rdamazio@google.com
                CC: mercurial-devel@mercurial-scm.org

Mercurial version: 4.5+624-e46b24582fa0

Create a repo:
$ hg init

Create two files:
$ cat << EOF > file1
1
2
3
4
5
EOF
$ cat << EOF > file2
9
8
7
6
5
EOF
$ hg ci -A -m "First"

Rename one of the files, then change two lines in each file:
$ hg mv file1 file1new
$ cat << EOF > file1new
1
foo
3
bar
5
EOF
$ cat << EOF > file2
9
foo
7
bar
5
EOF
$ hg ci -m "Second"

Split the second commit, select only the "foo" changes for the first split, and
"bar" for the second:
$ hg --config ui.username=rdamazio --config extensions.split= split

This also reproduces with "commit --interactive" instead of the commit+split I
did above.

Patch

diff --git a/file1 b/file1new
rename from file1
rename to file1new
2 hunks, 2 lines changed
examine changes to 'file1' and 'file1new'? [Ynesfdaq?] 

@@ -1,3 +1,3 @@ 
 1
-2
+foo
 3
record change 1/4 to 'file1new'? [Ynesfdaq?] 

@@ -3,3 +3,3 @@ 
 3
-4
+bar
 5
record change 2/4 to 'file1new'? [Ynesfdaq?] n

diff --git a/file2 b/file2
2 hunks, 2 lines changed
examine changes to 'file2'? [Ynesfdaq?] 

@@ -1,3 +1,3 @@ 
 9
-8
+foo
 7
record change 3/4 to 'file2'? [Ynesfdaq?] 

@@ -3,3 +3,3 @@ 
 7
-6
+bar
 5
record change 4/4 to 'file2'? [Ynesfdaq?] n

created new head                                                                
diff --git a/file2 b/file2
1 hunks, 1 lines changed
examine changes to 'file2'? [Ynesfdaq?] 

@@ -1,5 +1,5 @@ 
 9
 foo
 7
-6
+bar
 5
record this change to 'file2'? [Ynesfdaq?] 

Notice that the second split did not even prompt me for the "bar" line from the
first commit (to which I answered "n") - it was already included in the first
split, when it shouldn't have been.

As expected, it's not on the second change:
$ hg diff -c .
diff -r 8d3963b0e86a -r f8566424e854 file2
--- a/file2     Wed Mar 28 20:01:16 2018 -0700
+++ b/file2     Wed Mar 28 20:01:50 2018 -0700
@@ -1,5 +1,5 @@ 
 9
 foo
 7
-6
+bar
 5