changeset 7072:4e0d54fbd34f

Show added files as "added" in editor commit message (issue 1330)
author Patrick Mezard <pmezard@gmail.com>
date Thu, 09 Oct 2008 14:16:17 +0200
parents 643c751e60b2
children 6db6f6db026a
files mercurial/localrepo.py tests/test-commit tests/test-commit.out
diffstat 3 files changed, 39 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Oct 08 19:58:35 2008 -0500
+++ b/mercurial/localrepo.py	Thu Oct 09 14:16:17 2008 +0200
@@ -860,6 +860,13 @@
                     else:
                         remove.append(f)
 
+            updated, added = [], []
+            for f in util.sort(changed):
+                if f in m1 or f in m2:
+                    updated.append(f)
+                else:
+                    added.append(f)
+
             # update manifest
             m1.update(new)
             removed = []
@@ -888,9 +895,10 @@
                     edittext.append("HG: branch merge")
                 if branchname:
                     edittext.append("HG: branch '%s'" % util.tolocal(branchname))
-                edittext.extend(["HG: changed %s" % f for f in changed])
+                edittext.extend(["HG: added %s" % f for f in added])
+                edittext.extend(["HG: changed %s" % f for f in updated])
                 edittext.extend(["HG: removed %s" % f for f in removed])
-                if not changed and not remove:
+                if not added and not updated and not removed:
                     edittext.append("HG: no files changed")
                 edittext.append("")
                 # run editor in the repository root
--- a/tests/test-commit	Wed Oct 08 19:58:35 2008 -0500
+++ b/tests/test-commit	Thu Oct 09 14:16:17 2008 +0200
@@ -106,5 +106,21 @@
 hg ci -mmerge -I a
 echo % should succeed
 hg ci -mmerge
+cd ..
+
+
+echo % test commit message content
+hg init commitmsg
+cd commitmsg
+echo changed > changed
+echo removed > removed
+hg ci -qAm init
+
+hg rm removed
+echo changed >> changed
+echo added > added
+hg add added
+HGEDITOR=cat hg ci -A
+cd ..
 
 exit 0
--- a/tests/test-commit.out	Wed Oct 08 19:58:35 2008 -0500
+++ b/tests/test-commit.out	Thu Oct 09 14:16:17 2008 +0200
@@ -106,3 +106,16 @@
 % should fail because we are specifying a pattern
 abort: cannot partially commit a merge (do not specify files or patterns)
 % should succeed
+% test commit message content
+
+
+HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+HG: --
+HG: user: test
+HG: branch 'default'
+HG: added added
+HG: changed changed
+HG: removed removed
+transaction abort!
+rollback completed
+abort: empty commit message