changeset 4530:0ac7fee4f024

Make sure the changelog mentions files whose flags changed These changes don't actually need a new filelog entry (see next patch), but if we don't mention the files in the changelog, it becomes much harder to find all changesets that touch a file (not even a "hg log --removed file" will work).
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 09 Jun 2007 01:04:28 -0300
parents 860478527568
children b51a8138292a
files mercurial/localrepo.py tests/test-flags tests/test-flags.out
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -784,7 +784,16 @@ class localrepository(repo.repository):
             self.ui.note(f + "\n")
             try:
                 new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
-                m1.set(f, is_exec(f), is_link(f))
+                new_exec = is_exec(f)
+                new_link = is_link(f)
+                if not changed or changed[-1] != f:
+                    # mention the file in the changelog if some flag changed,
+                    # even if there was no content change.
+                    old_exec = m1.execf(f)
+                    old_link = m1.linkf(f)
+                    if old_exec != new_exec or old_link != new_link:
+                        changed.append(f)
+                m1.set(f, new_exec, new_link)
             except (OSError, IOError):
                 if use_dirstate:
                     self.ui.warn(_("trouble committing %s!\n") % f)
--- a/tests/test-flags
+++ b/tests/test-flags
@@ -19,6 +19,8 @@ hg pull ../test1
 hg co
 chmod +x a
 hg ci -m "chmod +x a" -d "1000000 0"
+echo % the changelog should mention file a:
+hg tip --template '#files#\n'
 
 cd ../test1
 echo 123 >>a
--- a/tests/test-flags.out
+++ b/tests/test-flags.out
@@ -7,6 +7,8 @@ adding file changes
 added 1 changesets with 2 changes to 2 files
 (run 'hg update' to get a working copy)
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% the changelog should mention file a:
+a
 pulling from ../test2
 searching for changes
 adding changesets