##// END OF EJS Templates
extdiff: use archiver to take snapshots of committed revisions...
Matt Harbison -
r25812:68822b7c default
parent child Browse files
Show More
@@ -63,6 +63,7 b' pretty fast (at least faster than having'
63 63 from mercurial.i18n import _
64 64 from mercurial.node import short, nullid
65 65 from mercurial import cmdutil, scmutil, util, commands, encoding, filemerge
66 from mercurial import archival
66 67 import os, shlex, shutil, tempfile, re
67 68
68 69 cmdtable = {}
@@ -84,33 +85,34 b' def snapshot(ui, repo, files, node, tmpr'
84 85 dirname = '%s.%s' % (dirname, short(node))
85 86 base = os.path.join(tmproot, dirname)
86 87 os.mkdir(base)
88 fns_and_mtime = []
89
87 90 if node is not None:
88 91 ui.note(_('making snapshot of %d files from rev %s\n') %
89 92 (len(files), short(node)))
90 93 else:
91 94 ui.note(_('making snapshot of %d files from working directory\n') %
92 95 (len(files)))
93 wopener = scmutil.opener(base)
94 fns_and_mtime = []
95 ctx = repo[node]
96 for fn in sorted(files):
97 wfn = util.pconvert(fn)
98 if wfn not in ctx:
99 # File doesn't exist; could be a bogus modify
100 continue
101 ui.note(' %s\n' % wfn)
102 dest = os.path.join(base, wfn)
103 fctx = ctx[wfn]
104 data = repo.wwritedata(wfn, fctx.data())
105 if 'l' in fctx.flags():
106 wopener.symlink(data, wfn)
107 else:
108 wopener.write(wfn, data)
109 if 'x' in fctx.flags():
110 util.setflags(dest, False, True)
111 if node is None:
112 fns_and_mtime.append((dest, repo.wjoin(fn),
113 os.lstat(dest).st_mtime))
96
97 if files:
98 repo.ui.setconfig("ui", "archivemeta", False)
99
100 archival.archive(repo, base, node, 'files',
101 matchfn=scmutil.matchfiles(repo, files))
102
103 ctx = repo[node]
104 for fn in sorted(files):
105 wfn = util.pconvert(fn)
106 if wfn not in ctx:
107 # File doesn't exist; could be a bogus modify
108 continue
109 ui.note(' %s\n' % wfn)
110
111 if node is None:
112 dest = os.path.join(base, wfn)
113
114 fns_and_mtime.append((dest, repo.wjoin(fn),
115 os.lstat(dest).st_mtime))
114 116 return dirname, fns_and_mtime
115 117
116 118 def dodiff(ui, repo, cmdline, pats, opts):
@@ -20,6 +20,20 b' directory (and ".hg/largefiles/dirstate"'
20 20 $ echo 'large1 in #1' > large1
21 21 $ echo 'normal1 in #1' > normal1
22 22 $ hg commit -m '#1'
23 $ hg extdiff -r '.^' --config extensions.extdiff=
24 diff -Npru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
25 --- repo.0d9d9b8dc9a3/.hglf/large1 * (glob)
26 +++ repo/.hglf/large1 * (glob)
27 @@ -1 +1 @@
28 -4669e532d5b2c093a78eca010077e708a071bb64
29 +58e24f733a964da346e2407a2bee99d9001184f5
30 diff -Npru repo.0d9d9b8dc9a3/normal1 repo/normal1
31 --- repo.0d9d9b8dc9a3/normal1 * (glob)
32 +++ repo/normal1 * (glob)
33 @@ -1 +1 @@
34 -normal1
35 +normal1 in #1
36 [1]
23 37 $ hg update -q -C 0
24 38 $ echo 'large2 in #2' > large2
25 39 $ hg commit -m '#2'
General Comments 0
You need to be logged in to leave comments. Login now