Mercurial > hg-stable
changeset 14021:3eb632d9cf42 stable
extdiff: fix broken symlinks handling (issue1909)
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 29 Apr 2011 08:04:46 +0200 |
parents | 42d5165975ad |
children | 2cd1520664b8 |
files | hgext/extdiff.py tests/test-extdiff.t |
diffstat | 2 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/extdiff.py Tue Apr 26 12:55:26 2011 +0200 +++ b/hgext/extdiff.py Fri Apr 29 08:04:46 2011 +0200 @@ -100,7 +100,8 @@ if 'x' in fctx.flags(): util.set_flags(dest, False, True) if node is None: - fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest))) + fns_and_mtime.append((dest, repo.wjoin(fn), + os.lstat(dest).st_mtime)) return dirname, fns_and_mtime def dodiff(ui, repo, diffcmd, diffopts, pats, opts): @@ -222,7 +223,7 @@ util.system(cmdline, cwd=tmproot) for copy_fn, working_fn, mtime in fns_and_mtime: - if os.path.getmtime(copy_fn) != mtime: + if os.lstat(copy_fn).st_mtime != mtime: ui.debug('file changed while diffing. ' 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) util.copyfile(copy_fn, working_fn)
--- a/tests/test-extdiff.t Tue Apr 26 12:55:26 2011 +0200 +++ b/tests/test-extdiff.t Fri Apr 29 08:04:46 2011 +0200 @@ -167,4 +167,18 @@ $ hg falabala -o this -c 1 diffing this a.8a5febb7f867/a a.34eed99112ab/a [1] + $ cd .. + $ hg init testsymlinks + $ cd testsymlinks + $ echo a > a + $ hg ci -Am adda + adding a + $ echo a >> a + $ ln -s missing linka + $ hg add linka + $ hg falabala -r 0 --traceback + diffing testsymlinks.07f494440405 testsymlinks + [1] + $ cd .. +