D596: amend: add tests for amending only some files from commit to be amended
singhsrb (Saurabh Singh)
phabricator at mercurial-scm.org
Sun Sep 3 10:20:24 EDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6fb5a06b92c6: amend: add tests for amending only some files from commit to be amended (authored by singhsrb).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D596?vs=1565&id=1585
REVISION DETAIL
https://phab.mercurial-scm.org/D596
AFFECTED FILES
tests/test-commit-amend.t
CHANGE DETAILS
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -1174,3 +1174,96 @@
new mode 100755
#endif
+
+Test amend with file inclusion options
+--------------------------------------
+
+These tests ensure that we are always amending some files that were part of the
+pre-amend commit. We want to test that the remaining files in the pre-amend
+commit were not changed in the amended commit. We do so by performing a diff of
+the amended commit against its parent commit.
+ $ cd ..
+ $ hg init testfileinclusions
+ $ cd testfileinclusions
+ $ echo a > a
+ $ echo b > b
+ $ hg commit -Aqm "Adding a and b"
+
+Only add changes to a particular file
+ $ echo a >> a
+ $ echo b >> b
+ $ hg commit --amend -I a
+ $ hg diff --git -r null -r .
+ diff --git a/a b/a
+ new file mode 100644
+ --- /dev/null
+ +++ b/a
+ @@ -0,0 +1,2 @@
+ +a
+ +a
+ diff --git a/b b/b
+ new file mode 100644
+ --- /dev/null
+ +++ b/b
+ @@ -0,0 +1,1 @@
+ +b
+
+ $ echo a >> a
+ $ hg commit --amend b
+ $ hg diff --git -r null -r .
+ diff --git a/a b/a
+ new file mode 100644
+ --- /dev/null
+ +++ b/a
+ @@ -0,0 +1,2 @@
+ +a
+ +a
+ diff --git a/b b/b
+ new file mode 100644
+ --- /dev/null
+ +++ b/b
+ @@ -0,0 +1,2 @@
+ +b
+ +b
+
+Exclude changes to a particular file
+ $ echo b >> b
+ $ hg commit --amend -X a
+ $ hg diff --git -r null -r .
+ diff --git a/a b/a
+ new file mode 100644
+ --- /dev/null
+ +++ b/a
+ @@ -0,0 +1,2 @@
+ +a
+ +a
+ diff --git a/b b/b
+ new file mode 100644
+ --- /dev/null
+ +++ b/b
+ @@ -0,0 +1,3 @@
+ +b
+ +b
+ +b
+
+Check the addremove flag
+ $ echo c > c
+ $ rm a
+ $ hg commit --amend -A
+ removing a
+ adding c
+ $ hg diff --git -r null -r .
+ diff --git a/b b/b
+ new file mode 100644
+ --- /dev/null
+ +++ b/b
+ @@ -0,0 +1,3 @@
+ +b
+ +b
+ +b
+ diff --git a/c b/c
+ new file mode 100644
+ --- /dev/null
+ +++ b/c
+ @@ -0,0 +1,1 @@
+ +c
To: singhsrb, #hg-reviewers
Cc: durham, mercurial-devel
More information about the Mercurial-devel
mailing list