##// END OF EJS Templates
tests: add a test demonstrating issue5731...
Mark Thomas -
r35007:ad671b4c stable
parent child Browse files
Show More
@@ -1,125 +1,143 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
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 $ hg add b/c
19 $ echo d1 > d
20 $ hg add b/c d
20 $ hg commit -m "c1"
21 $ hg commit -m "c1"
21 $ hg bookmark c1
22 $ hg bookmark c1
22
23
23 Peform an update that causes b/c to be backed up
24 Peform an update that causes b/c to be backed up
24
25
25 $ hg up -q 0
26 $ hg up -q 0
26 $ mkdir -p b
27 $ mkdir -p b
27 $ echo c2 > b/c
28 $ echo c2 > b/c
28 $ hg up --verbose c1
29 $ hg up --verbose c1
29 resolving manifests
30 resolving manifests
30 b/c: replacing untracked file
31 b/c: replacing untracked file
31 getting b/c
32 getting b/c
32 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
33 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 getting d
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 (activating bookmark c1)
36 (activating bookmark c1)
35 $ test -f .hg/origbackups/b/c
37 $ test -f .hg/origbackups/b/c
36
38
37 Make a file named b
39 Make files named b and d
38
40
39 $ hg up -q 0
41 $ hg up -q 0
40 $ echo b1 > b
42 $ echo b1 > b
41 $ hg add b
43 $ echo d2 > d
44 $ hg add b d
42 $ hg commit -m b1
45 $ hg commit -m b1
43 created new head
46 created new head
44 $ hg bookmark b1
47 $ hg bookmark b1
45
48
46 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
47
50
48 $ hg up -q 0
51 $ hg up -q 0
49 $ echo b2 > b
52 $ echo b2 > b
50 $ hg up --verbose b1
53 $ hg up --verbose b1
51 resolving manifests
54 resolving manifests
52 b: replacing untracked file
55 b: replacing untracked file
53 getting b
56 getting b
54 removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob)
57 removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob)
55 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 getting d
59 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 (activating bookmark b1)
60 (activating bookmark b1)
57 $ test -f .hg/origbackups/b
61 $ test -f .hg/origbackups/b
58
62
59 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
60
64
61 $ hg up -q 0
65 $ hg up -q 0
62 $ mkdir b
66 $ mkdir b
63 $ echo c3 > b/c
67 $ echo c3 > b/c
64 $ hg up --verbose c1
68 $ hg up --verbose c1
65 resolving manifests
69 resolving manifests
66 b/c: replacing untracked file
70 b/c: replacing untracked file
67 getting b/c
71 getting b/c
68 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
72 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
69 removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
73 removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
70 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 getting d
75 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 (activating bookmark c1)
76 (activating bookmark c1)
72 $ test -d .hg/origbackups/b
77 $ test -d .hg/origbackups/b
73
78
74 Cause a symlink 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
75
80
76 $ hg up -q 0
81 $ hg up -q 0
77 $ mkdir ../sym-link-target
82 $ mkdir ../sym-link-target
78 #if symlink
83 #if symlink
79 $ ln -s ../../../sym-link-target b
84 $ ln -s ../../../sym-link-target b
85 $ ln -s ../../../sym-link-target d
80 #else
86 #else
81 $ touch b
87 $ touch b d
82 #endif
88 #endif
83 $ hg up b1
89 $ hg up b1
84 b: replacing untracked file
90 b: replacing untracked file
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 d: replacing untracked file
92 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 (activating bookmark b1)
93 (activating bookmark b1)
87 #if symlink
94 #if symlink
88 $ readlink.py .hg/origbackups/b
95 $ readlink.py .hg/origbackups/b
89 .hg/origbackups/b -> ../../../sym-link-target
96 .hg/origbackups/b -> ../../../sym-link-target
90 #endif
97 #endif
91
98
92 Perform an update that causes b/c to be backed up again - it 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
93
100
94 $ hg up -q 0
101 $ hg up -q 0
95 $ mkdir b
102 $ mkdir b
96 $ echo c4 > b/c
103 $ echo c4 > b/c
104 $ echo d3 > d
97 $ hg up --verbose c1
105 $ hg up --verbose c1
98 resolving manifests
106 resolving manifests
99 b/c: replacing untracked file
107 b/c: replacing untracked file
108 d: replacing untracked file
100 getting b/c
109 getting b/c
101 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
110 creating directory: $TESTTMP/repo/.hg/origbackups/b (glob)
102 removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
111 removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob)
103 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 getting d
113 removing conflicting directory: $TESTTMP/repo/.hg/origbackups/d (glob)
114 abort: None
115 [255]
116
117 Workaround issue by deleting d:
118
119 $ rm d
120 $ hg up c1
121 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
104 (activating bookmark c1)
122 (activating bookmark c1)
105 $ cat .hg/origbackups/b/c
123 $ cat .hg/origbackups/b/c
106 c4
124 c4
107 $ ls ../sym-link-target
125 $ ls ../sym-link-target
108
126
109 Incorrectly configure origbackuppath to be under a file
127 Incorrectly configure origbackuppath to be under a file
110
128
111 $ echo data > .hg/badorigbackups
129 $ echo data > .hg/badorigbackups
112 $ hg up -q 0
130 $ hg up -q 0
113 $ mkdir b
131 $ mkdir b
114 $ echo c5 > b/c
132 $ echo c5 > b/c
115 $ hg up --verbose c1 --config ui.origbackuppath=.hg/badorigbackups
133 $ hg up --verbose c1 --config ui.origbackuppath=.hg/badorigbackups
116 resolving manifests
134 resolving manifests
117 b/c: replacing untracked file
135 b/c: replacing untracked file
118 getting b/c
136 getting b/c
119 creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob)
137 creating directory: $TESTTMP/repo/.hg/badorigbackups/b (glob)
120 abort: The system cannot find the path specified: '$TESTTMP/repo/.hg/badorigbackups/b' (glob) (windows !)
138 abort: The system cannot find the path specified: '$TESTTMP/repo/.hg/badorigbackups/b' (glob) (windows !)
121 abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !)
139 abort: Not a directory: '$TESTTMP/repo/.hg/badorigbackups/b' (no-windows !)
122 [255]
140 [255]
123 $ cat .hg/badorigbackups
141 $ cat .hg/badorigbackups
124 data
142 data
125
143
General Comments 0
You need to be logged in to leave comments. Login now