(0.9.2compat) merge with default
Adapt preserving filemode.
Fix a typo.
Clean up last merge.
--- 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