Show More
@@ -1,53 +1,60 b'' | |||||
1 | # common patterns in test at can safely be replaced |
|
1 | # common patterns in test at can safely be replaced | |
2 | from __future__ import absolute_import |
|
2 | from __future__ import absolute_import | |
3 |
|
3 | |||
4 | substitutions = [ |
|
4 | substitutions = [ | |
5 | # list of possible compressions |
|
5 | # list of possible compressions | |
6 | (br'zstd,zlib,none,bzip2', |
|
6 | (br'zstd,zlib,none,bzip2', | |
7 | br'$USUAL_COMPRESSIONS$' |
|
7 | br'$USUAL_COMPRESSIONS$' | |
8 | ), |
|
8 | ), | |
9 | # capabilities sent through http |
|
9 | # capabilities sent through http | |
10 | (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A' |
|
10 | (br'bundlecaps=HG20%2Cbundle2%3DHG20%250A' | |
11 | br'changegroup%253D01%252C02%250A' |
|
11 | br'changegroup%253D01%252C02%250A' | |
12 | br'digests%253Dmd5%252Csha1%252Csha512%250A' |
|
12 | br'digests%253Dmd5%252Csha1%252Csha512%250A' | |
13 | br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A' |
|
13 | br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A' | |
14 | br'hgtagsfnodes%250A' |
|
14 | br'hgtagsfnodes%250A' | |
15 | br'listkeys%250A' |
|
15 | br'listkeys%250A' | |
16 | br'phases%253Dheads%250A' |
|
16 | br'phases%253Dheads%250A' | |
17 | br'pushkey%250A' |
|
17 | br'pushkey%250A' | |
18 | br'remote-changegroup%253Dhttp%252Chttps', |
|
18 | br'remote-changegroup%253Dhttp%252Chttps', | |
19 | # (the replacement patterns) |
|
19 | # (the replacement patterns) | |
20 | br'$USUAL_BUNDLE_CAPS$' |
|
20 | br'$USUAL_BUNDLE_CAPS$' | |
21 | ), |
|
21 | ), | |
22 | # bundle2 capabilities sent through ssh |
|
22 | # bundle2 capabilities sent through ssh | |
23 | (br'bundle2=HG20%0A' |
|
23 | (br'bundle2=HG20%0A' | |
24 | br'changegroup%3D01%2C02%0A' |
|
24 | br'changegroup%3D01%2C02%0A' | |
25 | br'digests%3Dmd5%2Csha1%2Csha512%0A' |
|
25 | br'digests%3Dmd5%2Csha1%2Csha512%0A' | |
26 | br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A' |
|
26 | br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A' | |
27 | br'hgtagsfnodes%0A' |
|
27 | br'hgtagsfnodes%0A' | |
28 | br'listkeys%0A' |
|
28 | br'listkeys%0A' | |
29 | br'phases%3Dheads%0A' |
|
29 | br'phases%3Dheads%0A' | |
30 | br'pushkey%0A' |
|
30 | br'pushkey%0A' | |
31 | br'remote-changegroup%3Dhttp%2Chttps', |
|
31 | br'remote-changegroup%3Dhttp%2Chttps', | |
32 | # (replacement patterns) |
|
32 | # (replacement patterns) | |
33 | br'$USUAL_BUNDLE2_CAPS$' |
|
33 | br'$USUAL_BUNDLE2_CAPS$' | |
34 | ), |
|
34 | ), | |
35 | # HTTP log dates |
|
35 | # HTTP log dates | |
36 | (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET', |
|
36 | (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET', | |
37 | br' - - [$LOGDATE$] "GET' |
|
37 | br' - - [$LOGDATE$] "GET' | |
38 | ), |
|
38 | ), | |
39 | ] |
|
39 | ] | |
40 |
|
40 | |||
41 | # Various platform error strings, keyed on a common replacement string |
|
41 | # Various platform error strings, keyed on a common replacement string | |
42 | _errors = { |
|
42 | _errors = { | |
43 | br'$ENOENT$': ( |
|
43 | br'$ENOENT$': ( | |
44 | # strerror() |
|
44 | # strerror() | |
45 | br'No such file or directory', |
|
45 | br'No such file or directory', | |
46 |
|
46 | |||
47 | # FormatMessage(ERROR_FILE_NOT_FOUND) |
|
47 | # FormatMessage(ERROR_FILE_NOT_FOUND) | |
48 | br'The system cannot find the file specified', |
|
48 | br'The system cannot find the file specified', | |
49 | ), |
|
49 | ), | |
|
50 | br'$ENOTDIR$': ( | |||
|
51 | # strerror() | |||
|
52 | br'Not a directory', | |||
|
53 | ||||
|
54 | # FormatMessage(ERROR_PATH_NOT_FOUND) | |||
|
55 | br'The system cannot find the path specified', | |||
|
56 | ), | |||
50 | } |
|
57 | } | |
51 |
|
58 | |||
52 | for replace, msgs in _errors.items(): |
|
59 | for replace, msgs in _errors.items(): | |
53 | substitutions.extend((m, replace) for m in msgs) |
|
60 | substitutions.extend((m, replace) for m in msgs) |
@@ -1,137 +1,136 b'' | |||||
1 | Set up repo |
|
1 | Set up repo | |
2 |
|
2 | |||
3 | $ cat << EOF >> $HGRCPATH |
|
3 | $ cat << EOF >> $HGRCPATH | |
4 | > [ui] |
|
4 | > [ui] | |
5 | > origbackuppath=.hg/origbackups |
|
5 | > origbackuppath=.hg/origbackups | |
6 | > [merge] |
|
6 | > [merge] | |
7 | > checkunknown=warn |
|
7 | > checkunknown=warn | |
8 | > EOF |
|
8 | > EOF | |
9 | $ hg init repo |
|
9 | $ hg init repo | |
10 | $ cd repo |
|
10 | $ cd repo | |
11 | $ echo base > base |
|
11 | $ echo base > base | |
12 | $ hg add base |
|
12 | $ hg add base | |
13 | $ hg commit -m "base" |
|
13 | $ hg commit -m "base" | |
14 |
|
14 | |||
15 | Make a dir named b that contains a file, and a file named d |
|
15 | Make a dir named b that contains a file, and a file named d | |
16 |
|
16 | |||
17 | $ mkdir -p b |
|
17 | $ mkdir -p b | |
18 | $ echo c1 > b/c |
|
18 | $ echo c1 > b/c | |
19 | $ echo d1 > d |
|
19 | $ echo d1 > d | |
20 | $ hg add b/c d |
|
20 | $ hg add b/c d | |
21 | $ hg commit -m "c1" |
|
21 | $ hg commit -m "c1" | |
22 | $ hg bookmark c1 |
|
22 | $ hg bookmark c1 | |
23 |
|
23 | |||
24 | Peform an update that causes b/c to be backed up |
|
24 | Peform an update that causes b/c to be backed up | |
25 |
|
25 | |||
26 | $ hg up -q 0 |
|
26 | $ hg up -q 0 | |
27 | $ mkdir -p b |
|
27 | $ mkdir -p b | |
28 | $ echo c2 > b/c |
|
28 | $ echo c2 > b/c | |
29 | $ hg up --verbose c1 |
|
29 | $ hg up --verbose c1 | |
30 | resolving manifests |
|
30 | resolving manifests | |
31 | b/c: replacing untracked file |
|
31 | b/c: replacing untracked file | |
32 | getting b/c |
|
32 | getting b/c | |
33 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
33 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) | |
34 | getting d |
|
34 | getting d | |
35 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
35 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
36 | (activating bookmark c1) |
|
36 | (activating bookmark c1) | |
37 | $ test -f .hg/origbackups/b/c |
|
37 | $ test -f .hg/origbackups/b/c | |
38 |
|
38 | |||
39 | Make files named b and d |
|
39 | Make files named b and d | |
40 |
|
40 | |||
41 | $ hg up -q 0 |
|
41 | $ hg up -q 0 | |
42 | $ echo b1 > b |
|
42 | $ echo b1 > b | |
43 | $ echo d2 > d |
|
43 | $ echo d2 > d | |
44 | $ hg add b d |
|
44 | $ hg add b d | |
45 | $ hg commit -m b1 |
|
45 | $ hg commit -m b1 | |
46 | created new head |
|
46 | created new head | |
47 | $ hg bookmark b1 |
|
47 | $ hg bookmark b1 | |
48 |
|
48 | |||
49 | Perform an update that causes b to be backed up - it should replace the backup b dir |
|
49 | Perform an update that causes b to be backed up - it should replace the backup b dir | |
50 |
|
50 | |||
51 | $ hg up -q 0 |
|
51 | $ hg up -q 0 | |
52 | $ echo b2 > b |
|
52 | $ echo b2 > b | |
53 | $ hg up --verbose b1 |
|
53 | $ hg up --verbose b1 | |
54 | resolving manifests |
|
54 | resolving manifests | |
55 | b: replacing untracked file |
|
55 | b: replacing untracked file | |
56 | getting b |
|
56 | getting b | |
57 | removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
57 | removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob) | |
58 | getting d |
|
58 | getting d | |
59 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
59 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
60 | (activating bookmark b1) |
|
60 | (activating bookmark b1) | |
61 | $ test -f .hg/origbackups/b |
|
61 | $ test -f .hg/origbackups/b | |
62 |
|
62 | |||
63 | Perform an update the causes b/c to be backed up again - it should replace the backup b file |
|
63 | Perform an update the causes b/c to be backed up again - it should replace the backup b file | |
64 |
|
64 | |||
65 | $ hg up -q 0 |
|
65 | $ hg up -q 0 | |
66 | $ mkdir b |
|
66 | $ mkdir b | |
67 | $ echo c3 > b/c |
|
67 | $ echo c3 > b/c | |
68 | $ hg up --verbose c1 |
|
68 | $ hg up --verbose c1 | |
69 | resolving manifests |
|
69 | resolving manifests | |
70 | b/c: replacing untracked file |
|
70 | b/c: replacing untracked file | |
71 | getting b/c |
|
71 | getting b/c | |
72 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
72 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) | |
73 | removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
73 | removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) | |
74 | getting d |
|
74 | getting d | |
75 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 | (activating bookmark c1) |
|
76 | (activating bookmark c1) | |
77 | $ test -d .hg/origbackups/b |
|
77 | $ test -d .hg/origbackups/b | |
78 |
|
78 | |||
79 | Cause two symlinks to be backed up that points to a valid location from the backup dir |
|
79 | Cause two symlinks to be backed up that points to a valid location from the backup dir | |
80 |
|
80 | |||
81 | $ hg up -q 0 |
|
81 | $ hg up -q 0 | |
82 | $ mkdir ../sym-link-target |
|
82 | $ mkdir ../sym-link-target | |
83 | #if symlink |
|
83 | #if symlink | |
84 | $ ln -s ../../../sym-link-target b |
|
84 | $ ln -s ../../../sym-link-target b | |
85 | $ ln -s ../../../sym-link-target d |
|
85 | $ ln -s ../../../sym-link-target d | |
86 | #else |
|
86 | #else | |
87 | $ touch b d |
|
87 | $ touch b d | |
88 | #endif |
|
88 | #endif | |
89 | $ hg up b1 |
|
89 | $ hg up b1 | |
90 | b: replacing untracked file |
|
90 | b: replacing untracked file | |
91 | d: replacing untracked file |
|
91 | d: replacing untracked file | |
92 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
92 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
93 | (activating bookmark b1) |
|
93 | (activating bookmark b1) | |
94 | #if symlink |
|
94 | #if symlink | |
95 | $ readlink.py .hg/origbackups/b |
|
95 | $ readlink.py .hg/origbackups/b | |
96 | .hg/origbackups/b -> ../../../sym-link-target |
|
96 | .hg/origbackups/b -> ../../../sym-link-target | |
97 | #endif |
|
97 | #endif | |
98 |
|
98 | |||
99 | Perform an update that causes b/c and d to be backed up again - b/c should not go into the target dir |
|
99 | Perform an update that causes b/c and d to be backed up again - b/c should not go into the target dir | |
100 |
|
100 | |||
101 | $ hg up -q 0 |
|
101 | $ hg up -q 0 | |
102 | $ mkdir b |
|
102 | $ mkdir b | |
103 | $ echo c4 > b/c |
|
103 | $ echo c4 > b/c | |
104 | $ echo d3 > d |
|
104 | $ echo d3 > d | |
105 | $ hg up --verbose c1 |
|
105 | $ hg up --verbose c1 | |
106 | resolving manifests |
|
106 | resolving manifests | |
107 | b/c: replacing untracked file |
|
107 | b/c: replacing untracked file | |
108 | d: replacing untracked file |
|
108 | d: replacing untracked file | |
109 | getting b/c |
|
109 | getting b/c | |
110 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
110 | creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) | |
111 | removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) |
|
111 | removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) | |
112 | getting d |
|
112 | getting d | |
113 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
113 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
114 | (activating bookmark c1) |
|
114 | (activating bookmark c1) | |
115 | $ cat .hg/origbackups/b/c |
|
115 | $ cat .hg/origbackups/b/c | |
116 | c4 |
|
116 | c4 | |
117 | $ cat .hg/origbackups/d |
|
117 | $ cat .hg/origbackups/d | |
118 | d3 |
|
118 | d3 | |
119 | $ ls ../sym-link-target |
|
119 | $ ls ../sym-link-target | |
120 |
|
120 | |||
121 | Incorrectly configure origbackuppath to be under a file |
|
121 | Incorrectly configure origbackuppath to be under a file | |
122 |
|
122 | |||
123 | $ echo data > .hg/badorigbackups |
|
123 | $ echo data > .hg/badorigbackups | |
124 | $ hg up -q 0 |
|
124 | $ hg up -q 0 | |
125 | $ mkdir b |
|
125 | $ mkdir b | |
126 | $ echo c5 > b/c |
|
126 | $ echo c5 > b/c | |
127 | $ hg up --verbose c1 --config ui.origbackuppath=.hg/badorigbackups |
|
127 | $ hg up --verbose c1 --config ui.origbackuppath=.hg/badorigbackups | |
128 | resolving manifests |
|
128 | resolving manifests | |
129 | b/c: replacing untracked file |
|
129 | b/c: replacing untracked file | |
130 | getting b/c |
|
130 | getting b/c | |
131 | creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob) |
|
131 | creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob) | |
132 |
abort: |
|
132 | abort: $ENOTDIR$: '$TESTTMP/repo/.hg/badorigbackups/b' (glob) | |
133 | abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !) |
|
|||
134 | [255] |
|
133 | [255] | |
135 | $ cat .hg/badorigbackups |
|
134 | $ cat .hg/badorigbackups | |
136 | data |
|
135 | data | |
137 |
|
136 |
General Comments 0
You need to be logged in to leave comments.
Login now