No subject


Mon Nov 9 16:40:13 UTC 2009


Here is a standalone test script



--------
#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "extdiff=3D" >> $HGRCPATH
echo "[extdiff]" >> $HGRCPATH
echo "cmd.falabala=3Decho" >> $HGRCPATH
echo "opts.falabala=3Ddiffing" >> $HGRCPATH

hg init repo
cd repo
hg patch -m 0 - <<EOF
diff --git a/a b/a
new file mode 120000
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+missing
\ No newline at end of file
EOF

hg patch -m 1 - <<EOF
diff --git a/a b/a
deleted file mode 120000
--- a/a
+++ /dev/null
@@ -1,1 +0,0 @@
-missing
\ No newline at end of file
diff --git a/b b/b
new file mode 100644
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+b
diff --git a/c b/c
new file mode 120000
--- /dev/null
+++ b/c
@@ -0,0 +1,1 @@
+missing
\ No newline at end of file
EOF

hg falabala -r 0 --traceback
--------


and here is timeless suggested fix:


User: timeless at mozdev.org
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -82,7 +82,8 @@ def snapshot(ui, repo, files, node, tmpr
             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):
@@ -146,7 +147,8 @@ def dodiff(ui, repo, diffcmd, diffopts,
         util.system(cmdline, cwd=3Dtmproot)

         for copy_fn, working_fn, mtime in fns_and_mtime:
-            if os.path.getmtime(copy_fn) !=3D mtime:
+            if (not os.path.islink(copy_fn)
+                and os.path.getmtime(copy_fn) !=3D mtime):
                 ui.debug('file changed while diffing. '
                          'Overwriting: %s (src: %s)\n' % (working_fn, copy=
_fn))
                 util.copyfile(copy_fn, working_fn)

----------
messages: 10980
nosy: pmezard, timeless
priority: bug
status: unread
title: extdiff dies when it encounters dangling symlinks
topic: extdiff, symlinks

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue1909>
____________________________________________________


More information about the Mercurial-devel mailing list