# HG changeset patch # User Christian Ebert # Date 1316013573 -3600 # Node ID a4ea5c2d3ff3c37f0a04fda7500b00f10a48bd20 # Parent e5feed5534d7ccbb0d8bdd7490ba5d64a22086f9# Parent 639bb4617c704de72f61591be8563361c79634a7 (0.9.2compat) merge with default Adapt preserving filemode. Fix a typo. Clean up last merge. diff -r e5feed5534d7 -r a4ea5c2d3ff3 README diff -r e5feed5534d7 -r a4ea5c2d3ff3 hgkw/keyword.py --- 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) diff -r e5feed5534d7 -r a4ea5c2d3ff3 tests/test-keyword --- 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 ' +ls -l c | cut -b 1-10 echo % force expansion hg -v kwexpand echo % compare changenodes in a c diff -r e5feed5534d7 -r a4ea5c2d3ff3 tests/test-keyword.out --- 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