|
@@
-1,137
+1,253
b''
|
|
1
|
Test bug regarding symlinks that showed up in hg 0.7
|
|
|
|
|
2
|
Author: Matthew Elder <sseses@gmail.com>
|
|
|
|
|
3
|
|
|
|
|
|
4
|
$ "$TESTDIR/hghave" symlink || exit 80
|
|
1
|
$ "$TESTDIR/hghave" symlink || exit 80
|
|
5
|
|
|
2
|
|
|
6
|
make and initialize repo
|
|
3
|
== tests added in 0.7 ==
|
|
7
|
|
|
4
|
|
|
8
|
$ hg init test; cd test;
|
|
5
|
$ hg init test-symlinks-0.7; cd test-symlinks-0.7;
|
|
9
|
|
|
|
|
|
10
|
make a file and a symlink
|
|
|
|
|
11
|
|
|
|
|
|
12
|
$ touch foo; ln -s foo bar;
|
|
6
|
$ touch foo; ln -s foo bar;
|
|
13
|
|
|
7
|
|
|
14
|
import with addremove -- symlink walking should _not_ screwup.
|
|
8
|
import with addremove -- symlink walking should _not_ screwup.
|
|
15
|
|
|
9
|
|
|
16
|
$ hg addremove
|
|
10
|
$ hg addremove
|
|
17
|
adding bar
|
|
11
|
adding bar
|
|
18
|
adding foo
|
|
12
|
adding foo
|
|
19
|
|
|
13
|
|
|
20
|
commit -- the symlink should _not_ appear added to dir state
|
|
14
|
commit -- the symlink should _not_ appear added to dir state
|
|
21
|
|
|
15
|
|
|
22
|
$ hg commit -m 'initial'
|
|
16
|
$ hg commit -m 'initial'
|
|
23
|
|
|
17
|
|
|
24
|
add a new file so hg will let me commit again
|
|
|
|
|
25
|
|
|
|
|
|
26
|
$ touch bomb
|
|
18
|
$ touch bomb
|
|
27
|
|
|
19
|
|
|
28
|
again, symlink should _not_ show up on dir state
|
|
20
|
again, symlink should _not_ show up on dir state
|
|
29
|
|
|
21
|
|
|
30
|
$ hg addremove
|
|
22
|
$ hg addremove
|
|
31
|
adding bomb
|
|
23
|
adding bomb
|
|
32
|
|
|
24
|
|
|
33
|
Assert screamed here before, should go by without consequence
|
|
25
|
Assert screamed here before, should go by without consequence
|
|
34
|
|
|
26
|
|
|
35
|
$ hg commit -m 'is there a bug?'
|
|
27
|
$ hg commit -m 'is there a bug?'
|
|
|
|
|
28
|
$ cd ..
|
|
36
|
|
|
29
|
|
|
37
|
$ cd .. ; rm -r test
|
|
30
|
|
|
|
|
|
31
|
== fifo & ignore ==
|
|
|
|
|
32
|
|
|
38
|
$ hg init test; cd test;
|
|
33
|
$ hg init test; cd test;
|
|
39
|
|
|
34
|
|
|
40
|
$ mkdir dir
|
|
35
|
$ mkdir dir
|
|
41
|
$ touch a.c dir/a.o dir/b.o
|
|
36
|
$ touch a.c dir/a.o dir/b.o
|
|
42
|
|
|
37
|
|
|
43
|
test what happens if we want to trick hg
|
|
38
|
test what happens if we want to trick hg
|
|
44
|
|
|
39
|
|
|
45
|
$ hg commit -A -m 0
|
|
40
|
$ hg commit -A -m 0
|
|
46
|
adding a.c
|
|
41
|
adding a.c
|
|
47
|
adding dir/a.o
|
|
42
|
adding dir/a.o
|
|
48
|
adding dir/b.o
|
|
43
|
adding dir/b.o
|
|
49
|
$ echo "relglob:*.o" > .hgignore
|
|
44
|
$ echo "relglob:*.o" > .hgignore
|
|
50
|
$ rm a.c
|
|
45
|
$ rm a.c
|
|
51
|
$ rm dir/a.o
|
|
46
|
$ rm dir/a.o
|
|
52
|
$ rm dir/b.o
|
|
47
|
$ rm dir/b.o
|
|
53
|
$ mkdir dir/a.o
|
|
48
|
$ mkdir dir/a.o
|
|
54
|
$ ln -s nonexist dir/b.o
|
|
49
|
$ ln -s nonexist dir/b.o
|
|
55
|
$ mkfifo a.c
|
|
50
|
$ mkfifo a.c
|
|
56
|
|
|
51
|
|
|
57
|
it should show a.c, dir/a.o and dir/b.o deleted
|
|
52
|
it should show a.c, dir/a.o and dir/b.o deleted
|
|
58
|
|
|
53
|
|
|
59
|
$ hg status
|
|
54
|
$ hg status
|
|
60
|
M dir/b.o
|
|
55
|
M dir/b.o
|
|
61
|
! a.c
|
|
56
|
! a.c
|
|
62
|
! dir/a.o
|
|
57
|
! dir/a.o
|
|
63
|
? .hgignore
|
|
58
|
? .hgignore
|
|
64
|
$ hg status a.c
|
|
59
|
$ hg status a.c
|
|
65
|
a.c: unsupported file type (type is fifo)
|
|
60
|
a.c: unsupported file type (type is fifo)
|
|
66
|
! a.c
|
|
61
|
! a.c
|
|
|
|
|
62
|
$ cd ..
|
|
|
|
|
63
|
|
|
|
|
|
64
|
|
|
|
|
|
65
|
== symlinks from outside the tree ==
|
|
67
|
|
|
66
|
|
|
68
|
test absolute path through symlink outside repo
|
|
67
|
test absolute path through symlink outside repo
|
|
69
|
|
|
68
|
|
|
70
|
$ cd ..
|
|
|
|
|
71
|
$ p=`pwd`
|
|
69
|
$ p=`pwd`
|
|
72
|
$ hg init x
|
|
70
|
$ hg init x
|
|
73
|
$ ln -s x y
|
|
71
|
$ ln -s x y
|
|
74
|
$ cd x
|
|
72
|
$ cd x
|
|
75
|
$ touch f
|
|
73
|
$ touch f
|
|
76
|
$ hg add f
|
|
74
|
$ hg add f
|
|
77
|
$ hg status "$p"/y/f
|
|
75
|
$ hg status "$p"/y/f
|
|
78
|
A f
|
|
76
|
A f
|
|
79
|
|
|
77
|
|
|
80
|
try symlink outside repo to file inside
|
|
78
|
try symlink outside repo to file inside
|
|
81
|
|
|
79
|
|
|
82
|
$ ln -s x/f ../z
|
|
80
|
$ ln -s x/f ../z
|
|
83
|
|
|
81
|
|
|
84
|
this should fail
|
|
82
|
this should fail
|
|
85
|
|
|
83
|
|
|
86
|
$ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || :
|
|
84
|
$ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || :
|
|
87
|
abort: ../z not under root
|
|
85
|
abort: ../z not under root
|
|
|
|
|
86
|
$ cd ..
|
|
88
|
|
|
87
|
|
|
89
|
$ cd .. ; rm -r test
|
|
88
|
|
|
90
|
$ hg init test; cd test;
|
|
89
|
== cloning symlinks ==
|
|
|
|
|
90
|
$ hg init clone; cd clone;
|
|
91
|
|
|
91
|
|
|
92
|
try cloning symlink in a subdir
|
|
92
|
try cloning symlink in a subdir
|
|
93
|
1. commit a symlink
|
|
93
|
1. commit a symlink
|
|
94
|
|
|
94
|
|
|
95
|
$ mkdir -p a/b/c
|
|
95
|
$ mkdir -p a/b/c
|
|
96
|
$ cd a/b/c
|
|
96
|
$ cd a/b/c
|
|
97
|
$ ln -s /path/to/symlink/source demo
|
|
97
|
$ ln -s /path/to/symlink/source demo
|
|
98
|
$ cd ../../..
|
|
98
|
$ cd ../../..
|
|
99
|
$ hg stat
|
|
99
|
$ hg stat
|
|
100
|
? a/b/c/demo
|
|
100
|
? a/b/c/demo
|
|
101
|
$ hg commit -A -m 'add symlink in a/b/c subdir'
|
|
101
|
$ hg commit -A -m 'add symlink in a/b/c subdir'
|
|
102
|
adding a/b/c/demo
|
|
102
|
adding a/b/c/demo
|
|
103
|
|
|
103
|
|
|
104
|
2. clone it
|
|
104
|
2. clone it
|
|
105
|
|
|
105
|
|
|
106
|
$ cd ..
|
|
106
|
$ cd ..
|
|
107
|
$ hg clone test testclone
|
|
107
|
$ hg clone clone clonedest
|
|
108
|
updating to branch default
|
|
108
|
updating to branch default
|
|
109
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
109
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
110
|
|
|
110
|
|
|
|
|
|
111
|
|
|
|
|
|
112
|
== symlink and git diffs ==
|
|
|
|
|
113
|
|
|
111
|
git symlink diff
|
|
114
|
git symlink diff
|
|
112
|
|
|
115
|
|
|
113
|
$ cd testclone
|
|
116
|
$ cd clonedest
|
|
114
|
$ hg diff --git -r null:tip
|
|
117
|
$ hg diff --git -r null:tip
|
|
115
|
diff --git a/a/b/c/demo b/a/b/c/demo
|
|
118
|
diff --git a/a/b/c/demo b/a/b/c/demo
|
|
116
|
new file mode 120000
|
|
119
|
new file mode 120000
|
|
117
|
--- /dev/null
|
|
120
|
--- /dev/null
|
|
118
|
+++ b/a/b/c/demo
|
|
121
|
+++ b/a/b/c/demo
|
|
119
|
@@ -0,0 +1,1 @@
|
|
122
|
@@ -0,0 +1,1 @@
|
|
120
|
+/path/to/symlink/source
|
|
123
|
+/path/to/symlink/source
|
|
121
|
\ No newline at end of file
|
|
124
|
\ No newline at end of file
|
|
122
|
$ hg export --git tip > ../sl.diff
|
|
125
|
$ hg export --git tip > ../sl.diff
|
|
123
|
|
|
126
|
|
|
124
|
import git symlink diff
|
|
127
|
import git symlink diff
|
|
125
|
|
|
128
|
|
|
126
|
$ hg rm a/b/c/demo
|
|
129
|
$ hg rm a/b/c/demo
|
|
127
|
$ hg commit -m'remove link'
|
|
130
|
$ hg commit -m'remove link'
|
|
128
|
$ hg import ../sl.diff
|
|
131
|
$ hg import ../sl.diff
|
|
129
|
applying ../sl.diff
|
|
132
|
applying ../sl.diff
|
|
130
|
$ hg diff --git -r 1:tip
|
|
133
|
$ hg diff --git -r 1:tip
|
|
131
|
diff --git a/a/b/c/demo b/a/b/c/demo
|
|
134
|
diff --git a/a/b/c/demo b/a/b/c/demo
|
|
132
|
new file mode 120000
|
|
135
|
new file mode 120000
|
|
133
|
--- /dev/null
|
|
136
|
--- /dev/null
|
|
134
|
+++ b/a/b/c/demo
|
|
137
|
+++ b/a/b/c/demo
|
|
135
|
@@ -0,0 +1,1 @@
|
|
138
|
@@ -0,0 +1,1 @@
|
|
136
|
+/path/to/symlink/source
|
|
139
|
+/path/to/symlink/source
|
|
137
|
\ No newline at end of file
|
|
140
|
\ No newline at end of file
|
|
|
|
|
141
|
|
|
|
|
|
142
|
== symlinks and addremove ==
|
|
|
|
|
143
|
|
|
|
|
|
144
|
directory moved and symlinked
|
|
|
|
|
145
|
|
|
|
|
|
146
|
$ mkdir foo
|
|
|
|
|
147
|
$ touch foo/a
|
|
|
|
|
148
|
$ hg ci -Ama
|
|
|
|
|
149
|
adding foo/a
|
|
|
|
|
150
|
$ mv foo bar
|
|
|
|
|
151
|
$ ln -s bar foo
|
|
|
|
|
152
|
|
|
|
|
|
153
|
now addremove should remove old files
|
|
|
|
|
154
|
|
|
|
|
|
155
|
$ hg addremove
|
|
|
|
|
156
|
adding bar/a
|
|
|
|
|
157
|
adding foo
|
|
|
|
|
158
|
removing foo/a
|
|
|
|
|
159
|
$ cd ..
|
|
|
|
|
160
|
|
|
|
|
|
161
|
== root of repository is symlinked ==
|
|
|
|
|
162
|
|
|
|
|
|
163
|
$ hg init root
|
|
|
|
|
164
|
$ ln -s root link
|
|
|
|
|
165
|
$ cd root
|
|
|
|
|
166
|
$ echo foo > foo
|
|
|
|
|
167
|
$ hg status
|
|
|
|
|
168
|
? foo
|
|
|
|
|
169
|
$ hg status ../link
|
|
|
|
|
170
|
? foo
|
|
|
|
|
171
|
$ cd ..
|
|
|
|
|
172
|
|
|
|
|
|
173
|
|
|
|
|
|
174
|
|
|
|
|
|
175
|
|
|
|
|
|
176
|
$ hg init b
|
|
|
|
|
177
|
$ cd b
|
|
|
|
|
178
|
$ ln -s nothing dangling
|
|
|
|
|
179
|
$ hg commit -m 'commit symlink without adding' dangling
|
|
|
|
|
180
|
abort: dangling: file not tracked!
|
|
|
|
|
181
|
$ hg add dangling
|
|
|
|
|
182
|
$ hg commit -m 'add symlink'
|
|
|
|
|
183
|
|
|
|
|
|
184
|
$ hg tip -v
|
|
|
|
|
185
|
changeset: 0:cabd88b706fc
|
|
|
|
|
186
|
tag: tip
|
|
|
|
|
187
|
user: test
|
|
|
|
|
188
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
|
189
|
files: dangling
|
|
|
|
|
190
|
description:
|
|
|
|
|
191
|
add symlink
|
|
|
|
|
192
|
|
|
|
|
|
193
|
|
|
|
|
|
194
|
$ hg manifest --debug
|
|
|
|
|
195
|
2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling
|
|
|
|
|
196
|
$ $TESTDIR/readlink.py dangling
|
|
|
|
|
197
|
dangling -> nothing
|
|
|
|
|
198
|
|
|
|
|
|
199
|
$ rm dangling
|
|
|
|
|
200
|
$ ln -s void dangling
|
|
|
|
|
201
|
$ hg commit -m 'change symlink'
|
|
|
|
|
202
|
$ $TESTDIR/readlink.py dangling
|
|
|
|
|
203
|
dangling -> void
|
|
|
|
|
204
|
|
|
|
|
|
205
|
|
|
|
|
|
206
|
modifying link
|
|
|
|
|
207
|
|
|
|
|
|
208
|
$ rm dangling
|
|
|
|
|
209
|
$ ln -s empty dangling
|
|
|
|
|
210
|
$ $TESTDIR/readlink.py dangling
|
|
|
|
|
211
|
dangling -> empty
|
|
|
|
|
212
|
|
|
|
|
|
213
|
|
|
|
|
|
214
|
reverting to rev 0:
|
|
|
|
|
215
|
|
|
|
|
|
216
|
$ hg revert -r 0 -a
|
|
|
|
|
217
|
reverting dangling
|
|
|
|
|
218
|
$ $TESTDIR/readlink.py dangling
|
|
|
|
|
219
|
dangling -> nothing
|
|
|
|
|
220
|
|
|
|
|
|
221
|
|
|
|
|
|
222
|
backups:
|
|
|
|
|
223
|
|
|
|
|
|
224
|
$ $TESTDIR/readlink.py *.orig
|
|
|
|
|
225
|
dangling.orig -> empty
|
|
|
|
|
226
|
$ rm *.orig
|
|
|
|
|
227
|
$ hg up -C
|
|
|
|
|
228
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
229
|
|
|
|
|
|
230
|
copies
|
|
|
|
|
231
|
|
|
|
|
|
232
|
$ hg cp -v dangling dangling2
|
|
|
|
|
233
|
copying dangling to dangling2
|
|
|
|
|
234
|
$ hg st -Cmard
|
|
|
|
|
235
|
A dangling2
|
|
|
|
|
236
|
dangling
|
|
|
|
|
237
|
$ $TESTDIR/readlink.py dangling dangling2
|
|
|
|
|
238
|
dangling -> void
|
|
|
|
|
239
|
dangling2 -> void
|
|
|
|
|
240
|
|
|
|
|
|
241
|
|
|
|
|
|
242
|
issue995
|
|
|
|
|
243
|
|
|
|
|
|
244
|
$ hg up -C
|
|
|
|
|
245
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
246
|
$ mkdir dir
|
|
|
|
|
247
|
$ ln -s dir dirlink
|
|
|
|
|
248
|
$ hg ci -qAm 'add dirlink'
|
|
|
|
|
249
|
$ mkdir newdir
|
|
|
|
|
250
|
$ mv dir newdir/dir
|
|
|
|
|
251
|
$ mv dirlink newdir/dirlink
|
|
|
|
|
252
|
$ hg mv -A dirlink newdir/dirlink
|
|
|
|
|
253
|
|