--- a/hgext/extdiff.py Mon Apr 13 21:21:01 2009 +0200
+++ b/hgext/extdiff.py Thu Apr 09 14:32:44 2009 +0200
@@ -67,7 +67,7 @@
else:
ui.note(_('making snapshot of %d files from working dir\n') %
(len(files)))
-
+ wopener = util.opener(base)
fns_and_mtime = []
ctx = repo[node]
for fn in files:
@@ -77,11 +77,14 @@
continue
ui.note(' %s\n' % wfn)
dest = os.path.join(base, wfn)
- destdir = os.path.dirname(dest)
- if not os.path.isdir(destdir):
- os.makedirs(destdir)
- data = repo.wwritedata(wfn, ctx[wfn].data())
- open(dest, 'wb').write(data)
+ fctx = ctx[wfn]
+ data = repo.wwritedata(wfn, fctx.data())
+ if 'l' in fctx.flags():
+ wopener.symlink(data, wfn)
+ else:
+ wopener(wfn, 'w').write(data)
+ 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)))
return dirname, fns_and_mtime