D6368: tests: add test for {file_mods}, {file_adds}, {file_dels} on merge commit

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu May 16 13:41:28 EDT 2019


martinvonz updated this revision to Diff 15152.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6368?vs=15080&id=15152

REVISION DETAIL
  https://phab.mercurial-scm.org/D6368

AFFECTED FILES
  mercurial/context.py
  tests/test-template-keywords.t

CHANGE DETAILS

diff --git a/tests/test-template-keywords.t b/tests/test-template-keywords.t
--- a/tests/test-template-keywords.t
+++ b/tests/test-template-keywords.t
@@ -798,6 +798,23 @@
   fourth
   third
 
+Test files lists on merge commit:
+
+  $ hg co '.^' -q
+  $ touch c
+  $ hg add c
+  $ hg ci -qm 'add file'
+  $ hg merge 10 -q
+  $ hg ci -m 'merge'
+  $ hg log -l1 -T '{files}\n'
+  a fourth
+  $ hg log -l1 -T '{file_mods}\n'
+  third
+  $ hg log -l1 -T '{file_adds}\n'
+  b fifth
+  $ hg log -l1 -T '{file_dels}\n'
+  a fourth
+
 Test file copies dict:
 
   $ hg log -r8 -T '{join(file_copies, " ")}\n'
@@ -818,7 +835,7 @@
 
 Test file attributes:
 
-  $ hg log -l1 -T '{files % "{status} {pad(size, 3, left=True)} {path}\n"}'
+  $ hg log -r10 -T '{files % "{status} {pad(size, 3, left=True)} {path}\n"}'
   R     a
   A   0 b
   A   7 fifth
@@ -834,7 +851,7 @@
 
 Test index keyword:
 
-  $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
+  $ hg log -r 10:9 -T '{index + 10}{files % " {index}:{file}"}\n'
   10 0:a 1:b 2:fifth 3:fourth 4:third
   11 0:a
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -465,8 +465,8 @@
         return self._changeset.files
     def filesmodified(self):
         modified = set(self.files())
-        modified.difference_update(self.added())
-        modified.difference_update(self.removed())
+        modified.difference_update(self.filesadded())
+        modified.difference_update(self.filesremoved())
         return sorted(modified)
     def filesadded(self):
         added = []



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list