Show More
@@ -67,7 +67,7 b' def snapshot(ui, repo, files, node, tmpr' | |||
|
67 | 67 | else: |
|
68 | 68 | ui.note(_('making snapshot of %d files from working dir\n') % |
|
69 | 69 | (len(files))) |
|
70 | ||
|
70 | wopener = util.opener(base) | |
|
71 | 71 | fns_and_mtime = [] |
|
72 | 72 | ctx = repo[node] |
|
73 | 73 | for fn in files: |
@@ -77,11 +77,14 b' def snapshot(ui, repo, files, node, tmpr' | |||
|
77 | 77 | continue |
|
78 | 78 | ui.note(' %s\n' % wfn) |
|
79 | 79 | dest = os.path.join(base, wfn) |
|
80 | destdir = os.path.dirname(dest) | |
|
81 | if not os.path.isdir(destdir): | |
|
82 | os.makedirs(destdir) | |
|
83 | data = repo.wwritedata(wfn, ctx[wfn].data()) | |
|
84 | open(dest, 'wb').write(data) | |
|
80 | fctx = ctx[wfn] | |
|
81 | data = repo.wwritedata(wfn, fctx.data()) | |
|
82 | if 'l' in fctx.flags(): | |
|
83 | wopener.symlink(data, wfn) | |
|
84 | else: | |
|
85 | wopener(wfn, 'w').write(data) | |
|
86 | if 'x' in fctx.flags(): | |
|
87 | util.set_flags(dest, False, True) | |
|
85 | 88 | if node is None: |
|
86 | 89 | fns_and_mtime.append((dest, repo.wjoin(fn), os.path.getmtime(dest))) |
|
87 | 90 | return dirname, fns_and_mtime |
@@ -28,7 +28,7 b" hg ci -d '1 0' -mtest2" | |||
|
28 | 28 | hg falabala -r 0:1 |
|
29 | 29 | |
|
30 | 30 | # test diff during merge |
|
31 | hg update 0 | |
|
31 | hg update -C 0 | |
|
32 | 32 | echo c >> c |
|
33 | 33 | hg add c |
|
34 | 34 | hg ci -m "new branch" -d '1 0' |
@@ -43,3 +43,24 b' hg falabala -c 1' | |||
|
43 | 43 | # check diff are made from the first parent |
|
44 | 44 | hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" |
|
45 | 45 | #hg log |
|
46 | ||
|
47 | echo | |
|
48 | echo '% test extdiff of multiple files in tmp dir:' | |
|
49 | hg update -C 0 > /dev/null | |
|
50 | echo changed > a | |
|
51 | echo changed > b | |
|
52 | chmod +x b | |
|
53 | echo '% diff in working directory, before' | |
|
54 | hg diff --git | |
|
55 | echo '% edit with extdiff -p' | |
|
56 | # prepare custom diff/edit tool | |
|
57 | cat > differ.sh << EOT | |
|
58 | #!/bin/sh | |
|
59 | sleep 1 # avoid unchanged-timestamp problems | |
|
60 | echo edited >> a/a | |
|
61 | echo edited >> a/b | |
|
62 | EOT | |
|
63 | chmod +x differ.sh | |
|
64 | hg extdiff -p `pwd`/differ.sh # will change to /tmp/extdiff.TMP and populate directories a.TMP and a and start tool | |
|
65 | echo '% diff in working directory, after' | |
|
66 | hg diff --git |
@@ -34,3 +34,38 b' diffing a.2a13a4d2da36/a [tmp]/test-extd' | |||
|
34 | 34 | diffing a.8a5febb7f867/a a.34eed99112ab/a |
|
35 | 35 | diffing a.2a13a4d2da36/a a.46c0e4daeb72/a |
|
36 | 36 | diff-like tools yield a non-zero exit code |
|
37 | ||
|
38 | % test extdiff of multiple files in tmp dir: | |
|
39 | % diff in working directory, before | |
|
40 | diff --git a/a b/a | |
|
41 | --- a/a | |
|
42 | +++ b/a | |
|
43 | @@ -1,1 +1,1 @@ | |
|
44 | -a | |
|
45 | +changed | |
|
46 | diff --git a/b b/b | |
|
47 | old mode 100644 | |
|
48 | new mode 100755 | |
|
49 | --- a/b | |
|
50 | +++ b/b | |
|
51 | @@ -1,1 +1,1 @@ | |
|
52 | -b | |
|
53 | +changed | |
|
54 | % edit with extdiff -p | |
|
55 | % diff in working directory, after | |
|
56 | diff --git a/a b/a | |
|
57 | --- a/a | |
|
58 | +++ b/a | |
|
59 | @@ -1,1 +1,2 @@ | |
|
60 | -a | |
|
61 | +changed | |
|
62 | +edited | |
|
63 | diff --git a/b b/b | |
|
64 | old mode 100644 | |
|
65 | new mode 100755 | |
|
66 | --- a/b | |
|
67 | +++ b/b | |
|
68 | @@ -1,1 +1,2 @@ | |
|
69 | -b | |
|
70 | +changed | |
|
71 | +edited |
General Comments 0
You need to be logged in to leave comments.
Login now