(0.9.2compat) merge with default 0.9.2compat
authorChristian Ebert <blacktrash@gmx.net>
Wed, 14 Sep 2011 16:19:33 +0100
branch0.9.2compat
changeset 984 a4ea5c2d3ff3
parent 707 e5feed5534d7 (current diff)
parent 982 639bb4617c70 (diff)
(0.9.2compat) merge with default Adapt preserving filemode. Fix a typo. Clean up last merge.
README
hgkw/keyword.py
tests/bundles/test-keyword.hg
tests/get-with-headers.py
tests/run-tests.py
tests/test-keyword
tests/test-keyword.out
tests/test-keyword.t
--- a/hgkw/keyword.py	Tue Mar 30 11:12:09 2010 +0100
+++ b/hgkw/keyword.py	Wed Sep 14 16:19:33 2011 +0100
@@ -338,8 +338,10 @@
         candidates = [f for f in candidates if self.iskwfile(f, islink)]
         if candidates:
             self.restrict = True # do not expand when reading
-            msg = (expand and _('overwriting %s expanding keywords\n')
-                   or _('overwriting %s shrinking keywords\n'))
+            if expand:
+                msg = _('overwriting %s expanding keywords\n')
+            else:
+                msg = _('overwriting %s shrinking keywords\n')
             overwritten = []
             for f in candidates:
                 fp = self.repo.file(f)
@@ -354,7 +356,10 @@
                     found = self.re_kw.search(data)
                 if found:
                     self.ui.note(msg % f)
+                    fpath = self.repo.wjoin(f)
+                    mode = os.lstat(fpath).st_mode
                     self.repo.wwrite(f, data, mf.flags(f))
+                    os.chmod(fpath, mode)
                     overwritten.append(f)
             _normal(self.repo, overwritten)
             self.restrict = False
@@ -566,7 +571,7 @@
     cwd = pats and repo.getcwd() or ''
     modified, added, removed, deleted, unknown, ignored, clean = status
     files = []
-    if not opts.get('unknown') or ops.get('all'):
+    if not opts.get('unknown') or opts.get('all'):
         try:
             # f67d1468ac50
             files = util.sort(modified + added + clean)
--- a/tests/test-keyword	Tue Mar 30 11:12:09 2010 +0100
+++ b/tests/test-keyword	Wed Sep 14 16:19:33 2011 +0100
@@ -107,11 +107,14 @@
 echo % cat
 cat a b
 
-echo % check whether expansion is filewise
+echo % check whether expansion is filewise and filemode is preserved
 echo '$Id$' > c
 echo 'tests for different changenodes' >> c
+chmod 600 c
+ls -l c | cut -b 1-10
 echo % commit c
 hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
+ls -l c | cut -b 1-10
 echo % force expansion
 hg -v kwexpand
 echo % compare changenodes in a c
--- a/tests/test-keyword.out	Tue Mar 30 11:12:09 2010 +0100
+++ b/tests/test-keyword.out	Wed Sep 14 16:19:33 2011 +0100
@@ -87,9 +87,11 @@
 do not process $Id:
 xxx $
 ignore $Id$
-% check whether expansion is filewise
+% check whether expansion is filewise and filemode is preserved
+-rw-------
 % commit c
 adding c
+-rw-------
 % force expansion
 overwriting a expanding keywords
 overwriting c expanding keywords