##// END OF EJS Templates
tests: use 'hghave symlink' for tests using symlinks
Mads Kiilerich -
r15441:e0348815 default
parent child Browse files
Show More
@@ -1,309 +1,309
1 1 #!/usr/bin/env python
2 2 """Test the running system for features availability. Exit with zero
3 3 if all features are there, non-zero otherwise. If a feature name is
4 4 prefixed with "no-", the absence of feature is tested.
5 5 """
6 6 import optparse
7 7 import os
8 8 import re
9 9 import sys
10 10 import tempfile
11 11
12 12 tempprefix = 'hg-hghave-'
13 13
14 14 def matchoutput(cmd, regexp, ignorestatus=False):
15 15 """Return True if cmd executes successfully and its output
16 16 is matched by the supplied regular expression.
17 17 """
18 18 r = re.compile(regexp)
19 19 fh = os.popen(cmd)
20 20 s = fh.read()
21 21 try:
22 22 ret = fh.close()
23 23 except IOError:
24 24 # Happen in Windows test environment
25 25 ret = 1
26 26 return (ignorestatus or ret is None) and r.search(s)
27 27
28 28 def has_baz():
29 29 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
30 30
31 31 def has_bzr():
32 32 try:
33 33 import bzrlib
34 34 return bzrlib.__doc__ != None
35 35 except ImportError:
36 36 return False
37 37
38 38 def has_bzr114():
39 39 try:
40 40 import bzrlib
41 41 return (bzrlib.__doc__ != None
42 42 and bzrlib.version_info[:2] >= (1, 14))
43 43 except ImportError:
44 44 return False
45 45
46 46 def has_cvs():
47 47 re = r'Concurrent Versions System.*?server'
48 48 return matchoutput('cvs --version 2>&1', re)
49 49
50 50 def has_darcs():
51 51 return matchoutput('darcs --version', r'2\.[2-9]', True)
52 52
53 53 def has_mtn():
54 54 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
55 55 'mtn --version', r'monotone 0\.', True)
56 56
57 57 def has_eol_in_paths():
58 58 try:
59 59 fd, path = tempfile.mkstemp(prefix=tempprefix, suffix='\n\r')
60 60 os.close(fd)
61 61 os.remove(path)
62 62 return True
63 63 except:
64 64 return False
65 65
66 66 def has_executablebit():
67 67 fd, path = tempfile.mkstemp(prefix=tempprefix)
68 68 os.close(fd)
69 69 try:
70 70 s = os.lstat(path).st_mode
71 71 os.chmod(path, s | 0100)
72 72 return (os.lstat(path).st_mode & 0100 != 0)
73 73 finally:
74 74 os.remove(path)
75 75
76 76 def has_icasefs():
77 77 # Stolen from mercurial.util
78 78 fd, path = tempfile.mkstemp(prefix=tempprefix, dir='.')
79 79 os.close(fd)
80 80 try:
81 81 s1 = os.stat(path)
82 82 d, b = os.path.split(path)
83 83 p2 = os.path.join(d, b.upper())
84 84 if path == p2:
85 85 p2 = os.path.join(d, b.lower())
86 86 try:
87 87 s2 = os.stat(p2)
88 88 return s2 == s1
89 89 except:
90 90 return False
91 91 finally:
92 92 os.remove(path)
93 93
94 94 def has_inotify():
95 95 try:
96 96 import hgext.inotify.linux.watcher
97 97 return True
98 98 except ImportError:
99 99 return False
100 100
101 101 def has_fifo():
102 102 return hasattr(os, "mkfifo")
103 103
104 104 def has_cacheable_fs():
105 105 from mercurial import util
106 106
107 107 fd, path = tempfile.mkstemp(prefix=tempprefix)
108 108 os.close(fd)
109 109 try:
110 110 return util.cachestat(path).cacheable()
111 111 finally:
112 112 os.remove(path)
113 113
114 114 def has_lsprof():
115 115 try:
116 116 import _lsprof
117 117 return True
118 118 except ImportError:
119 119 return False
120 120
121 121 def has_gettext():
122 122 return matchoutput('msgfmt --version', 'GNU gettext-tools')
123 123
124 124 def has_git():
125 125 return matchoutput('git --version 2>&1', r'^git version')
126 126
127 127 def has_docutils():
128 128 try:
129 129 from docutils.core import publish_cmdline
130 130 return True
131 131 except ImportError:
132 132 return False
133 133
134 134 def getsvnversion():
135 135 m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)')
136 136 if not m:
137 137 return (0, 0)
138 138 return (int(m.group(1)), int(m.group(2)))
139 139
140 140 def has_svn15():
141 141 return getsvnversion() >= (1, 5)
142 142
143 143 def has_svn13():
144 144 return getsvnversion() >= (1, 3)
145 145
146 146 def has_svn():
147 147 return matchoutput('svn --version 2>&1', r'^svn, version') and \
148 148 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
149 149
150 150 def has_svn_bindings():
151 151 try:
152 152 import svn.core
153 153 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
154 154 if version < (1, 4):
155 155 return False
156 156 return True
157 157 except ImportError:
158 158 return False
159 159
160 160 def has_p4():
161 161 return matchoutput('p4 -V', r'Rev\. P4/') and matchoutput('p4d -V', r'Rev\. P4D/')
162 162
163 163 def has_symlink():
164 return hasattr(os, "symlink")
164 return hasattr(os, "symlink") # FIXME: should also check file system and os
165 165
166 166 def has_tla():
167 167 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
168 168
169 169 def has_gpg():
170 170 return matchoutput('gpg --version 2>&1', r'GnuPG')
171 171
172 172 def has_unix_permissions():
173 173 d = tempfile.mkdtemp(prefix=tempprefix, dir=".")
174 174 try:
175 175 fname = os.path.join(d, 'foo')
176 176 for umask in (077, 007, 022):
177 177 os.umask(umask)
178 178 f = open(fname, 'w')
179 179 f.close()
180 180 mode = os.stat(fname).st_mode
181 181 os.unlink(fname)
182 182 if mode & 0777 != ~umask & 0666:
183 183 return False
184 184 return True
185 185 finally:
186 186 os.rmdir(d)
187 187
188 188 def has_pyflakes():
189 189 return matchoutput('echo "import re" 2>&1 | pyflakes',
190 190 r"<stdin>:1: 're' imported but unused",
191 191 True)
192 192
193 193 def has_pygments():
194 194 try:
195 195 import pygments
196 196 return True
197 197 except ImportError:
198 198 return False
199 199
200 200 def has_outer_repo():
201 201 return matchoutput('hg root 2>&1', r'')
202 202
203 203 def has_ssl():
204 204 try:
205 205 import ssl
206 206 import OpenSSL
207 207 OpenSSL.SSL.Context
208 208 return True
209 209 except ImportError:
210 210 return False
211 211
212 212 checks = {
213 213 "baz": (has_baz, "GNU Arch baz client"),
214 214 "bzr": (has_bzr, "Canonical's Bazaar client"),
215 215 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
216 216 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
217 217 "cvs": (has_cvs, "cvs client/server"),
218 218 "darcs": (has_darcs, "darcs client"),
219 219 "docutils": (has_docutils, "Docutils text processing library"),
220 220 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
221 221 "execbit": (has_executablebit, "executable bit"),
222 222 "fifo": (has_fifo, "named pipes"),
223 223 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
224 224 "git": (has_git, "git command line client"),
225 225 "gpg": (has_gpg, "gpg client"),
226 226 "icasefs": (has_icasefs, "case insensitive file system"),
227 227 "inotify": (has_inotify, "inotify extension support"),
228 228 "lsprof": (has_lsprof, "python lsprof module"),
229 229 "mtn": (has_mtn, "monotone client (>= 1.0)"),
230 230 "outer-repo": (has_outer_repo, "outer repo"),
231 231 "p4": (has_p4, "Perforce server and client"),
232 232 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
233 233 "pygments": (has_pygments, "Pygments source highlighting library"),
234 234 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
235 235 "svn": (has_svn, "subversion client and admin tools"),
236 236 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
237 237 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
238 238 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
239 239 "symlink": (has_symlink, "symbolic links"),
240 240 "tla": (has_tla, "GNU Arch tla client"),
241 241 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
242 242 }
243 243
244 244 def list_features():
245 245 for name, feature in checks.iteritems():
246 246 desc = feature[1]
247 247 print name + ':', desc
248 248
249 249 def test_features():
250 250 failed = 0
251 251 for name, feature in checks.iteritems():
252 252 check, _ = feature
253 253 try:
254 254 check()
255 255 except Exception, e:
256 256 print "feature %s failed: %s" % (name, e)
257 257 failed += 1
258 258 return failed
259 259
260 260 parser = optparse.OptionParser("%prog [options] [features]")
261 261 parser.add_option("--test-features", action="store_true",
262 262 help="test available features")
263 263 parser.add_option("--list-features", action="store_true",
264 264 help="list available features")
265 265 parser.add_option("-q", "--quiet", action="store_true",
266 266 help="check features silently")
267 267
268 268 if __name__ == '__main__':
269 269 options, args = parser.parse_args()
270 270 if options.list_features:
271 271 list_features()
272 272 sys.exit(0)
273 273
274 274 if options.test_features:
275 275 sys.exit(test_features())
276 276
277 277 quiet = options.quiet
278 278
279 279 failures = 0
280 280
281 281 def error(msg):
282 282 global failures
283 283 if not quiet:
284 284 sys.stderr.write(msg + '\n')
285 285 failures += 1
286 286
287 287 for feature in args:
288 288 negate = feature.startswith('no-')
289 289 if negate:
290 290 feature = feature[3:]
291 291
292 292 if feature not in checks:
293 293 error('skipped: unknown feature: ' + feature)
294 294 continue
295 295
296 296 check, desc = checks[feature]
297 297 try:
298 298 available = check()
299 299 except Exception, e:
300 300 error('hghave check failed: ' + feature)
301 301 continue
302 302
303 303 if not negate and not available:
304 304 error('skipped: missing feature: ' + desc)
305 305 elif negate and available:
306 306 error('skipped: system supports %s' % desc)
307 307
308 308 if failures != 0:
309 309 sys.exit(1)
@@ -1,82 +1,84
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ hg init
2 4
3 5 should fail
4 6
5 7 $ hg add .hg/00changelog.i
6 8 abort: path contains illegal component: .hg/00changelog.i
7 9 [255]
8 10
9 11 $ mkdir a
10 12 $ echo a > a/a
11 13 $ hg ci -Ama
12 14 adding a/a
13 15 $ ln -s a b
14 16 $ echo b > a/b
15 17
16 18 should fail
17 19
18 20 $ hg add b/b
19 21 abort: path 'b/b' traverses symbolic link 'b'
20 22 [255]
21 23
22 24 should succeed
23 25
24 26 $ hg add b
25 27
26 28 should still fail - maybe
27 29
28 30 $ hg add b/b
29 31 abort: path 'b/b' traverses symbolic link 'b'
30 32 [255]
31 33
32 34 unbundle tampered bundle
33 35
34 36 $ hg init target
35 37 $ cd target
36 38 $ hg unbundle $TESTDIR/bundles/tampered.hg
37 39 adding changesets
38 40 adding manifests
39 41 adding file changes
40 42 added 5 changesets with 6 changes to 6 files (+4 heads)
41 43 (run 'hg heads' to see heads, 'hg merge' to merge)
42 44
43 45 attack .hg/test
44 46
45 47 $ hg manifest -r0
46 48 .hg/test
47 49 $ hg update -Cr0
48 50 abort: path contains illegal component: .hg/test
49 51 [255]
50 52
51 53 attack foo/.hg/test
52 54
53 55 $ hg manifest -r1
54 56 foo/.hg/test
55 57 $ hg update -Cr1
56 58 abort: path 'foo/.hg/test' is inside nested repo 'foo'
57 59 [255]
58 60
59 61 attack back/test where back symlinks to ..
60 62
61 63 $ hg manifest -r2
62 64 back
63 65 back/test
64 66 $ hg update -Cr2
65 67 abort: path 'back/test' traverses symbolic link 'back'
66 68 [255]
67 69
68 70 attack ../test
69 71
70 72 $ hg manifest -r3
71 73 ../test
72 74 $ hg update -Cr3
73 75 abort: path contains illegal component: ../test
74 76 [255]
75 77
76 78 attack /tmp/test
77 79
78 80 $ hg manifest -r4
79 81 /tmp/test
80 82 $ hg update -Cr4
81 83 abort: No such file or directory: $TESTTMP/target//tmp/test
82 84 [255]
@@ -1,281 +1,283
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 commit date test
2 4
3 5 $ hg init test
4 6 $ cd test
5 7 $ echo foo > foo
6 8 $ hg add foo
7 9 $ HGEDITOR=true hg commit -m ""
8 10 abort: empty commit message
9 11 [255]
10 12 $ hg commit -d '0 0' -m commit-1
11 13 $ echo foo >> foo
12 14 $ hg commit -d '1 4444444' -m commit-3
13 15 abort: impossible time zone offset: 4444444
14 16 [255]
15 17 $ hg commit -d '1 15.1' -m commit-4
16 18 abort: invalid date: '1\t15.1'
17 19 [255]
18 20 $ hg commit -d 'foo bar' -m commit-5
19 21 abort: invalid date: 'foo bar'
20 22 [255]
21 23 $ hg commit -d ' 1 4444' -m commit-6
22 24 $ hg commit -d '111111111111 0' -m commit-7
23 25 abort: date exceeds 32 bits: 111111111111
24 26 [255]
25 27 $ hg commit -d '-7654321 3600' -m commit-7
26 28 abort: negative date value: -7654321
27 29 [255]
28 30
29 31 commit added file that has been deleted
30 32
31 33 $ echo bar > bar
32 34 $ hg add bar
33 35 $ rm bar
34 36 $ hg commit -m commit-8
35 37 nothing changed (1 missing files, see 'hg status')
36 38 [1]
37 39 $ hg commit -m commit-8-2 bar
38 40 abort: bar: file not found!
39 41 [255]
40 42
41 43 $ hg -q revert -a --no-backup
42 44
43 45 $ mkdir dir
44 46 $ echo boo > dir/file
45 47 $ hg add
46 48 adding dir/file
47 49 $ hg -v commit -m commit-9 dir
48 50 dir/file
49 51 committed changeset 2:d2a76177cb42
50 52
51 53 $ echo > dir.file
52 54 $ hg add
53 55 adding dir.file
54 56 $ hg commit -m commit-10 dir dir.file
55 57 abort: dir: no match under directory!
56 58 [255]
57 59
58 60 $ echo >> dir/file
59 61 $ mkdir bleh
60 62 $ mkdir dir2
61 63 $ cd bleh
62 64 $ hg commit -m commit-11 .
63 65 abort: bleh: no match under directory!
64 66 [255]
65 67 $ hg commit -m commit-12 ../dir ../dir2
66 68 abort: dir2: no match under directory!
67 69 [255]
68 70 $ hg -v commit -m commit-13 ../dir
69 71 dir/file
70 72 committed changeset 3:1cd62a2d8db5
71 73 $ cd ..
72 74
73 75 $ hg commit -m commit-14 does-not-exist
74 76 abort: does-not-exist: No such file or directory
75 77 [255]
76 78 $ ln -s foo baz
77 79 $ hg commit -m commit-15 baz
78 80 abort: baz: file not tracked!
79 81 [255]
80 82 $ touch quux
81 83 $ hg commit -m commit-16 quux
82 84 abort: quux: file not tracked!
83 85 [255]
84 86 $ echo >> dir/file
85 87 $ hg -v commit -m commit-17 dir/file
86 88 dir/file
87 89 committed changeset 4:49176991390e
88 90
89 91 An empty date was interpreted as epoch origin
90 92
91 93 $ echo foo >> foo
92 94 $ hg commit -d '' -m commit-no-date
93 95 $ hg tip --template '{date|isodate}\n' | grep '1970'
94 96 [1]
95 97
96 98 Make sure we do not obscure unknown requires file entries (issue2649)
97 99
98 100 $ echo foo >> foo
99 101 $ echo fake >> .hg/requires
100 102 $ hg commit -m bla
101 103 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)!
102 104 [255]
103 105
104 106 $ cd ..
105 107
106 108
107 109 partial subdir commit test
108 110
109 111 $ hg init test2
110 112 $ cd test2
111 113 $ mkdir foo
112 114 $ echo foo > foo/foo
113 115 $ mkdir bar
114 116 $ echo bar > bar/bar
115 117 $ hg add
116 118 adding bar/bar
117 119 adding foo/foo
118 120 $ hg ci -m commit-subdir-1 foo
119 121 $ hg ci -m commit-subdir-2 bar
120 122
121 123 subdir log 1
122 124
123 125 $ hg log -v foo
124 126 changeset: 0:f97e73a25882
125 127 user: test
126 128 date: Thu Jan 01 00:00:00 1970 +0000
127 129 files: foo/foo
128 130 description:
129 131 commit-subdir-1
130 132
131 133
132 134
133 135 subdir log 2
134 136
135 137 $ hg log -v bar
136 138 changeset: 1:aa809156d50d
137 139 tag: tip
138 140 user: test
139 141 date: Thu Jan 01 00:00:00 1970 +0000
140 142 files: bar/bar
141 143 description:
142 144 commit-subdir-2
143 145
144 146
145 147
146 148 full log
147 149
148 150 $ hg log -v
149 151 changeset: 1:aa809156d50d
150 152 tag: tip
151 153 user: test
152 154 date: Thu Jan 01 00:00:00 1970 +0000
153 155 files: bar/bar
154 156 description:
155 157 commit-subdir-2
156 158
157 159
158 160 changeset: 0:f97e73a25882
159 161 user: test
160 162 date: Thu Jan 01 00:00:00 1970 +0000
161 163 files: foo/foo
162 164 description:
163 165 commit-subdir-1
164 166
165 167
166 168 $ cd ..
167 169
168 170
169 171 dot and subdir commit test
170 172
171 173 $ hg init test3
172 174 $ cd test3
173 175 $ mkdir foo
174 176 $ echo foo content > foo/plain-file
175 177 $ hg add foo/plain-file
176 178 $ hg ci -m commit-foo-subdir foo
177 179 $ echo modified foo content > foo/plain-file
178 180 $ hg ci -m commit-foo-dot .
179 181
180 182 full log
181 183
182 184 $ hg log -v
183 185 changeset: 1:95b38e3a5b2e
184 186 tag: tip
185 187 user: test
186 188 date: Thu Jan 01 00:00:00 1970 +0000
187 189 files: foo/plain-file
188 190 description:
189 191 commit-foo-dot
190 192
191 193
192 194 changeset: 0:65d4e9386227
193 195 user: test
194 196 date: Thu Jan 01 00:00:00 1970 +0000
195 197 files: foo/plain-file
196 198 description:
197 199 commit-foo-subdir
198 200
199 201
200 202
201 203 subdir log
202 204
203 205 $ cd foo
204 206 $ hg log .
205 207 changeset: 1:95b38e3a5b2e
206 208 tag: tip
207 209 user: test
208 210 date: Thu Jan 01 00:00:00 1970 +0000
209 211 summary: commit-foo-dot
210 212
211 213 changeset: 0:65d4e9386227
212 214 user: test
213 215 date: Thu Jan 01 00:00:00 1970 +0000
214 216 summary: commit-foo-subdir
215 217
216 218 $ cd ..
217 219 $ cd ..
218 220
219 221 Issue1049: Hg permits partial commit of merge without warning
220 222
221 223 $ cd ..
222 224 $ hg init issue1049
223 225 $ cd issue1049
224 226 $ echo a > a
225 227 $ hg ci -Ama
226 228 adding a
227 229 $ echo a >> a
228 230 $ hg ci -mb
229 231 $ hg up 0
230 232 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 233 $ echo b >> a
232 234 $ hg ci -mc
233 235 created new head
234 236 $ HGMERGE=true hg merge
235 237 merging a
236 238 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
237 239 (branch merge, don't forget to commit)
238 240
239 241 should fail because we are specifying a file name
240 242
241 243 $ hg ci -mmerge a
242 244 abort: cannot partially commit a merge (do not specify files or patterns)
243 245 [255]
244 246
245 247 should fail because we are specifying a pattern
246 248
247 249 $ hg ci -mmerge -I a
248 250 abort: cannot partially commit a merge (do not specify files or patterns)
249 251 [255]
250 252
251 253 should succeed
252 254
253 255 $ hg ci -mmerge
254 256 $ cd ..
255 257
256 258
257 259 test commit message content
258 260
259 261 $ hg init commitmsg
260 262 $ cd commitmsg
261 263 $ echo changed > changed
262 264 $ echo removed > removed
263 265 $ hg ci -qAm init
264 266
265 267 $ hg rm removed
266 268 $ echo changed >> changed
267 269 $ echo added > added
268 270 $ hg add added
269 271 $ HGEDITOR=cat hg ci -A
270 272
271 273
272 274 HG: Enter commit message. Lines beginning with 'HG:' are removed.
273 275 HG: Leave message empty to abort commit.
274 276 HG: --
275 277 HG: user: test
276 278 HG: branch 'default'
277 279 HG: added added
278 280 HG: changed changed
279 281 HG: removed removed
280 282 abort: empty commit message
281 283 [255]
@@ -1,209 +1,210
1 $ "$TESTDIR/hghave" symlink || exit 80
1 2
2 3 $ . "$TESTDIR/bzr-definitions"
3 4
4 5 create and rename on the same file in the same step
5 6
6 7 $ mkdir test-createandrename
7 8 $ cd test-createandrename
8 9 $ bzr init -q source
9 10 $ cd source
10 11 $ echo a > a
11 12 $ echo c > c
12 13 $ echo e > e
13 14 $ bzr add -q a c e
14 15 $ bzr commit -q -m 'Initial add: a, c, e'
15 16 $ bzr mv a b
16 17 a => b
17 18 $ bzr mv c d
18 19 c => d
19 20 $ bzr mv e f
20 21 e => f
21 22 $ echo a2 >> a
22 23 $ mkdir e
23 24 $ bzr add -q a e
24 25 $ bzr commit -q -m 'rename a into b, create a, rename c into d'
25 26 $ cd ..
26 27 $ hg convert source source-hg
27 28 initializing destination source-hg repository
28 29 scanning source...
29 30 sorting...
30 31 converting...
31 32 1 Initial add: a, c, e
32 33 0 rename a into b, create a, rename c into d
33 34 $ glog -R source-hg
34 35 o 1 "rename a into b, create a, rename c into d" files: a b c d e f
35 36 |
36 37 o 0 "Initial add: a, c, e" files: a c e
37 38
38 39
39 40 manifest
40 41
41 42 $ hg manifest -R source-hg -r tip
42 43 a
43 44 b
44 45 d
45 46 f
46 47
47 48 test --rev option
48 49
49 50 $ hg convert -r 1 source source-1-hg
50 51 initializing destination source-1-hg repository
51 52 scanning source...
52 53 sorting...
53 54 converting...
54 55 0 Initial add: a, c, e
55 56 $ glog -R source-1-hg
56 57 o 0 "Initial add: a, c, e" files: a c e
57 58
58 59
59 60 test with filemap
60 61
61 62 $ cat > filemap <<EOF
62 63 > exclude a
63 64 > EOF
64 65 $ hg convert --filemap filemap source source-filemap-hg
65 66 initializing destination source-filemap-hg repository
66 67 scanning source...
67 68 sorting...
68 69 converting...
69 70 1 Initial add: a, c, e
70 71 0 rename a into b, create a, rename c into d
71 72 $ hg -R source-filemap-hg manifest -r tip
72 73 b
73 74 d
74 75 f
75 76
76 77 convert from lightweight checkout
77 78
78 79 $ bzr checkout --lightweight source source-light
79 80 $ hg convert source-light source-light-hg
80 81 initializing destination source-light-hg repository
81 82 warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
82 83 scanning source...
83 84 sorting...
84 85 converting...
85 86 1 Initial add: a, c, e
86 87 0 rename a into b, create a, rename c into d
87 88
88 89 lightweight manifest
89 90
90 91 $ hg manifest -R source-light-hg -r tip
91 92 a
92 93 b
93 94 d
94 95 f
95 96
96 97 extract timestamps that look just like hg's {date|isodate}:
97 98 yyyy-mm-dd HH:MM zzzz (no seconds!)
98 99 compare timestamps
99 100
100 101 $ cd source
101 102 $ bzr log | \
102 103 > sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
103 104 > > ../bzr-timestamps
104 105 $ cd ..
105 106 $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
106 107 $ diff -u bzr-timestamps hg-timestamps
107 108 $ cd ..
108 109
109 110 merge
110 111
111 112 $ mkdir test-merge
112 113 $ cd test-merge
113 114 $ cat > helper.py <<EOF
114 115 > import sys
115 116 > from bzrlib import workingtree
116 117 > wt = workingtree.WorkingTree.open('.')
117 118 >
118 119 > message, stamp = sys.argv[1:]
119 120 > wt.commit(message, timestamp=int(stamp))
120 121 > EOF
121 122 $ bzr init -q source
122 123 $ cd source
123 124 $ echo content > a
124 125 $ echo content2 > b
125 126 $ bzr add -q a b
126 127 $ bzr commit -q -m 'Initial add'
127 128 $ cd ..
128 129 $ bzr branch -q source source-improve
129 130 $ cd source
130 131 $ echo more >> a
131 132 $ python ../helper.py 'Editing a' 100
132 133 $ cd ../source-improve
133 134 $ echo content3 >> b
134 135 $ python ../helper.py 'Editing b' 200
135 136 $ cd ../source
136 137 $ bzr merge -q ../source-improve
137 138 $ bzr commit -q -m 'Merged improve branch'
138 139 $ cd ..
139 140 $ hg convert --datesort source source-hg
140 141 initializing destination source-hg repository
141 142 scanning source...
142 143 sorting...
143 144 converting...
144 145 3 Initial add
145 146 2 Editing a
146 147 1 Editing b
147 148 0 Merged improve branch
148 149 $ glog -R source-hg
149 150 o 3 "Merged improve branch" files:
150 151 |\
151 152 | o 2 "Editing b" files: b
152 153 | |
153 154 o | 1 "Editing a" files: a
154 155 |/
155 156 o 0 "Initial add" files: a b
156 157
157 158 $ cd ..
158 159
159 160 symlinks and executable files
160 161
161 162 $ mkdir test-symlinks
162 163 $ cd test-symlinks
163 164 $ bzr init -q source
164 165 $ cd source
165 166 $ touch program
166 167 $ chmod +x program
167 168 $ ln -s program altname
168 169 $ mkdir d
169 170 $ echo a > d/a
170 171 $ ln -s a syma
171 172 $ bzr add -q altname program syma d/a
172 173 $ bzr commit -q -m 'Initial setup'
173 174 $ touch newprog
174 175 $ chmod +x newprog
175 176 $ rm altname
176 177 $ ln -s newprog altname
177 178 $ chmod -x program
178 179 $ bzr add -q newprog
179 180 $ bzr commit -q -m 'Symlink changed, x bits changed'
180 181 $ cd ..
181 182 $ hg convert source source-hg
182 183 initializing destination source-hg repository
183 184 scanning source...
184 185 sorting...
185 186 converting...
186 187 1 Initial setup
187 188 0 Symlink changed, x bits changed
188 189 $ manifest source-hg 0
189 190 % manifest of 0
190 191 644 @ altname
191 192 644 d/a
192 193 755 * program
193 194 644 @ syma
194 195 $ manifest source-hg tip
195 196 % manifest of tip
196 197 644 @ altname
197 198 644 d/a
198 199 755 * newprog
199 200 644 program
200 201 644 @ syma
201 202 $ cd source-hg
202 203
203 204 test the symlinks can be recreated
204 205
205 206 $ hg up
206 207 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 208 $ hg cat syma; echo
208 209 a
209 210
@@ -1,549 +1,548
1
2 $ "$TESTDIR/hghave" svn13 no-outer-repo || exit 80
1 $ "$TESTDIR/hghave" svn13 no-outer-repo symlink || exit 80
3 2
4 3 $ fixpath()
5 4 > {
6 5 > tr '\\' /
7 6 > }
8 7 $ svnupanddisplay()
9 8 > {
10 9 > (
11 10 > cd $1;
12 11 > svn up;
13 12 > svn st -v | fixpath | sed 's/ */ /g'
14 13 > limit=''
15 14 > if [ $2 -gt 0 ]; then
16 15 > limit="--limit=$2"
17 16 > fi
18 17 > svn log --xml -v $limit \
19 18 > | fixpath \
20 19 > | sed 's,<date>.*,<date/>,' \
21 20 > | grep -v 'kind="'
22 21 > )
23 22 > }
24 23
25 24 $ cat >> $HGRCPATH <<EOF
26 25 > [extensions]
27 26 > convert =
28 27 > graphlog =
29 28 > EOF
30 29
31 30 $ hg init a
32 31
33 32 Add
34 33
35 34 $ echo a > a/a
36 35 $ mkdir -p a/d1/d2
37 36 $ echo b > a/d1/d2/b
38 37 $ ln -s a/missing a/link
39 38 $ hg --cwd a ci -d '0 0' -A -m 'add a file'
40 39 adding a
41 40 adding d1/d2/b
42 41 adding link
43 42
44 43 Modify
45 44
46 45 $ "$TESTDIR/svn-safe-append.py" a a/a
47 46 $ hg --cwd a ci -d '1 0' -m 'modify a file'
48 47 $ hg --cwd a tip -q
49 48 1:8231f652da37
50 49
51 50 $ hg convert -d svn a
52 51 assuming destination a-hg
53 52 initializing svn repository 'a-hg'
54 53 initializing svn working copy 'a-hg-wc'
55 54 scanning source...
56 55 sorting...
57 56 converting...
58 57 1 add a file
59 58 0 modify a file
60 59 $ svnupanddisplay a-hg-wc 2
61 60 At revision 2.
62 61 2 2 test .
63 62 2 2 test a
64 63 2 1 test d1
65 64 2 1 test d1/d2
66 65 2 1 test d1/d2/b
67 66 2 1 test link
68 67 <?xml version="1.0"?>
69 68 <log>
70 69 <logentry
71 70 revision="2">
72 71 <author>test</author>
73 72 <date/>
74 73 <paths>
75 74 <path
76 75 action="M">/a</path>
77 76 </paths>
78 77 <msg>modify a file</msg>
79 78 </logentry>
80 79 <logentry
81 80 revision="1">
82 81 <author>test</author>
83 82 <date/>
84 83 <paths>
85 84 <path
86 85 action="A">/a</path>
87 86 <path
88 87 action="A">/d1</path>
89 88 <path
90 89 action="A">/d1/d2</path>
91 90 <path
92 91 action="A">/d1/d2/b</path>
93 92 <path
94 93 action="A">/link</path>
95 94 </paths>
96 95 <msg>add a file</msg>
97 96 </logentry>
98 97 </log>
99 98 $ ls a a-hg-wc
100 99 a:
101 100 a
102 101 d1
103 102 link
104 103
105 104 a-hg-wc:
106 105 a
107 106 d1
108 107 link
109 108 $ cmp a/a a-hg-wc/a
110 109
111 110 Rename
112 111
113 112 $ hg --cwd a mv a b
114 113 $ hg --cwd a mv link newlink
115 114
116 115 $ hg --cwd a ci -d '2 0' -m 'rename a file'
117 116 $ hg --cwd a tip -q
118 117 2:a67e26ccec09
119 118
120 119 $ hg convert -d svn a
121 120 assuming destination a-hg
122 121 initializing svn working copy 'a-hg-wc'
123 122 scanning source...
124 123 sorting...
125 124 converting...
126 125 0 rename a file
127 126 $ svnupanddisplay a-hg-wc 1
128 127 At revision 3.
129 128 3 3 test .
130 129 3 3 test b
131 130 3 1 test d1
132 131 3 1 test d1/d2
133 132 3 1 test d1/d2/b
134 133 3 3 test newlink
135 134 <?xml version="1.0"?>
136 135 <log>
137 136 <logentry
138 137 revision="3">
139 138 <author>test</author>
140 139 <date/>
141 140 <paths>
142 141 <path
143 142 action="D">/a</path>
144 143 <path
145 144 copyfrom-path="/a"
146 145 copyfrom-rev="2"
147 146 action="A">/b</path>
148 147 <path
149 148 copyfrom-path="/link"
150 149 copyfrom-rev="2"
151 150 action="A">/newlink</path>
152 151 <path
153 152 action="D">/link</path>
154 153 </paths>
155 154 <msg>rename a file</msg>
156 155 </logentry>
157 156 </log>
158 157 $ ls a a-hg-wc
159 158 a:
160 159 b
161 160 d1
162 161 newlink
163 162
164 163 a-hg-wc:
165 164 b
166 165 d1
167 166 newlink
168 167
169 168 Copy
170 169
171 170 $ hg --cwd a cp b c
172 171
173 172 $ hg --cwd a ci -d '3 0' -m 'copy a file'
174 173 $ hg --cwd a tip -q
175 174 3:0cf087b9ab02
176 175
177 176 $ hg convert -d svn a
178 177 assuming destination a-hg
179 178 initializing svn working copy 'a-hg-wc'
180 179 scanning source...
181 180 sorting...
182 181 converting...
183 182 0 copy a file
184 183 $ svnupanddisplay a-hg-wc 1
185 184 At revision 4.
186 185 4 4 test .
187 186 4 3 test b
188 187 4 4 test c
189 188 4 1 test d1
190 189 4 1 test d1/d2
191 190 4 1 test d1/d2/b
192 191 4 3 test newlink
193 192 <?xml version="1.0"?>
194 193 <log>
195 194 <logentry
196 195 revision="4">
197 196 <author>test</author>
198 197 <date/>
199 198 <paths>
200 199 <path
201 200 copyfrom-path="/b"
202 201 copyfrom-rev="3"
203 202 action="A">/c</path>
204 203 </paths>
205 204 <msg>copy a file</msg>
206 205 </logentry>
207 206 </log>
208 207 $ ls a a-hg-wc
209 208 a:
210 209 b
211 210 c
212 211 d1
213 212 newlink
214 213
215 214 a-hg-wc:
216 215 b
217 216 c
218 217 d1
219 218 newlink
220 219
221 220 $ hg --cwd a rm b
222 221
223 222 Remove
224 223
225 224 $ hg --cwd a ci -d '4 0' -m 'remove a file'
226 225 $ hg --cwd a tip -q
227 226 4:07b2e34a5b17
228 227
229 228 $ hg convert -d svn a
230 229 assuming destination a-hg
231 230 initializing svn working copy 'a-hg-wc'
232 231 scanning source...
233 232 sorting...
234 233 converting...
235 234 0 remove a file
236 235 $ svnupanddisplay a-hg-wc 1
237 236 At revision 5.
238 237 5 5 test .
239 238 5 4 test c
240 239 5 1 test d1
241 240 5 1 test d1/d2
242 241 5 1 test d1/d2/b
243 242 5 3 test newlink
244 243 <?xml version="1.0"?>
245 244 <log>
246 245 <logentry
247 246 revision="5">
248 247 <author>test</author>
249 248 <date/>
250 249 <paths>
251 250 <path
252 251 action="D">/b</path>
253 252 </paths>
254 253 <msg>remove a file</msg>
255 254 </logentry>
256 255 </log>
257 256 $ ls a a-hg-wc
258 257 a:
259 258 c
260 259 d1
261 260 newlink
262 261
263 262 a-hg-wc:
264 263 c
265 264 d1
266 265 newlink
267 266
268 267 Exectutable
269 268
270 269 $ chmod +x a/c
271 270 $ hg --cwd a ci -d '5 0' -m 'make a file executable'
272 271 $ hg --cwd a tip -q
273 272 5:31093672760b
274 273
275 274 $ hg convert -d svn a
276 275 assuming destination a-hg
277 276 initializing svn working copy 'a-hg-wc'
278 277 scanning source...
279 278 sorting...
280 279 converting...
281 280 0 make a file executable
282 281 $ svnupanddisplay a-hg-wc 1
283 282 At revision 6.
284 283 6 6 test .
285 284 6 6 test c
286 285 6 1 test d1
287 286 6 1 test d1/d2
288 287 6 1 test d1/d2/b
289 288 6 3 test newlink
290 289 <?xml version="1.0"?>
291 290 <log>
292 291 <logentry
293 292 revision="6">
294 293 <author>test</author>
295 294 <date/>
296 295 <paths>
297 296 <path
298 297 action="M">/c</path>
299 298 </paths>
300 299 <msg>make a file executable</msg>
301 300 </logentry>
302 301 </log>
303 302 $ test -x a-hg-wc/c
304 303
305 304 Executable in new directory
306 305
307 306 $ rm -rf a a-hg a-hg-wc
308 307 $ hg init a
309 308
310 309 $ mkdir a/d1
311 310 $ echo a > a/d1/a
312 311 $ chmod +x a/d1/a
313 312 $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory'
314 313 adding d1/a
315 314
316 315 $ hg convert -d svn a
317 316 assuming destination a-hg
318 317 initializing svn repository 'a-hg'
319 318 initializing svn working copy 'a-hg-wc'
320 319 scanning source...
321 320 sorting...
322 321 converting...
323 322 0 add executable file in new directory
324 323 $ svnupanddisplay a-hg-wc 1
325 324 At revision 1.
326 325 1 1 test .
327 326 1 1 test d1
328 327 1 1 test d1/a
329 328 <?xml version="1.0"?>
330 329 <log>
331 330 <logentry
332 331 revision="1">
333 332 <author>test</author>
334 333 <date/>
335 334 <paths>
336 335 <path
337 336 action="A">/d1</path>
338 337 <path
339 338 action="A">/d1/a</path>
340 339 </paths>
341 340 <msg>add executable file in new directory</msg>
342 341 </logentry>
343 342 </log>
344 343 $ test -x a-hg-wc/d1/a
345 344
346 345 Copy to new directory
347 346
348 347 $ mkdir a/d2
349 348 $ hg --cwd a cp d1/a d2/a
350 349 $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory'
351 350
352 351 $ hg convert -d svn a
353 352 assuming destination a-hg
354 353 initializing svn working copy 'a-hg-wc'
355 354 scanning source...
356 355 sorting...
357 356 converting...
358 357 0 copy file to new directory
359 358 $ svnupanddisplay a-hg-wc 1
360 359 At revision 2.
361 360 2 2 test .
362 361 2 1 test d1
363 362 2 1 test d1/a
364 363 2 2 test d2
365 364 2 2 test d2/a
366 365 <?xml version="1.0"?>
367 366 <log>
368 367 <logentry
369 368 revision="2">
370 369 <author>test</author>
371 370 <date/>
372 371 <paths>
373 372 <path
374 373 action="A">/d2</path>
375 374 <path
376 375 copyfrom-path="/d1/a"
377 376 copyfrom-rev="1"
378 377 action="A">/d2/a</path>
379 378 </paths>
380 379 <msg>copy file to new directory</msg>
381 380 </logentry>
382 381 </log>
383 382
384 383 Branchy history
385 384
386 385 $ hg init b
387 386 $ echo base > b/b
388 387 $ hg --cwd b ci -d '0 0' -Ambase
389 388 adding b
390 389
391 390 $ "$TESTDIR/svn-safe-append.py" left-1 b/b
392 391 $ echo left-1 > b/left-1
393 392 $ hg --cwd b ci -d '1 0' -Amleft-1
394 393 adding left-1
395 394
396 395 $ "$TESTDIR/svn-safe-append.py" left-2 b/b
397 396 $ echo left-2 > b/left-2
398 397 $ hg --cwd b ci -d '2 0' -Amleft-2
399 398 adding left-2
400 399
401 400 $ hg --cwd b up 0
402 401 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
403 402
404 403 $ "$TESTDIR/svn-safe-append.py" right-1 b/b
405 404 $ echo right-1 > b/right-1
406 405 $ hg --cwd b ci -d '3 0' -Amright-1
407 406 adding right-1
408 407 created new head
409 408
410 409 $ "$TESTDIR/svn-safe-append.py" right-2 b/b
411 410 $ echo right-2 > b/right-2
412 411 $ hg --cwd b ci -d '4 0' -Amright-2
413 412 adding right-2
414 413
415 414 $ hg --cwd b up -C 2
416 415 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
417 416 $ hg --cwd b merge
418 417 merging b
419 418 warning: conflicts during merge.
420 419 merging b failed!
421 420 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
422 421 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
423 422 [1]
424 423 $ hg --cwd b revert -r 2 b
425 424 $ hg resolve -m b
426 425 $ hg --cwd b ci -d '5 0' -m 'merge'
427 426
428 427 Expect 4 changes
429 428
430 429 $ hg convert -d svn b
431 430 assuming destination b-hg
432 431 initializing svn repository 'b-hg'
433 432 initializing svn working copy 'b-hg-wc'
434 433 scanning source...
435 434 sorting...
436 435 converting...
437 436 5 base
438 437 4 left-1
439 438 3 left-2
440 439 2 right-1
441 440 1 right-2
442 441 0 merge
443 442
444 443 $ svnupanddisplay b-hg-wc 0
445 444 At revision 4.
446 445 4 4 test .
447 446 4 3 test b
448 447 4 2 test left-1
449 448 4 3 test left-2
450 449 4 4 test right-1
451 450 4 4 test right-2
452 451 <?xml version="1.0"?>
453 452 <log>
454 453 <logentry
455 454 revision="4">
456 455 <author>test</author>
457 456 <date/>
458 457 <paths>
459 458 <path
460 459 action="A">/right-1</path>
461 460 <path
462 461 action="A">/right-2</path>
463 462 </paths>
464 463 <msg>merge</msg>
465 464 </logentry>
466 465 <logentry
467 466 revision="3">
468 467 <author>test</author>
469 468 <date/>
470 469 <paths>
471 470 <path
472 471 action="M">/b</path>
473 472 <path
474 473 action="A">/left-2</path>
475 474 </paths>
476 475 <msg>left-2</msg>
477 476 </logentry>
478 477 <logentry
479 478 revision="2">
480 479 <author>test</author>
481 480 <date/>
482 481 <paths>
483 482 <path
484 483 action="M">/b</path>
485 484 <path
486 485 action="A">/left-1</path>
487 486 </paths>
488 487 <msg>left-1</msg>
489 488 </logentry>
490 489 <logentry
491 490 revision="1">
492 491 <author>test</author>
493 492 <date/>
494 493 <paths>
495 494 <path
496 495 action="A">/b</path>
497 496 </paths>
498 497 <msg>base</msg>
499 498 </logentry>
500 499 </log>
501 500
502 501 Tags are not supported, but must not break conversion
503 502
504 503 $ rm -rf a a-hg a-hg-wc
505 504 $ hg init a
506 505 $ echo a > a/a
507 506 $ hg --cwd a ci -d '0 0' -A -m 'Add file a'
508 507 adding a
509 508 $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0
510 509
511 510 $ hg convert -d svn a
512 511 assuming destination a-hg
513 512 initializing svn repository 'a-hg'
514 513 initializing svn working copy 'a-hg-wc'
515 514 scanning source...
516 515 sorting...
517 516 converting...
518 517 1 Add file a
519 518 0 Tagged as v1.0
520 519 writing Subversion tags is not yet implemented
521 520 $ svnupanddisplay a-hg-wc 2
522 521 At revision 2.
523 522 2 2 test .
524 523 2 1 test a
525 524 2 2 test .hgtags
526 525 <?xml version="1.0"?>
527 526 <log>
528 527 <logentry
529 528 revision="2">
530 529 <author>test</author>
531 530 <date/>
532 531 <paths>
533 532 <path
534 533 action="A">/.hgtags</path>
535 534 </paths>
536 535 <msg>Tagged as v1.0</msg>
537 536 </logentry>
538 537 <logentry
539 538 revision="1">
540 539 <author>test</author>
541 540 <date/>
542 541 <paths>
543 542 <path
544 543 action="A">/a</path>
545 544 </paths>
546 545 <msg>Add file a</msg>
547 546 </logentry>
548 547 </log>
549 548 $ rm -rf a a-hg a-hg-wc
@@ -1,135 +1,135
1 1
2 $ "$TESTDIR/hghave" tla || exit 80
2 $ "$TESTDIR/hghave" tla symlink || exit 80
3 3 $ tla my-id "mercurial <mercurial@selenic.com>"
4 4 $ echo "[extensions]" >> $HGRCPATH
5 5 $ echo "convert=" >> $HGRCPATH
6 6 $ echo 'graphlog =' >> $HGRCPATH
7 7
8 8 create tla archive
9 9
10 10 $ tla make-archive tla@mercurial--convert `pwd`/hg-test-convert-tla
11 11
12 12 initialize tla repo
13 13
14 14 $ mkdir tla-repo
15 15 $ cd tla-repo/
16 16 $ tla init-tree tla@mercurial--convert/tla--test--0
17 17 $ tla import
18 18 * creating version tla@mercurial--convert/tla--test--0
19 19 * imported tla@mercurial--convert/tla--test--0
20 20
21 21 create initial files
22 22
23 23 $ echo 'this is a file' > a
24 24 $ tla add a
25 25 $ mkdir src
26 26 $ tla add src
27 27 $ cd src
28 28 $ dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
29 29 $ tla add b
30 30 $ tla commit -s "added a file, src and src/b (binary)"
31 31 A/ .arch-ids
32 32 A/ src
33 33 A/ src/.arch-ids
34 34 A .arch-ids/a.id
35 35 A a
36 36 A src/.arch-ids/=id
37 37 A src/.arch-ids/b.id
38 38 A src/b
39 39 * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
40 40 * committed tla@mercurial--convert/tla--test--0--patch-1
41 41
42 42 create link file and modify a
43 43
44 44 $ ln -s ../a a-link
45 45 $ tla add a-link
46 46 $ echo 'this a modification to a' >> ../a
47 47 $ tla commit -s "added link to a and modify a"
48 48 A src/.arch-ids/a-link.id
49 49 A src/a-link
50 50 M a
51 51 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
52 52 * committed tla@mercurial--convert/tla--test--0--patch-2
53 53
54 54 create second link and modify b
55 55
56 56 $ ln -s ../a a-link-2
57 57 $ tla add a-link-2
58 58 $ dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
59 59 $ tla commit -s "added second link and modify b"
60 60 A src/.arch-ids/a-link-2.id
61 61 A src/a-link-2
62 62 Mb src/b
63 63 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
64 64 * committed tla@mercurial--convert/tla--test--0--patch-3
65 65
66 66 b file to link and a-link-2 to regular file
67 67
68 68 $ rm -f a-link-2
69 69 $ echo 'this is now a regular file' > a-link-2
70 70 $ ln -sf ../a b
71 71 $ tla commit -s "file to link and link to file test"
72 72 fl src/b
73 73 lf src/a-link-2
74 74 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
75 75 * committed tla@mercurial--convert/tla--test--0--patch-4
76 76
77 77 move a-link-2 file and src directory
78 78
79 79 $ cd ..
80 80 $ tla mv src/a-link-2 c
81 81 $ tla mv src test
82 82 $ tla commit -s "move and rename a-link-2 file and src directory"
83 83 D/ src/.arch-ids
84 84 A/ test/.arch-ids
85 85 /> src test
86 86 => src/.arch-ids/a-link-2.id .arch-ids/c.id
87 87 => src/a-link-2 c
88 88 => src/.arch-ids/=id test/.arch-ids/=id
89 89 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
90 90 => src/.arch-ids/b.id test/.arch-ids/b.id
91 91 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
92 92 * committed tla@mercurial--convert/tla--test--0--patch-5
93 93 $ cd ..
94 94
95 95 converting tla repo to Mercurial
96 96
97 97 $ hg convert tla-repo tla-repo-hg
98 98 initializing destination tla-repo-hg repository
99 99 analyzing tree version tla@mercurial--convert/tla--test--0...
100 100 scanning source...
101 101 sorting...
102 102 converting...
103 103 5 initial import
104 104 4 added a file, src and src/b (binary)
105 105 3 added link to a and modify a
106 106 2 added second link and modify b
107 107 1 file to link and link to file test
108 108 0 move and rename a-link-2 file and src directory
109 109 $ tla register-archive -d tla@mercurial--convert
110 110 $ glog()
111 111 > {
112 112 > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
113 113 > }
114 114
115 115 show graph log
116 116
117 117 $ glog -R tla-repo-hg
118 118 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
119 119 |
120 120 o 4 "file to link and link to file test" files: src/a-link-2 src/b
121 121 |
122 122 o 3 "added second link and modify b" files: src/a-link-2 src/b
123 123 |
124 124 o 2 "added link to a and modify a" files: a src/a-link
125 125 |
126 126 o 1 "added a file, src and src/b (binary)" files: a src/b
127 127 |
128 128 o 0 "initial import" files:
129 129
130 130 $ hg up -q -R tla-repo-hg
131 131 $ hg -R tla-repo-hg manifest --debug
132 132 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
133 133 0201ac32a3a8e86e303dff60366382a54b48a72e 644 c
134 134 c0067ba5ff0b7c9a3eb17270839d04614c435623 644 @ test/a-link
135 135 375f4263d86feacdea7e3c27100abd1560f2a973 644 @ test/b
@@ -1,196 +1,198
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ echo "[extensions]" >> $HGRCPATH
2 4 $ echo "extdiff=" >> $HGRCPATH
3 5
4 6 $ hg init a
5 7 $ cd a
6 8 $ echo a > a
7 9 $ echo b > b
8 10 $ hg add
9 11 adding a
10 12 adding b
11 13
12 14 Should diff cloned directories:
13 15
14 16 $ hg extdiff -o -r $opt
15 17 Only in a: a
16 18 Only in a: b
17 19 [1]
18 20
19 21 $ echo "[extdiff]" >> $HGRCPATH
20 22 $ echo "cmd.falabala=echo" >> $HGRCPATH
21 23 $ echo "opts.falabala=diffing" >> $HGRCPATH
22 24
23 25 $ hg falabala
24 26 diffing a.000000000000 a
25 27 [1]
26 28
27 29 $ hg help falabala
28 30 hg falabala [OPTION]... [FILE]...
29 31
30 32 use 'echo' to diff repository (or selected files)
31 33
32 34 Show differences between revisions for the specified files, using the
33 35 'echo' program.
34 36
35 37 When two revision arguments are given, then changes are shown between
36 38 those revisions. If only one revision is specified then that revision is
37 39 compared to the working directory, and, when no revisions are specified,
38 40 the working directory files are compared to its parent.
39 41
40 42 options:
41 43
42 44 -o --option OPT [+] pass option to comparison program
43 45 -r --rev REV [+] revision
44 46 -c --change REV change made by revision
45 47 -I --include PATTERN [+] include names matching the given patterns
46 48 -X --exclude PATTERN [+] exclude names matching the given patterns
47 49
48 50 [+] marked option can be specified multiple times
49 51
50 52 use "hg -v help falabala" to show more info
51 53
52 54 $ hg ci -d '0 0' -mtest1
53 55
54 56 $ echo b >> a
55 57 $ hg ci -d '1 0' -mtest2
56 58
57 59 Should diff cloned files directly:
58 60
59 61 $ hg falabala -r 0:1
60 62 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
61 63 [1]
62 64
63 65 Test diff during merge:
64 66
65 67 $ hg update -C 0
66 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 69 $ echo c >> c
68 70 $ hg add c
69 71 $ hg ci -m "new branch" -d '1 0'
70 72 created new head
71 73 $ hg merge 1
72 74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 75 (branch merge, don't forget to commit)
74 76
75 77 Should diff cloned file against wc file:
76 78
77 79 $ hg falabala
78 80 diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob)
79 81 [1]
80 82
81 83
82 84 Test --change option:
83 85
84 86 $ hg ci -d '2 0' -mtest3
85 87 $ hg falabala -c 1
86 88 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
87 89 [1]
88 90
89 91 Check diff are made from the first parent:
90 92
91 93 $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code"
92 94 diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob)
93 95 diff-like tools yield a non-zero exit code
94 96
95 97 Test extdiff of multiple files in tmp dir:
96 98
97 99 $ hg update -C 0 > /dev/null
98 100 $ echo changed > a
99 101 $ echo changed > b
100 102 $ chmod +x b
101 103
102 104 Diff in working directory, before:
103 105
104 106 $ hg diff --git
105 107 diff --git a/a b/a
106 108 --- a/a
107 109 +++ b/a
108 110 @@ -1,1 +1,1 @@
109 111 -a
110 112 +changed
111 113 diff --git a/b b/b
112 114 old mode 100644
113 115 new mode 100755
114 116 --- a/b
115 117 +++ b/b
116 118 @@ -1,1 +1,1 @@
117 119 -b
118 120 +changed
119 121
120 122
121 123 Edit with extdiff -p:
122 124
123 125 Prepare custom diff/edit tool:
124 126
125 127 $ cat > 'diff tool.py' << EOT
126 128 > #!/usr/bin/env python
127 129 > import time
128 130 > time.sleep(1) # avoid unchanged-timestamp problems
129 131 > file('a/a', 'ab').write('edited\n')
130 132 > file('a/b', 'ab').write('edited\n')
131 133 > EOT
132 134
133 135 $ chmod +x 'diff tool.py'
134 136
135 137 will change to /tmp/extdiff.TMP and populate directories a.TMP and a
136 138 and start tool
137 139
138 140 $ hg extdiff -p "`pwd`/diff tool.py"
139 141 [1]
140 142
141 143 Diff in working directory, after:
142 144
143 145 $ hg diff --git
144 146 diff --git a/a b/a
145 147 --- a/a
146 148 +++ b/a
147 149 @@ -1,1 +1,2 @@
148 150 -a
149 151 +changed
150 152 +edited
151 153 diff --git a/b b/b
152 154 old mode 100644
153 155 new mode 100755
154 156 --- a/b
155 157 +++ b/b
156 158 @@ -1,1 +1,2 @@
157 159 -b
158 160 +changed
159 161 +edited
160 162
161 163 Test extdiff with --option:
162 164
163 165 $ hg extdiff -p echo -o this -c 1
164 166 this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
165 167 [1]
166 168
167 169 $ hg falabala -o this -c 1
168 170 diffing this */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
169 171 [1]
170 172
171 173 Test with revsets:
172 174
173 175 $ hg extdif -p echo -c "rev(1)"
174 176 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
175 177 [1]
176 178
177 179 $ hg extdif -p echo -r "0::1"
178 180 */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob)
179 181 [1]
180 182
181 183 $ cd ..
182 184
183 185 Test symlinks handling (issue1909)
184 186
185 187 $ hg init testsymlinks
186 188 $ cd testsymlinks
187 189 $ echo a > a
188 190 $ hg ci -Am adda
189 191 adding a
190 192 $ echo a >> a
191 193 $ ln -s missing linka
192 194 $ hg add linka
193 195 $ hg falabala -r 0 --traceback
194 196 diffing testsymlinks.07f494440405 testsymlinks
195 197 [1]
196 198 $ cd ..
@@ -1,256 +1,258
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ echo "[extensions]" >> $HGRCPATH
2 4 $ echo "purge=" >> $HGRCPATH
3 5 $ echo "graphlog=" >> $HGRCPATH
4 6
5 7 $ shortlog() {
6 8 > hg glog --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n'
7 9 > }
8 10
9 11 Test --bypass with other options
10 12
11 13 $ hg init repo-options
12 14 $ cd repo-options
13 15 $ echo a > a
14 16 $ hg ci -Am adda
15 17 adding a
16 18 $ echo a >> a
17 19 $ hg branch foo
18 20 marked working directory as branch foo
19 21 $ hg ci -Am changea
20 22 $ hg export . > ../test.diff
21 23 $ hg up null
22 24 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 25
24 26 Test importing an existing revision
25 27
26 28 $ hg import --bypass --exact ../test.diff
27 29 applying ../test.diff
28 30 $ shortlog
29 31 o 1:4e322f7ce8e3 test 0 0 - foo - changea
30 32 |
31 33 o 0:07f494440405 test 0 0 - default - adda
32 34
33 35
34 36 Test failure without --exact
35 37
36 38 $ hg import --bypass ../test.diff
37 39 applying ../test.diff
38 40 unable to find 'a' for patching
39 41 abort: patch failed to apply
40 42 [255]
41 43 $ hg st
42 44 $ shortlog
43 45 o 1:4e322f7ce8e3 test 0 0 - foo - changea
44 46 |
45 47 o 0:07f494440405 test 0 0 - default - adda
46 48
47 49
48 50 Test --user, --date and --message
49 51
50 52 $ hg up 0
51 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 54 $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff
53 55 applying ../test.diff
54 56 $ cat .hg/last-message.txt
55 57 patch2 (no-eol)
56 58 $ shortlog
57 59 o 2:2e127d1da504 test2 1 0 - default - patch2
58 60 |
59 61 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
60 62 |/
61 63 @ 0:07f494440405 test 0 0 - default - adda
62 64
63 65 $ hg rollback
64 66 repository tip rolled back to revision 1 (undo import)
65 67
66 68 Test --import-branch
67 69
68 70 $ hg import --bypass --import-branch ../test.diff
69 71 applying ../test.diff
70 72 $ shortlog
71 73 o 1:4e322f7ce8e3 test 0 0 - foo - changea
72 74 |
73 75 @ 0:07f494440405 test 0 0 - default - adda
74 76
75 77 $ hg rollback
76 78 repository tip rolled back to revision 1 (undo import)
77 79
78 80 Test --strip
79 81
80 82 $ hg import --bypass --strip 0 - <<EOF
81 83 > # HG changeset patch
82 84 > # User test
83 85 > # Date 0 0
84 86 > # Branch foo
85 87 > # Node ID 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c
86 88 > # Parent 07f4944404050f47db2e5c5071e0e84e7a27bba9
87 89 > changea
88 90 >
89 91 > diff -r 07f494440405 -r 4e322f7ce8e3 a
90 92 > --- a Thu Jan 01 00:00:00 1970 +0000
91 93 > +++ a Thu Jan 01 00:00:00 1970 +0000
92 94 > @@ -1,1 +1,2 @@
93 95 > a
94 96 > +a
95 97 > EOF
96 98 applying patch from stdin
97 99 $ hg rollback
98 100 repository tip rolled back to revision 1 (undo import)
99 101
100 102 Test unsupported combinations
101 103
102 104 $ hg import --bypass --no-commit ../test.diff
103 105 abort: cannot use --no-commit with --bypass
104 106 [255]
105 107 $ hg import --bypass --similarity 50 ../test.diff
106 108 abort: cannot use --similarity with --bypass
107 109 [255]
108 110
109 111 Test commit editor
110 112
111 113 $ hg diff -c 1 > ../test.diff
112 114 $ HGEDITOR=cat hg import --bypass ../test.diff
113 115 applying ../test.diff
114 116
115 117
116 118 HG: Enter commit message. Lines beginning with 'HG:' are removed.
117 119 HG: Leave message empty to abort commit.
118 120 HG: --
119 121 HG: user: test
120 122 HG: branch 'default'
121 123 HG: changed a
122 124 abort: empty commit message
123 125 [255]
124 126
125 127 Test patch.eol is handled
126 128
127 129 $ python -c 'file("a", "wb").write("a\r\n")'
128 130 $ hg ci -m makeacrlf
129 131 $ hg import -m 'should fail because of eol' --bypass ../test.diff
130 132 applying ../test.diff
131 133 patching file a
132 134 Hunk #1 FAILED at 0
133 135 abort: patch failed to apply
134 136 [255]
135 137 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff
136 138 applying ../test.diff
137 139 $ shortlog
138 140 o 3:d7805b4d2cb3 test 0 0 - default - test patch.eol
139 141 |
140 142 @ 2:872023de769d test 0 0 - default - makeacrlf
141 143 |
142 144 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
143 145 |/
144 146 o 0:07f494440405 test 0 0 - default - adda
145 147
146 148
147 149 Test applying multiple patches
148 150
149 151 $ hg up -qC 0
150 152 $ echo e > e
151 153 $ hg ci -Am adde
152 154 adding e
153 155 created new head
154 156 $ hg export . > ../patch1.diff
155 157 $ hg up -qC 1
156 158 $ echo f > f
157 159 $ hg ci -Am addf
158 160 adding f
159 161 $ hg export . > ../patch2.diff
160 162 $ cd ..
161 163 $ hg clone -r1 repo-options repo-multi1
162 164 adding changesets
163 165 adding manifests
164 166 adding file changes
165 167 added 2 changesets with 2 changes to 1 files
166 168 updating to branch foo
167 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 170 $ cd repo-multi1
169 171 $ hg up 0
170 172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 173 $ hg import --bypass ../patch1.diff ../patch2.diff
172 174 applying ../patch1.diff
173 175 applying ../patch2.diff
174 176 $ shortlog
175 177 o 3:bc8ca3f8a7c4 test 0 0 - default - addf
176 178 |
177 179 o 2:16581080145e test 0 0 - default - adde
178 180 |
179 181 | o 1:4e322f7ce8e3 test 0 0 - foo - changea
180 182 |/
181 183 @ 0:07f494440405 test 0 0 - default - adda
182 184
183 185
184 186 Test applying multiple patches with --exact
185 187
186 188 $ cd ..
187 189 $ hg clone -r1 repo-options repo-multi2
188 190 adding changesets
189 191 adding manifests
190 192 adding file changes
191 193 added 2 changesets with 2 changes to 1 files
192 194 updating to branch foo
193 195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 196 $ cd repo-multi2
195 197 $ hg import --bypass --exact ../patch1.diff ../patch2.diff
196 198 applying ../patch1.diff
197 199 applying ../patch2.diff
198 200 $ shortlog
199 201 o 3:d60cb8989666 test 0 0 - foo - addf
200 202 |
201 203 | o 2:16581080145e test 0 0 - default - adde
202 204 | |
203 205 @ | 1:4e322f7ce8e3 test 0 0 - foo - changea
204 206 |/
205 207 o 0:07f494440405 test 0 0 - default - adda
206 208
207 209
208 210 $ cd ..
209 211
210 212 Test complicated patch with --exact
211 213
212 214 $ hg init repo-exact
213 215 $ cd repo-exact
214 216 $ echo a > a
215 217 $ echo c > c
216 218 $ echo d > d
217 219 $ echo e > e
218 220 $ echo f > f
219 221 $ chmod +x f
220 222 $ ln -s c linkc
221 223 $ hg ci -Am t
222 224 adding a
223 225 adding c
224 226 adding d
225 227 adding e
226 228 adding f
227 229 adding linkc
228 230 $ hg cp a aa1
229 231 $ echo b >> a
230 232 $ echo b > b
231 233 $ hg add b
232 234 $ hg cp a aa2
233 235 $ echo aa >> aa2
234 236 $ chmod +x e
235 237 $ chmod -x f
236 238 $ ln -s a linka
237 239 $ hg rm d
238 240 $ hg rm linkc
239 241 $ hg mv c cc
240 242 $ hg ci -m patch
241 243 $ hg export --git . > ../test.diff
242 244 $ hg up -C null
243 245 0 files updated, 0 files merged, 7 files removed, 0 files unresolved
244 246 $ hg purge
245 247 $ hg st
246 248 $ hg import --bypass --exact ../test.diff
247 249 applying ../test.diff
248 250
249 251 The patch should have matched the exported revision and generated no additional
250 252 data. If not, diff both heads to debug it.
251 253
252 254 $ shortlog
253 255 o 1:2978fd5c8aa4 test 0 0 - default - patch
254 256 |
255 257 o 0:a0e19e636a43 test 0 0 - default - t
256 258
@@ -1,468 +1,469
1 $ "$TESTDIR/hghave" symlink || exit 80
1 2
2 3 $ hg init
3 4
4 5 New file:
5 6
6 7 $ hg import -d "1000000 0" -mnew - <<EOF
7 8 > diff --git a/new b/new
8 9 > new file mode 100644
9 10 > index 0000000..7898192
10 11 > --- /dev/null
11 12 > +++ b/new
12 13 > @@ -0,0 +1 @@
13 14 > +a
14 15 > EOF
15 16 applying patch from stdin
16 17
17 18 $ hg tip -q
18 19 0:ae3ee40d2079
19 20
20 21 New empty file:
21 22
22 23 $ hg import -d "1000000 0" -mempty - <<EOF
23 24 > diff --git a/empty b/empty
24 25 > new file mode 100644
25 26 > EOF
26 27 applying patch from stdin
27 28
28 29 $ hg tip -q
29 30 1:ab199dc869b5
30 31
31 32 $ hg locate empty
32 33 empty
33 34
34 35 chmod +x:
35 36
36 37 $ hg import -d "1000000 0" -msetx - <<EOF
37 38 > diff --git a/new b/new
38 39 > old mode 100644
39 40 > new mode 100755
40 41 > EOF
41 42 applying patch from stdin
42 43
43 44 $ hg tip -q
44 45 2:3a34410f282e
45 46
46 47 $ test -x new
47 48
48 49 Copy:
49 50
50 51 $ hg import -d "1000000 0" -mcopy - <<EOF
51 52 > diff --git a/new b/copy
52 53 > old mode 100755
53 54 > new mode 100644
54 55 > similarity index 100%
55 56 > copy from new
56 57 > copy to copy
57 58 > diff --git a/new b/copyx
58 59 > similarity index 100%
59 60 > copy from new
60 61 > copy to copyx
61 62 > EOF
62 63 applying patch from stdin
63 64
64 65 $ hg tip -q
65 66 3:37bacb7ca14d
66 67
67 68 $ if "$TESTDIR/hghave" -q execbit; then
68 69 > test -f copy -a ! -x copy || echo bad
69 70 > test -x copyx || echo bad
70 71 > else
71 72 > test -f copy || echo bad
72 73 > fi
73 74
74 75 $ cat copy
75 76 a
76 77
77 78 $ hg cat copy
78 79 a
79 80
80 81 Rename:
81 82
82 83 $ hg import -d "1000000 0" -mrename - <<EOF
83 84 > diff --git a/copy b/rename
84 85 > similarity index 100%
85 86 > rename from copy
86 87 > rename to rename
87 88 > EOF
88 89 applying patch from stdin
89 90
90 91 $ hg tip -q
91 92 4:47b81a94361d
92 93
93 94 $ hg locate
94 95 copyx
95 96 empty
96 97 new
97 98 rename
98 99
99 100 Delete:
100 101
101 102 $ hg import -d "1000000 0" -mdelete - <<EOF
102 103 > diff --git a/copyx b/copyx
103 104 > deleted file mode 100755
104 105 > index 7898192..0000000
105 106 > --- a/copyx
106 107 > +++ /dev/null
107 108 > @@ -1 +0,0 @@
108 109 > -a
109 110 > EOF
110 111 applying patch from stdin
111 112
112 113 $ hg tip -q
113 114 5:d9b001d98336
114 115
115 116 $ hg locate
116 117 empty
117 118 new
118 119 rename
119 120
120 121 $ test -f copyx
121 122 [1]
122 123
123 124 Regular diff:
124 125
125 126 $ hg import -d "1000000 0" -mregular - <<EOF
126 127 > diff --git a/rename b/rename
127 128 > index 7898192..72e1fe3 100644
128 129 > --- a/rename
129 130 > +++ b/rename
130 131 > @@ -1 +1,5 @@
131 132 > a
132 133 > +a
133 134 > +a
134 135 > +a
135 136 > +a
136 137 > EOF
137 138 applying patch from stdin
138 139
139 140 $ hg tip -q
140 141 6:ebe901e7576b
141 142
142 143 Copy and modify:
143 144
144 145 $ hg import -d "1000000 0" -mcopymod - <<EOF
145 146 > diff --git a/rename b/copy2
146 147 > similarity index 80%
147 148 > copy from rename
148 149 > copy to copy2
149 150 > index 72e1fe3..b53c148 100644
150 151 > --- a/rename
151 152 > +++ b/copy2
152 153 > @@ -1,5 +1,5 @@
153 154 > a
154 155 > a
155 156 > -a
156 157 > +b
157 158 > a
158 159 > a
159 160 > EOF
160 161 applying patch from stdin
161 162
162 163 $ hg tip -q
163 164 7:18f368958ecd
164 165
165 166 $ hg cat copy2
166 167 a
167 168 a
168 169 b
169 170 a
170 171 a
171 172
172 173 Rename and modify:
173 174
174 175 $ hg import -d "1000000 0" -mrenamemod - <<EOF
175 176 > diff --git a/copy2 b/rename2
176 177 > similarity index 80%
177 178 > rename from copy2
178 179 > rename to rename2
179 180 > index b53c148..8f81e29 100644
180 181 > --- a/copy2
181 182 > +++ b/rename2
182 183 > @@ -1,5 +1,5 @@
183 184 > a
184 185 > a
185 186 > b
186 187 > -a
187 188 > +c
188 189 > a
189 190 > EOF
190 191 applying patch from stdin
191 192
192 193 $ hg tip -q
193 194 8:c32b0d7e6f44
194 195
195 196 $ hg locate copy2
196 197 [1]
197 198 $ hg cat rename2
198 199 a
199 200 a
200 201 b
201 202 c
202 203 a
203 204
204 205 One file renamed multiple times:
205 206
206 207 $ hg import -d "1000000 0" -mmultirenames - <<EOF
207 208 > diff --git a/rename2 b/rename3
208 209 > rename from rename2
209 210 > rename to rename3
210 211 > diff --git a/rename2 b/rename3-2
211 212 > rename from rename2
212 213 > rename to rename3-2
213 214 > EOF
214 215 applying patch from stdin
215 216
216 217 $ hg tip -q
217 218 9:034a6bf95330
218 219
219 220 $ hg log -vr. --template '{rev} {files} / {file_copies}\n'
220 221 9 rename2 rename3 rename3-2 / rename3 (rename2)rename3-2 (rename2)
221 222
222 223 $ hg locate rename2 rename3 rename3-2
223 224 rename3
224 225 rename3-2
225 226
226 227 $ hg cat rename3
227 228 a
228 229 a
229 230 b
230 231 c
231 232 a
232 233
233 234 $ hg cat rename3-2
234 235 a
235 236 a
236 237 b
237 238 c
238 239 a
239 240
240 241 $ echo foo > foo
241 242 $ hg add foo
242 243 $ hg ci -m 'add foo'
243 244
244 245 Binary files and regular patch hunks:
245 246
246 247 $ hg import -d "1000000 0" -m binaryregular - <<EOF
247 248 > diff --git a/binary b/binary
248 249 > new file mode 100644
249 250 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
250 251 > GIT binary patch
251 252 > literal 4
252 253 > Lc\${NkU|;|M00aO5
253 254 >
254 255 > diff --git a/foo b/foo2
255 256 > rename from foo
256 257 > rename to foo2
257 258 > EOF
258 259 applying patch from stdin
259 260
260 261 $ hg tip -q
261 262 11:c39bce63e786
262 263
263 264 $ cat foo2
264 265 foo
265 266
266 267 $ hg manifest --debug | grep binary
267 268 045c85ba38952325e126c70962cc0f9d9077bc67 644 binary
268 269
269 270 Multiple binary files:
270 271
271 272 $ hg import -d "1000000 0" -m multibinary - <<EOF
272 273 > diff --git a/mbinary1 b/mbinary1
273 274 > new file mode 100644
274 275 > index 0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
275 276 > GIT binary patch
276 277 > literal 4
277 278 > Lc\${NkU|;|M00aO5
278 279 >
279 280 > diff --git a/mbinary2 b/mbinary2
280 281 > new file mode 100644
281 282 > index 0000000000000000000000000000000000000000..112363ac1917b417ffbd7f376ca786a1e5fa7490
282 283 > GIT binary patch
283 284 > literal 5
284 285 > Mc\${NkU|\`?^000jF3jhEB
285 286 >
286 287 > EOF
287 288 applying patch from stdin
288 289
289 290 $ hg tip -q
290 291 12:30b530085242
291 292
292 293 $ hg manifest --debug | grep mbinary
293 294 045c85ba38952325e126c70962cc0f9d9077bc67 644 mbinary1
294 295 a874b471193996e7cb034bb301cac7bdaf3e3f46 644 mbinary2
295 296
296 297 Filenames with spaces:
297 298
298 299 $ hg import -d "1000000 0" -m spaces - <<EOF
299 300 > diff --git a/foo bar b/foo bar
300 301 > new file mode 100644
301 302 > index 0000000..257cc56
302 303 > --- /dev/null
303 304 > +++ b/foo bar
304 305 > @@ -0,0 +1 @@
305 306 > +foo
306 307 > EOF
307 308 applying patch from stdin
308 309
309 310 $ hg tip -q
310 311 13:04750ef42fb3
311 312
312 313 $ cat "foo bar"
313 314 foo
314 315
315 316 Copy then modify the original file:
316 317
317 318 $ hg import -d "1000000 0" -m copy-mod-orig - <<EOF
318 319 > diff --git a/foo2 b/foo2
319 320 > index 257cc56..fe08ec6 100644
320 321 > --- a/foo2
321 322 > +++ b/foo2
322 323 > @@ -1 +1,2 @@
323 324 > foo
324 325 > +new line
325 326 > diff --git a/foo2 b/foo3
326 327 > similarity index 100%
327 328 > copy from foo2
328 329 > copy to foo3
329 330 > EOF
330 331 applying patch from stdin
331 332
332 333 $ hg tip -q
333 334 14:c4cd9cdeaa74
334 335
335 336 $ cat foo3
336 337 foo
337 338
338 339 Move text file and patch as binary
339 340
340 341 $ echo a > text2
341 342 $ hg ci -Am0
342 343 adding text2
343 344 $ hg import -d "1000000 0" -m rename-as-binary - <<"EOF"
344 345 > diff --git a/text2 b/binary2
345 346 > rename from text2
346 347 > rename to binary2
347 348 > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757
348 349 > GIT binary patch
349 350 > literal 5
350 351 > Mc$`b*O5$Pw00T?_*Z=?k
351 352 >
352 353 > EOF
353 354 applying patch from stdin
354 355
355 356 $ cat binary2
356 357 a
357 358 b
358 359 \x00 (no-eol) (esc)
359 360
360 361 $ hg st --copies --change .
361 362 A binary2
362 363 text2
363 364 R text2
364 365 $ cd ..
365 366
366 367 Consecutive import with renames (issue2459)
367 368
368 369 $ hg init issue2459
369 370 $ cd issue2459
370 371 $ hg import --no-commit --force - <<EOF
371 372 > diff --git a/a b/a
372 373 > new file mode 100644
373 374 > EOF
374 375 applying patch from stdin
375 376 $ hg import --no-commit --force - <<EOF
376 377 > diff --git a/a b/b
377 378 > rename from a
378 379 > rename to b
379 380 > EOF
380 381 applying patch from stdin
381 382 a has not been committed yet, so no copy data will be stored for b.
382 383 $ hg debugstate
383 384 a 0 -1 unset b
384 385 $ hg ci -m done
385 386 $ cd ..
386 387
387 388 Renames and strip
388 389
389 390 $ hg init renameandstrip
390 391 $ cd renameandstrip
391 392 $ echo a > a
392 393 $ hg ci -Am adda
393 394 adding a
394 395 $ hg import --no-commit -p2 - <<EOF
395 396 > diff --git a/foo/a b/foo/b
396 397 > rename from foo/a
397 398 > rename to foo/b
398 399 > EOF
399 400 applying patch from stdin
400 401 $ hg st --copies
401 402 A b
402 403 a
403 404 R a
404 405 $ cd ..
405 406
406 407 Pure copy with existing destination
407 408
408 409 $ hg init copytoexisting
409 410 $ cd copytoexisting
410 411 $ echo a > a
411 412 $ echo b > b
412 413 $ hg ci -Am add
413 414 adding a
414 415 adding b
415 416 $ hg import --no-commit - <<EOF
416 417 > diff --git a/a b/b
417 418 > copy from a
418 419 > copy to b
419 420 > EOF
420 421 applying patch from stdin
421 422 abort: cannot create b: destination already exists
422 423 [255]
423 424 $ cat b
424 425 b
425 426
426 427 Copy and changes with existing destination
427 428
428 429 $ hg import --no-commit - <<EOF
429 430 > diff --git a/a b/b
430 431 > copy from a
431 432 > copy to b
432 433 > --- a/a
433 434 > +++ b/b
434 435 > @@ -1,1 +1,2 @@
435 436 > a
436 437 > +b
437 438 > EOF
438 439 applying patch from stdin
439 440 cannot create b: destination already exists
440 441 1 out of 1 hunks FAILED -- saving rejects to file b.rej
441 442 abort: patch failed to apply
442 443 [255]
443 444 $ cat b
444 445 b
445 446
446 447 $ ln -s b linkb
447 448 $ hg add linkb
448 449 $ hg ci -m addlinkb
449 450 $ hg import --no-commit - <<EOF
450 451 > diff --git a/linkb b/linkb
451 452 > deleted file mode 120000
452 453 > --- a/linkb
453 454 > +++ /dev/null
454 455 > @@ -1,1 +0,0 @@
455 456 > -badhunk
456 457 > \ No newline at end of file
457 458 > EOF
458 459 applying patch from stdin
459 460 patching file linkb
460 461 Hunk #1 FAILED at 0
461 462 1 out of 1 hunks FAILED -- saving rejects to file linkb.rej
462 463 abort: patch failed to apply
463 464 [255]
464 465 $ hg st
465 466 ? b.rej
466 467 ? linkb.rej
467 468
468 469 $ cd ..
@@ -1,1083 +1,1085
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ cat <<EOF >> $HGRCPATH
2 4 > [extensions]
3 5 > keyword =
4 6 > mq =
5 7 > notify =
6 8 > record =
7 9 > transplant =
8 10 > [ui]
9 11 > interactive = true
10 12 > EOF
11 13
12 14 Run kwdemo before [keyword] files are set up
13 15 as it would succeed without uisetup otherwise
14 16
15 17 $ hg --quiet kwdemo
16 18 [extensions]
17 19 keyword =
18 20 [keyword]
19 21 demo.txt =
20 22 [keywordset]
21 23 svn = False
22 24 [keywordmaps]
23 25 Author = {author|user}
24 26 Date = {date|utcdate}
25 27 Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
26 28 Id = {file|basename},v {node|short} {date|utcdate} {author|user}
27 29 RCSFile = {file|basename},v
28 30 RCSfile = {file|basename},v
29 31 Revision = {node|short}
30 32 Source = {root}/{file},v
31 33 $Author: test $
32 34 $Date: ????/??/?? ??:??:?? $ (glob)
33 35 $Header: */demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
34 36 $Id: demo.txt,v ???????????? ????/??/?? ??:??:?? test $ (glob)
35 37 $RCSFile: demo.txt,v $
36 38 $RCSfile: demo.txt,v $
37 39 $Revision: ???????????? $ (glob)
38 40 $Source: */demo.txt,v $ (glob)
39 41
40 42 $ hg --quiet kwdemo "Branch = {branches}"
41 43 [extensions]
42 44 keyword =
43 45 [keyword]
44 46 demo.txt =
45 47 [keywordset]
46 48 svn = False
47 49 [keywordmaps]
48 50 Branch = {branches}
49 51 $Branch: demobranch $
50 52
51 53 $ cat <<EOF >> $HGRCPATH
52 54 > [keyword]
53 55 > ** =
54 56 > b = ignore
55 57 > i = ignore
56 58 > [hooks]
57 59 > EOF
58 60 $ cp $HGRCPATH $HGRCPATH.nohooks
59 61 > cat <<EOF >> $HGRCPATH
60 62 > commit=
61 63 > commit.test=cp a hooktest
62 64 > EOF
63 65
64 66 $ hg init Test-bndl
65 67 $ cd Test-bndl
66 68
67 69 kwshrink should exit silently in empty/invalid repo
68 70
69 71 $ hg kwshrink
70 72
71 73 Symlinks cannot be created on Windows.
72 74 A bundle to test this was made with:
73 75 hg init t
74 76 cd t
75 77 echo a > a
76 78 ln -s a sym
77 79 hg add sym
78 80 hg ci -m addsym -u mercurial
79 81 hg bundle --base null ../test-keyword.hg
80 82
81 83 $ hg pull -u "$TESTDIR"/bundles/test-keyword.hg
82 84 pulling from *test-keyword.hg (glob)
83 85 requesting all changes
84 86 adding changesets
85 87 adding manifests
86 88 adding file changes
87 89 added 1 changesets with 1 changes to 1 files
88 90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 91
90 92 $ echo 'expand $Id$' > a
91 93 $ echo 'do not process $Id:' >> a
92 94 $ echo 'xxx $' >> a
93 95 $ echo 'ignore $Id$' > b
94 96
95 97 Output files as they were created
96 98
97 99 $ cat a b
98 100 expand $Id$
99 101 do not process $Id:
100 102 xxx $
101 103 ignore $Id$
102 104
103 105 no kwfiles
104 106
105 107 $ hg kwfiles
106 108
107 109 untracked candidates
108 110
109 111 $ hg -v kwfiles --unknown
110 112 k a
111 113
112 114 Add files and check status
113 115
114 116 $ hg addremove
115 117 adding a
116 118 adding b
117 119 $ hg status
118 120 A a
119 121 A b
120 122
121 123
122 124 Default keyword expansion including commit hook
123 125 Interrupted commit should not change state or run commit hook
124 126
125 127 $ hg --debug commit
126 128 abort: empty commit message
127 129 [255]
128 130 $ hg status
129 131 A a
130 132 A b
131 133
132 134 Commit with several checks
133 135
134 136 $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
135 137 a
136 138 b
137 139 overwriting a expanding keywords
138 140 running hook commit.test: cp a hooktest
139 141 committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
140 142 $ hg status
141 143 ? hooktest
142 144 $ hg debugrebuildstate
143 145 $ hg --quiet identify
144 146 ef63ca68695b
145 147
146 148 cat files in working directory with keywords expanded
147 149
148 150 $ cat a b
149 151 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
150 152 do not process $Id:
151 153 xxx $
152 154 ignore $Id$
153 155
154 156 hg cat files and symlink, no expansion
155 157
156 158 $ hg cat sym a b && echo
157 159 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
158 160 do not process $Id:
159 161 xxx $
160 162 ignore $Id$
161 163 a
162 164
163 165 Test hook execution
164 166
165 167 $ diff a hooktest
166 168
167 169 $ cp $HGRCPATH.nohooks $HGRCPATH
168 170 $ rm hooktest
169 171
170 172 bundle
171 173
172 174 $ hg bundle --base null ../kw.hg
173 175 2 changesets found
174 176 $ cd ..
175 177 $ hg init Test
176 178 $ cd Test
177 179
178 180 Notify on pull to check whether keywords stay as is in email
179 181 ie. if patch.diff wrapper acts as it should
180 182
181 183 $ cat <<EOF >> $HGRCPATH
182 184 > [hooks]
183 185 > incoming.notify = python:hgext.notify.hook
184 186 > [notify]
185 187 > sources = pull
186 188 > diffstat = False
187 189 > maxsubject = 15
188 190 > [reposubs]
189 191 > * = Test
190 192 > EOF
191 193
192 194 Pull from bundle and trigger notify
193 195
194 196 $ hg pull -u ../kw.hg
195 197 pulling from ../kw.hg
196 198 requesting all changes
197 199 adding changesets
198 200 adding manifests
199 201 adding file changes
200 202 added 2 changesets with 3 changes to 3 files
201 203 Content-Type: text/plain; charset="us-ascii"
202 204 MIME-Version: 1.0
203 205 Content-Transfer-Encoding: 7bit
204 206 Date: * (glob)
205 207 Subject: changeset in...
206 208 From: mercurial
207 209 X-Hg-Notification: changeset a2392c293916
208 210 Message-Id: <hg.a2392c293916*> (glob)
209 211 To: Test
210 212
211 213 changeset a2392c293916 in $TESTTMP/Test
212 214 details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
213 215 description:
214 216 addsym
215 217
216 218 diffs (6 lines):
217 219
218 220 diff -r 000000000000 -r a2392c293916 sym
219 221 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
220 222 +++ b/sym Sat Feb 09 20:25:47 2008 +0100
221 223 @@ -0,0 +1,1 @@
222 224 +a
223 225 \ No newline at end of file
224 226 Content-Type: text/plain; charset="us-ascii"
225 227 MIME-Version: 1.0
226 228 Content-Transfer-Encoding: 7bit
227 229 Date:* (glob)
228 230 Subject: changeset in...
229 231 From: User Name <user@example.com>
230 232 X-Hg-Notification: changeset ef63ca68695b
231 233 Message-Id: <hg.ef63ca68695b*> (glob)
232 234 To: Test
233 235
234 236 changeset ef63ca68695b in $TESTTMP/Test
235 237 details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
236 238 description:
237 239 absym
238 240
239 241 diffs (12 lines):
240 242
241 243 diff -r a2392c293916 -r ef63ca68695b a
242 244 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
243 245 +++ b/a Thu Jan 01 00:00:00 1970 +0000
244 246 @@ -0,0 +1,3 @@
245 247 +expand $Id$
246 248 +do not process $Id:
247 249 +xxx $
248 250 diff -r a2392c293916 -r ef63ca68695b b
249 251 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
250 252 +++ b/b Thu Jan 01 00:00:00 1970 +0000
251 253 @@ -0,0 +1,1 @@
252 254 +ignore $Id$
253 255 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
254 256
255 257 $ cp $HGRCPATH.nohooks $HGRCPATH
256 258
257 259 Touch files and check with status
258 260
259 261 $ touch a b
260 262 $ hg status
261 263
262 264 Update and expand
263 265
264 266 $ rm sym a b
265 267 $ hg update -C
266 268 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 269 $ cat a b
268 270 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
269 271 do not process $Id:
270 272 xxx $
271 273 ignore $Id$
272 274
273 275 Check whether expansion is filewise and file mode is preserved
274 276
275 277 $ echo '$Id$' > c
276 278 $ echo 'tests for different changenodes' >> c
277 279 $ chmod 600 c
278 280 $ ls -l c | cut -b 1-10
279 281 -rw-------
280 282
281 283 commit file c
282 284
283 285 $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
284 286 adding c
285 287 $ ls -l c | cut -b 1-10
286 288 -rw-------
287 289
288 290 force expansion
289 291
290 292 $ hg -v kwexpand
291 293 overwriting a expanding keywords
292 294 overwriting c expanding keywords
293 295
294 296 compare changenodes in a and c
295 297
296 298 $ cat a c
297 299 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
298 300 do not process $Id:
299 301 xxx $
300 302 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
301 303 tests for different changenodes
302 304
303 305 record
304 306
305 307 $ echo '$Id$' > r
306 308 $ hg add r
307 309
308 310 record chunk
309 311
310 312 $ python -c \
311 313 > 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
312 314 $ hg record -d '1 10' -m rectest a<<EOF
313 315 > y
314 316 > y
315 317 > n
316 318 > EOF
317 319 diff --git a/a b/a
318 320 2 hunks, 2 lines changed
319 321 examine changes to 'a'? [Ynsfdaq?]
320 322 @@ -1,3 +1,4 @@
321 323 expand $Id$
322 324 +foo
323 325 do not process $Id:
324 326 xxx $
325 327 record change 1/2 to 'a'? [Ynsfdaq?]
326 328 @@ -2,2 +3,3 @@
327 329 do not process $Id:
328 330 xxx $
329 331 +bar
330 332 record change 2/2 to 'a'? [Ynsfdaq?]
331 333
332 334 $ hg identify
333 335 d17e03c92c97+ tip
334 336 $ hg status
335 337 M a
336 338 A r
337 339
338 340 Cat modified file a
339 341
340 342 $ cat a
341 343 expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
342 344 foo
343 345 do not process $Id:
344 346 xxx $
345 347 bar
346 348
347 349 Diff remaining chunk
348 350
349 351 $ hg diff a
350 352 diff -r d17e03c92c97 a
351 353 --- a/a Wed Dec 31 23:59:51 1969 -0000
352 354 +++ b/a * (glob)
353 355 @@ -2,3 +2,4 @@
354 356 foo
355 357 do not process $Id:
356 358 xxx $
357 359 +bar
358 360
359 361 $ hg rollback
360 362 repository tip rolled back to revision 2 (undo commit)
361 363 working directory now based on revision 2
362 364
363 365 Record all chunks in file a
364 366
365 367 $ echo foo > msg
366 368
367 369 - do not use "hg record -m" here!
368 370
369 371 $ hg record -l msg -d '1 11' a<<EOF
370 372 > y
371 373 > y
372 374 > y
373 375 > EOF
374 376 diff --git a/a b/a
375 377 2 hunks, 2 lines changed
376 378 examine changes to 'a'? [Ynsfdaq?]
377 379 @@ -1,3 +1,4 @@
378 380 expand $Id$
379 381 +foo
380 382 do not process $Id:
381 383 xxx $
382 384 record change 1/2 to 'a'? [Ynsfdaq?]
383 385 @@ -2,2 +3,3 @@
384 386 do not process $Id:
385 387 xxx $
386 388 +bar
387 389 record change 2/2 to 'a'? [Ynsfdaq?]
388 390
389 391 File a should be clean
390 392
391 393 $ hg status -A a
392 394 C a
393 395
394 396 rollback and revert expansion
395 397
396 398 $ cat a
397 399 expand $Id: a,v 59f969a3b52c 1970/01/01 00:00:01 test $
398 400 foo
399 401 do not process $Id:
400 402 xxx $
401 403 bar
402 404 $ hg --verbose rollback
403 405 repository tip rolled back to revision 2 (undo commit)
404 406 working directory now based on revision 2
405 407 overwriting a expanding keywords
406 408 $ hg status a
407 409 M a
408 410 $ cat a
409 411 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
410 412 foo
411 413 do not process $Id:
412 414 xxx $
413 415 bar
414 416 $ echo '$Id$' > y
415 417 $ echo '$Id$' > z
416 418 $ hg add y
417 419 $ hg commit -Am "rollback only" z
418 420 $ cat z
419 421 $Id: z,v 45a5d3adce53 1970/01/01 00:00:00 test $
420 422 $ hg --verbose rollback
421 423 repository tip rolled back to revision 2 (undo commit)
422 424 working directory now based on revision 2
423 425 overwriting z shrinking keywords
424 426
425 427 Only z should be overwritten
426 428
427 429 $ hg status a y z
428 430 M a
429 431 A y
430 432 A z
431 433 $ cat z
432 434 $Id$
433 435 $ hg forget y z
434 436 $ rm y z
435 437
436 438 record added file alone
437 439
438 440 $ hg -v record -l msg -d '1 12' r<<EOF
439 441 > y
440 442 > EOF
441 443 diff --git a/r b/r
442 444 new file mode 100644
443 445 examine changes to 'r'? [Ynsfdaq?]
444 446 r
445 447 committed changeset 3:899491280810
446 448 overwriting r expanding keywords
447 449 - status call required for dirstate.normallookup() check
448 450 $ hg status r
449 451 $ hg --verbose rollback
450 452 repository tip rolled back to revision 2 (undo commit)
451 453 working directory now based on revision 2
452 454 overwriting r shrinking keywords
453 455 $ hg forget r
454 456 $ rm msg r
455 457 $ hg update -C
456 458 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 459
458 460 record added keyword ignored file
459 461
460 462 $ echo '$Id$' > i
461 463 $ hg add i
462 464 $ hg --verbose record -d '1 13' -m recignored<<EOF
463 465 > y
464 466 > EOF
465 467 diff --git a/i b/i
466 468 new file mode 100644
467 469 examine changes to 'i'? [Ynsfdaq?]
468 470 i
469 471 committed changeset 3:5f40fe93bbdc
470 472 $ cat i
471 473 $Id$
472 474 $ hg -q rollback
473 475 $ hg forget i
474 476 $ rm i
475 477
476 478 Test patch queue repo
477 479
478 480 $ hg init --mq
479 481 $ hg qimport -r tip -n mqtest.diff
480 482 $ hg commit --mq -m mqtest
481 483
482 484 Keywords should not be expanded in patch
483 485
484 486 $ cat .hg/patches/mqtest.diff
485 487 # HG changeset patch
486 488 # User User Name <user@example.com>
487 489 # Date 1 0
488 490 # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
489 491 # Parent ef63ca68695bc9495032c6fda1350c71e6d256e9
490 492 cndiff
491 493
492 494 diff -r ef63ca68695b -r 40a904bbbe4c c
493 495 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
494 496 +++ b/c Thu Jan 01 00:00:01 1970 +0000
495 497 @@ -0,0 +1,2 @@
496 498 +$Id$
497 499 +tests for different changenodes
498 500
499 501 $ hg qpop
500 502 popping mqtest.diff
501 503 patch queue now empty
502 504
503 505 qgoto, implying qpush, should expand
504 506
505 507 $ hg qgoto mqtest.diff
506 508 applying mqtest.diff
507 509 now at: mqtest.diff
508 510 $ cat c
509 511 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
510 512 tests for different changenodes
511 513 $ hg cat c
512 514 $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
513 515 tests for different changenodes
514 516
515 517 Keywords should not be expanded in filelog
516 518
517 519 $ hg --config 'extensions.keyword=!' cat c
518 520 $Id$
519 521 tests for different changenodes
520 522
521 523 qpop and move on
522 524
523 525 $ hg qpop
524 526 popping mqtest.diff
525 527 patch queue now empty
526 528
527 529 Copy and show added kwfiles
528 530
529 531 $ hg cp a c
530 532 $ hg kwfiles
531 533 a
532 534 c
533 535
534 536 Commit and show expansion in original and copy
535 537
536 538 $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
537 539 c
538 540 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
539 541 overwriting c expanding keywords
540 542 committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
541 543 $ cat a c
542 544 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
543 545 do not process $Id:
544 546 xxx $
545 547 expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
546 548 do not process $Id:
547 549 xxx $
548 550
549 551 Touch copied c and check its status
550 552
551 553 $ touch c
552 554 $ hg status
553 555
554 556 Copy kwfile to keyword ignored file unexpanding keywords
555 557
556 558 $ hg --verbose copy a i
557 559 copying a to i
558 560 overwriting i shrinking keywords
559 561 $ head -n 1 i
560 562 expand $Id$
561 563 $ hg forget i
562 564 $ rm i
563 565
564 566 Copy ignored file to ignored file: no overwriting
565 567
566 568 $ hg --verbose copy b i
567 569 copying b to i
568 570 $ hg forget i
569 571 $ rm i
570 572
571 573 cp symlink file; hg cp -A symlink file (part1)
572 574 - copied symlink points to kwfile: overwrite
573 575
574 576 $ cp sym i
575 577 $ ls -l i
576 578 -rw-r--r--* (glob)
577 579 $ head -1 i
578 580 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
579 581 $ hg copy --after --verbose sym i
580 582 copying sym to i
581 583 overwriting i shrinking keywords
582 584 $ head -1 i
583 585 expand $Id$
584 586 $ hg forget i
585 587 $ rm i
586 588
587 589 Test different options of hg kwfiles
588 590
589 591 $ hg kwfiles
590 592 a
591 593 c
592 594 $ hg -v kwfiles --ignore
593 595 I b
594 596 I sym
595 597 $ hg kwfiles --all
596 598 K a
597 599 K c
598 600 I b
599 601 I sym
600 602
601 603 Diff specific revision
602 604
603 605 $ hg diff --rev 1
604 606 diff -r ef63ca68695b c
605 607 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
606 608 +++ b/c * (glob)
607 609 @@ -0,0 +1,3 @@
608 610 +expand $Id$
609 611 +do not process $Id:
610 612 +xxx $
611 613
612 614 Status after rollback:
613 615
614 616 $ hg rollback
615 617 repository tip rolled back to revision 1 (undo commit)
616 618 working directory now based on revision 1
617 619 $ hg status
618 620 A c
619 621 $ hg update --clean
620 622 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
621 623
622 624 cp symlink file; hg cp -A symlink file (part2)
623 625 - copied symlink points to kw ignored file: do not overwrite
624 626
625 627 $ cat a > i
626 628 $ ln -s i symignored
627 629 $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
628 630 $ cp symignored x
629 631 $ hg copy --after --verbose symignored x
630 632 copying symignored to x
631 633 $ head -n 1 x
632 634 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
633 635 $ hg forget x
634 636 $ rm x
635 637
636 638 $ hg rollback
637 639 repository tip rolled back to revision 1 (undo commit)
638 640 working directory now based on revision 1
639 641 $ hg update --clean
640 642 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
641 643 $ rm i symignored
642 644
643 645 Custom keywordmaps as argument to kwdemo
644 646
645 647 $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
646 648 [extensions]
647 649 keyword =
648 650 [keyword]
649 651 ** =
650 652 b = ignore
651 653 demo.txt =
652 654 i = ignore
653 655 [keywordset]
654 656 svn = False
655 657 [keywordmaps]
656 658 Xinfo = {author}: {desc}
657 659 $Xinfo: test: hg keyword configuration and expansion example $
658 660
659 661 Configure custom keywordmaps
660 662
661 663 $ cat <<EOF >>$HGRCPATH
662 664 > [keywordmaps]
663 665 > Id = {file} {node|short} {date|rfc822date} {author|user}
664 666 > Xinfo = {author}: {desc}
665 667 > EOF
666 668
667 669 Cat and hg cat files before custom expansion
668 670
669 671 $ cat a b
670 672 expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
671 673 do not process $Id:
672 674 xxx $
673 675 ignore $Id$
674 676 $ hg cat sym a b && echo
675 677 expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
676 678 do not process $Id:
677 679 xxx $
678 680 ignore $Id$
679 681 a
680 682
681 683 Write custom keyword and prepare multiline commit message
682 684
683 685 $ echo '$Xinfo$' >> a
684 686 $ cat <<EOF >> log
685 687 > firstline
686 688 > secondline
687 689 > EOF
688 690
689 691 Interrupted commit should not change state
690 692
691 693 $ hg commit
692 694 abort: empty commit message
693 695 [255]
694 696 $ hg status
695 697 M a
696 698 ? c
697 699 ? log
698 700
699 701 Commit with multiline message and custom expansion
700 702
701 703 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
702 704 a
703 705 overwriting a expanding keywords
704 706 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
705 707 $ rm log
706 708
707 709 Stat, verify and show custom expansion (firstline)
708 710
709 711 $ hg status
710 712 ? c
711 713 $ hg verify
712 714 checking changesets
713 715 checking manifests
714 716 crosschecking files in changesets and manifests
715 717 checking files
716 718 3 files, 3 changesets, 4 total revisions
717 719 $ cat a b
718 720 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
719 721 do not process $Id:
720 722 xxx $
721 723 $Xinfo: User Name <user@example.com>: firstline $
722 724 ignore $Id$
723 725 $ hg cat sym a b && echo
724 726 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
725 727 do not process $Id:
726 728 xxx $
727 729 $Xinfo: User Name <user@example.com>: firstline $
728 730 ignore $Id$
729 731 a
730 732
731 733 annotate
732 734
733 735 $ hg annotate a
734 736 1: expand $Id$
735 737 1: do not process $Id:
736 738 1: xxx $
737 739 2: $Xinfo$
738 740
739 741 remove with status checks
740 742
741 743 $ hg debugrebuildstate
742 744 $ hg remove a
743 745 $ hg --debug commit -m rma
744 746 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
745 747 $ hg status
746 748 ? c
747 749
748 750 Rollback, revert, and check expansion
749 751
750 752 $ hg rollback
751 753 repository tip rolled back to revision 2 (undo commit)
752 754 working directory now based on revision 2
753 755 $ hg status
754 756 R a
755 757 ? c
756 758 $ hg revert --no-backup --rev tip a
757 759 $ cat a
758 760 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
759 761 do not process $Id:
760 762 xxx $
761 763 $Xinfo: User Name <user@example.com>: firstline $
762 764
763 765 Clone to test global and local configurations
764 766
765 767 $ cd ..
766 768
767 769 Expansion in destinaton with global configuration
768 770
769 771 $ hg --quiet clone Test globalconf
770 772 $ cat globalconf/a
771 773 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
772 774 do not process $Id:
773 775 xxx $
774 776 $Xinfo: User Name <user@example.com>: firstline $
775 777
776 778 No expansion in destination with local configuration in origin only
777 779
778 780 $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
779 781 $ cat localconf/a
780 782 expand $Id$
781 783 do not process $Id:
782 784 xxx $
783 785 $Xinfo$
784 786
785 787 Clone to test incoming
786 788
787 789 $ hg clone -r1 Test Test-a
788 790 adding changesets
789 791 adding manifests
790 792 adding file changes
791 793 added 2 changesets with 3 changes to 3 files
792 794 updating to branch default
793 795 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
794 796 $ cd Test-a
795 797 $ cat <<EOF >> .hg/hgrc
796 798 > [paths]
797 799 > default = ../Test
798 800 > EOF
799 801 $ hg incoming
800 802 comparing with $TESTTMP/Test
801 803 searching for changes
802 804 changeset: 2:bb948857c743
803 805 tag: tip
804 806 user: User Name <user@example.com>
805 807 date: Thu Jan 01 00:00:02 1970 +0000
806 808 summary: firstline
807 809
808 810 Imported patch should not be rejected
809 811
810 812 $ python -c \
811 813 > 'import re; s=re.sub("(Id.*)","\\1 rejecttest",open("a").read()); open("a","wb").write(s);'
812 814 $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
813 815 a
814 816 overwriting a expanding keywords
815 817 committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
816 818 $ hg export -o ../rejecttest.diff tip
817 819 $ cd ../Test
818 820 $ hg import ../rejecttest.diff
819 821 applying ../rejecttest.diff
820 822 $ cat a b
821 823 expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
822 824 do not process $Id: rejecttest
823 825 xxx $
824 826 $Xinfo: User Name <user@example.com>: rejects? $
825 827 ignore $Id$
826 828
827 829 $ hg rollback
828 830 repository tip rolled back to revision 2 (undo import)
829 831 working directory now based on revision 2
830 832 $ hg update --clean
831 833 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
832 834
833 835 kwexpand/kwshrink on selected files
834 836
835 837 $ mkdir x
836 838 $ hg copy a x/a
837 839 $ hg --verbose kwshrink a
838 840 overwriting a shrinking keywords
839 841 - sleep required for dirstate.normal() check
840 842 $ sleep 1
841 843 $ hg status a
842 844 $ hg --verbose kwexpand a
843 845 overwriting a expanding keywords
844 846 $ hg status a
845 847
846 848 kwexpand x/a should abort
847 849
848 850 $ hg --verbose kwexpand x/a
849 851 abort: outstanding uncommitted changes
850 852 [255]
851 853 $ cd x
852 854 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
853 855 x/a
854 856 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
855 857 overwriting x/a expanding keywords
856 858 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
857 859 $ cat a
858 860 expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
859 861 do not process $Id:
860 862 xxx $
861 863 $Xinfo: User Name <user@example.com>: xa $
862 864
863 865 kwshrink a inside directory x
864 866
865 867 $ hg --verbose kwshrink a
866 868 overwriting x/a shrinking keywords
867 869 $ cat a
868 870 expand $Id$
869 871 do not process $Id:
870 872 xxx $
871 873 $Xinfo$
872 874 $ cd ..
873 875
874 876 kwexpand nonexistent
875 877
876 878 $ hg kwexpand nonexistent
877 879 nonexistent:* (glob)
878 880
879 881
880 882 hg serve
881 883 - expand with hgweb file
882 884 - no expansion with hgweb annotate/changeset/filediff
883 885 - check errors
884 886
885 887 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
886 888 $ cat hg.pid >> $DAEMON_PIDS
887 889 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
888 890 200 Script output follows
889 891
890 892 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
891 893 do not process $Id:
892 894 xxx $
893 895 $Xinfo: User Name <user@example.com>: firstline $
894 896 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
895 897 200 Script output follows
896 898
897 899
898 900 user@1: expand $Id$
899 901 user@1: do not process $Id:
900 902 user@1: xxx $
901 903 user@2: $Xinfo$
902 904
903 905
904 906
905 907
906 908 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
907 909 200 Script output follows
908 910
909 911
910 912 # HG changeset patch
911 913 # User User Name <user@example.com>
912 914 # Date 3 0
913 915 # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
914 916 # Parent bb948857c743469b22bbf51f7ec8112279ca5d83
915 917 xa
916 918
917 919 diff -r bb948857c743 -r b4560182a3f9 x/a
918 920 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
919 921 +++ b/x/a Thu Jan 01 00:00:03 1970 +0000
920 922 @@ -0,0 +1,4 @@
921 923 +expand $Id$
922 924 +do not process $Id:
923 925 +xxx $
924 926 +$Xinfo$
925 927
926 928 $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
927 929 200 Script output follows
928 930
929 931
930 932 diff -r ef63ca68695b -r bb948857c743 a
931 933 --- a/a Thu Jan 01 00:00:00 1970 +0000
932 934 +++ b/a Thu Jan 01 00:00:02 1970 +0000
933 935 @@ -1,3 +1,4 @@
934 936 expand $Id$
935 937 do not process $Id:
936 938 xxx $
937 939 +$Xinfo$
938 940
939 941
940 942
941 943
942 944 $ cat errors.log
943 945
944 946 Prepare merge and resolve tests
945 947
946 948 $ echo '$Id$' > m
947 949 $ hg add m
948 950 $ hg commit -m 4kw
949 951 $ echo foo >> m
950 952 $ hg commit -m 5foo
951 953
952 954 simplemerge
953 955
954 956 $ hg update 4
955 957 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
956 958 $ echo foo >> m
957 959 $ hg commit -m 6foo
958 960 created new head
959 961 $ hg merge
960 962 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
961 963 (branch merge, don't forget to commit)
962 964 $ hg commit -m simplemerge
963 965 $ cat m
964 966 $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
965 967 foo
966 968
967 969 conflict: keyword should stay outside conflict zone
968 970
969 971 $ hg update 4
970 972 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
971 973 $ echo bar >> m
972 974 $ hg commit -m 8bar
973 975 created new head
974 976 $ hg merge
975 977 merging m
976 978 warning: conflicts during merge.
977 979 merging m failed!
978 980 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
979 981 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
980 982 [1]
981 983 $ cat m
982 984 $Id$
983 985 <<<<<<< local
984 986 bar
985 987 =======
986 988 foo
987 989 >>>>>>> other
988 990
989 991 resolve to local
990 992
991 993 $ HGMERGE=internal:local hg resolve -a
992 994 $ hg commit -m localresolve
993 995 $ cat m
994 996 $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
995 997 bar
996 998
997 999 Test restricted mode with transplant -b
998 1000
999 1001 $ hg update 6
1000 1002 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1001 1003 $ hg branch foo
1002 1004 marked working directory as branch foo
1003 1005 $ mv a a.bak
1004 1006 $ echo foobranch > a
1005 1007 $ cat a.bak >> a
1006 1008 $ rm a.bak
1007 1009 $ hg commit -m 9foobranch
1008 1010 $ hg update default
1009 1011 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1010 1012 $ hg -y transplant -b foo tip
1011 1013 applying 4aa30d025d50
1012 1014 4aa30d025d50 transplanted to e00abbf63521
1013 1015
1014 1016 Expansion in changeset but not in file
1015 1017
1016 1018 $ hg tip -p
1017 1019 changeset: 11:e00abbf63521
1018 1020 tag: tip
1019 1021 parent: 9:800511b3a22d
1020 1022 user: test
1021 1023 date: Thu Jan 01 00:00:00 1970 +0000
1022 1024 summary: 9foobranch
1023 1025
1024 1026 diff -r 800511b3a22d -r e00abbf63521 a
1025 1027 --- a/a Thu Jan 01 00:00:00 1970 +0000
1026 1028 +++ b/a Thu Jan 01 00:00:00 1970 +0000
1027 1029 @@ -1,3 +1,4 @@
1028 1030 +foobranch
1029 1031 expand $Id$
1030 1032 do not process $Id:
1031 1033 xxx $
1032 1034
1033 1035 $ head -n 2 a
1034 1036 foobranch
1035 1037 expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
1036 1038
1037 1039 Turn off expansion
1038 1040
1039 1041 $ hg -q rollback
1040 1042 $ hg -q update -C
1041 1043
1042 1044 kwshrink with unknown file u
1043 1045
1044 1046 $ cp a u
1045 1047 $ hg --verbose kwshrink
1046 1048 overwriting a shrinking keywords
1047 1049 overwriting m shrinking keywords
1048 1050 overwriting x/a shrinking keywords
1049 1051
1050 1052 Keywords shrunk in working directory, but not yet disabled
1051 1053 - cat shows unexpanded keywords
1052 1054 - hg cat shows expanded keywords
1053 1055
1054 1056 $ cat a b
1055 1057 expand $Id$
1056 1058 do not process $Id:
1057 1059 xxx $
1058 1060 $Xinfo$
1059 1061 ignore $Id$
1060 1062 $ hg cat sym a b && echo
1061 1063 expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
1062 1064 do not process $Id:
1063 1065 xxx $
1064 1066 $Xinfo: User Name <user@example.com>: firstline $
1065 1067 ignore $Id$
1066 1068 a
1067 1069
1068 1070 Now disable keyword expansion
1069 1071
1070 1072 $ rm "$HGRCPATH"
1071 1073 $ cat a b
1072 1074 expand $Id$
1073 1075 do not process $Id:
1074 1076 xxx $
1075 1077 $Xinfo$
1076 1078 ignore $Id$
1077 1079 $ hg cat sym a b && echo
1078 1080 expand $Id$
1079 1081 do not process $Id:
1080 1082 xxx $
1081 1083 $Xinfo$
1082 1084 ignore $Id$
1083 1085 a
@@ -1,842 +1,844
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ cat >> $HGRCPATH <<EOF
2 4 > [extensions]
3 5 > largefiles=
4 6 > purge=
5 7 > rebase=
6 8 > transplant=
7 9 > [largefiles]
8 10 > minsize=2
9 11 > patterns=glob:**.dat
10 12 > EOF
11 13
12 14 Create the repo with a couple of revisions of both large and normal
13 15 files, testing that status correctly shows largefiles.
14 16
15 17 $ hg init a
16 18 $ cd a
17 19 $ mkdir sub
18 20 $ echo normal1 > normal1
19 21 $ echo normal2 > sub/normal2
20 22 $ echo large1 > large1
21 23 $ echo large2 > sub/large2
22 24 $ hg add normal1 sub/normal2
23 25 $ hg add --large large1 sub/large2
24 26 $ hg commit -m "add files"
25 27 $ echo normal11 > normal1
26 28 $ echo normal22 > sub/normal2
27 29 $ echo large11 > large1
28 30 $ echo large22 > sub/large2
29 31 $ hg st
30 32 M large1
31 33 M normal1
32 34 M sub/large2
33 35 M sub/normal2
34 36 $ hg commit -m "edit files"
35 37
36 38 Commit preserved largefile contents.
37 39
38 40 $ cat normal1
39 41 normal11
40 42 $ cat large1
41 43 large11
42 44 $ cat sub/normal2
43 45 normal22
44 46 $ cat sub/large2
45 47 large22
46 48
47 49 Remove both largefiles and normal files.
48 50
49 51 $ hg remove normal1 large1
50 52 $ hg commit -m "remove files"
51 53 $ ls
52 54 sub
53 55
54 56 Copy both largefiles and normal files.
55 57
56 58 $ hg cp sub/normal2 normal1
57 59 $ hg cp sub/large2 large1
58 60 $ hg commit -m "copy files"
59 61 $ cat normal1
60 62 normal22
61 63 $ cat large1
62 64 large22
63 65
64 66 Test moving largefiles and verify that normal files are also unaffected.
65 67
66 68 $ hg mv normal1 normal3
67 69 $ hg mv large1 large3
68 70 $ hg mv sub/normal2 sub/normal4
69 71 $ hg mv sub/large2 sub/large4
70 72 $ hg commit -m "move files"
71 73 $ cat normal3
72 74 normal22
73 75 $ cat large3
74 76 large22
75 77 $ cat sub/normal4
76 78 normal22
77 79 $ cat sub/large4
78 80 large22
79 81
80 82 Test archiving the various revisions. These hit corner cases known with
81 83 archiving.
82 84
83 85 $ hg archive -r 0 ../archive0
84 86 $ hg archive -r 1 ../archive1
85 87 $ hg archive -r 2 ../archive2
86 88 $ hg archive -r 3 ../archive3
87 89 $ hg archive -r 4 ../archive4
88 90 $ cd ../archive0
89 91 $ cat normal1
90 92 normal1
91 93 $ cat large1
92 94 large1
93 95 $ cat sub/normal2
94 96 normal2
95 97 $ cat sub/large2
96 98 large2
97 99 $ cd ../archive1
98 100 $ cat normal1
99 101 normal11
100 102 $ cat large1
101 103 large11
102 104 $ cat sub/normal2
103 105 normal22
104 106 $ cat sub/large2
105 107 large22
106 108 $ cd ../archive2
107 109 $ ls
108 110 sub
109 111 $ cat sub/normal2
110 112 normal22
111 113 $ cat sub/large2
112 114 large22
113 115 $ cd ../archive3
114 116 $ cat normal1
115 117 normal22
116 118 $ cat large1
117 119 large22
118 120 $ cat sub/normal2
119 121 normal22
120 122 $ cat sub/large2
121 123 large22
122 124 $ cd ../archive4
123 125 $ cat normal3
124 126 normal22
125 127 $ cat large3
126 128 large22
127 129 $ cat sub/normal4
128 130 normal22
129 131 $ cat sub/large4
130 132 large22
131 133
132 134 Commit corner case: specify files to commit.
133 135
134 136 $ cd ../a
135 137 $ echo normal3 > normal3
136 138 $ echo large3 > large3
137 139 $ echo normal4 > sub/normal4
138 140 $ echo large4 > sub/large4
139 141 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
140 142 $ cat normal3
141 143 normal3
142 144 $ cat large3
143 145 large3
144 146 $ cat sub/normal4
145 147 normal4
146 148 $ cat sub/large4
147 149 large4
148 150
149 151 One more commit corner case: commit from a subdirectory.
150 152
151 153 $ cd ../a
152 154 $ echo normal33 > normal3
153 155 $ echo large33 > large3
154 156 $ echo normal44 > sub/normal4
155 157 $ echo large44 > sub/large4
156 158 $ cd sub
157 159 $ hg commit -m "edit files yet again"
158 160 $ cat ../normal3
159 161 normal33
160 162 $ cat ../large3
161 163 large33
162 164 $ cat normal4
163 165 normal44
164 166 $ cat large4
165 167 large44
166 168
167 169 Committing standins is not allowed.
168 170
169 171 $ cd ..
170 172 $ echo large3 > large3
171 173 $ hg commit .hglf/large3 -m "try to commit standin"
172 174 abort: file ".hglf/large3" is a largefile standin
173 175 (commit the largefile itself instead)
174 176 [255]
175 177
176 178 Corner cases for adding largefiles.
177 179
178 180 $ echo large5 > large5
179 181 $ hg add --large large5
180 182 $ hg add --large large5
181 183 large5 already a largefile
182 184 $ mkdir sub2
183 185 $ echo large6 > sub2/large6
184 186 $ echo large7 > sub2/large7
185 187 $ hg add --large sub2
186 188 adding sub2/large6 as a largefile
187 189 adding sub2/large7 as a largefile
188 190 $ hg st
189 191 M large3
190 192 A large5
191 193 A sub2/large6
192 194 A sub2/large7
193 195
194 196 Config settings (pattern **.dat, minsize 2 MB) are respected.
195 197
196 198 $ echo testdata > test.dat
197 199 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
198 200 $ hg add
199 201 adding reallylarge as a largefile
200 202 adding test.dat as a largefile
201 203
202 204 Test that minsize and --lfsize handle float values;
203 205 also tests that --lfsize overrides largefiles.minsize.
204 206 (0.250 MB = 256 kB = 262144 B)
205 207
206 208 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
207 209 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
208 210 $ hg --config largefiles.minsize=.25 add
209 211 adding ratherlarge as a largefile
210 212 adding medium
211 213 $ hg forget medium
212 214 $ hg --config largefiles.minsize=.25 add --lfsize=.125
213 215 adding medium as a largefile
214 216 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
215 217 $ hg --config largefiles.minsize=.25 add --lfsize=.125
216 218 adding notlarge
217 219 $ hg forget notlarge
218 220
219 221 Test forget on largefiles.
220 222
221 223 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
222 224 $ hg st
223 225 A sub2/large6
224 226 A sub2/large7
225 227 R large3
226 228 ? large5
227 229 ? medium
228 230 ? notlarge
229 231 ? ratherlarge
230 232 ? reallylarge
231 233 ? test.dat
232 234 $ hg commit -m "add/edit more largefiles"
233 235 $ hg st
234 236 ? large3
235 237 ? large5
236 238 ? medium
237 239 ? notlarge
238 240 ? ratherlarge
239 241 ? reallylarge
240 242 ? test.dat
241 243
242 244 Purge with largefiles: verify that largefiles are still in the working
243 245 dir after a purge.
244 246
245 247 $ hg purge --all
246 248 $ cat sub/large4
247 249 large44
248 250 $ cat sub2/large6
249 251 large6
250 252 $ cat sub2/large7
251 253 large7
252 254
253 255 Clone a largefiles repo.
254 256
255 257 $ cd ..
256 258 $ hg clone a b
257 259 updating to branch default
258 260 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 261 getting changed largefiles
260 262 3 largefiles updated, 0 removed
261 263 $ cd b
262 264 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
263 265 7:daea875e9014 add/edit more largefiles
264 266 6:4355d653f84f edit files yet again
265 267 5:9d5af5072dbd edit files again
266 268 4:74c02385b94c move files
267 269 3:9e8fbc4bce62 copy files
268 270 2:51a0ae4d5864 remove files
269 271 1:ce8896473775 edit files
270 272 0:30d30fe6a5be add files
271 273 $ cat normal3
272 274 normal33
273 275 $ cat sub/normal4
274 276 normal44
275 277 $ cat sub/large4
276 278 large44
277 279 $ cat sub2/large6
278 280 large6
279 281 $ cat sub2/large7
280 282 large7
281 283 $ cd ..
282 284 $ hg clone a -r 3 c
283 285 adding changesets
284 286 adding manifests
285 287 adding file changes
286 288 added 4 changesets with 10 changes to 4 files
287 289 updating to branch default
288 290 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 291 getting changed largefiles
290 292 2 largefiles updated, 0 removed
291 293 $ cd c
292 294 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
293 295 3:9e8fbc4bce62 copy files
294 296 2:51a0ae4d5864 remove files
295 297 1:ce8896473775 edit files
296 298 0:30d30fe6a5be add files
297 299 $ cat normal1
298 300 normal22
299 301 $ cat large1
300 302 large22
301 303 $ cat sub/normal2
302 304 normal22
303 305 $ cat sub/large2
304 306 large22
305 307
306 308 Old revisions of a clone have correct largefiles content (this also
307 309 tests update).
308 310
309 311 $ hg update -r 1
310 312 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 313 getting changed largefiles
312 314 1 largefiles updated, 0 removed
313 315 $ cat large1
314 316 large11
315 317 $ cat sub/large2
316 318 large22
317 319
318 320 Rebasing between two repositories does not revert largefiles to old
319 321 revisions (this was a very bad bug that took a lot of work to fix).
320 322
321 323 $ cd ..
322 324 $ hg clone a d
323 325 updating to branch default
324 326 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 327 getting changed largefiles
326 328 3 largefiles updated, 0 removed
327 329 $ cd b
328 330 $ echo large4-modified > sub/large4
329 331 $ echo normal3-modified > normal3
330 332 $ hg commit -m "modify normal file and largefile in repo b"
331 333 $ cd ../d
332 334 $ echo large6-modified > sub2/large6
333 335 $ echo normal4-modified > sub/normal4
334 336 $ hg commit -m "modify normal file largefile in repo d"
335 337 $ cd ..
336 338 $ hg clone d e
337 339 updating to branch default
338 340 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
339 341 getting changed largefiles
340 342 3 largefiles updated, 0 removed
341 343 $ cd d
342 344 $ hg pull --rebase ../b
343 345 pulling from ../b
344 346 searching for changes
345 347 adding changesets
346 348 adding manifests
347 349 adding file changes
348 350 added 1 changesets with 2 changes to 2 files (+1 heads)
349 351 getting changed largefiles
350 352 1 largefiles updated, 0 removed
351 353 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg
352 354 nothing to rebase
353 355 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
354 356 9:598410d3eb9a modify normal file largefile in repo d
355 357 8:a381d2c8c80e modify normal file and largefile in repo b
356 358 7:daea875e9014 add/edit more largefiles
357 359 6:4355d653f84f edit files yet again
358 360 5:9d5af5072dbd edit files again
359 361 4:74c02385b94c move files
360 362 3:9e8fbc4bce62 copy files
361 363 2:51a0ae4d5864 remove files
362 364 1:ce8896473775 edit files
363 365 0:30d30fe6a5be add files
364 366 $ cat normal3
365 367 normal3-modified
366 368 $ cat sub/normal4
367 369 normal4-modified
368 370 $ cat sub/large4
369 371 large4-modified
370 372 $ cat sub2/large6
371 373 large6-modified
372 374 $ cat sub2/large7
373 375 large7
374 376 $ cd ../e
375 377 $ hg pull ../b
376 378 pulling from ../b
377 379 searching for changes
378 380 adding changesets
379 381 adding manifests
380 382 adding file changes
381 383 added 1 changesets with 2 changes to 2 files (+1 heads)
382 384 (run 'hg heads' to see heads, 'hg merge' to merge)
383 385 $ hg rebase
384 386 getting changed largefiles
385 387 1 largefiles updated, 0 removed
386 388 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg
387 389 $ hg log
388 390 changeset: 9:598410d3eb9a
389 391 tag: tip
390 392 user: test
391 393 date: Thu Jan 01 00:00:00 1970 +0000
392 394 summary: modify normal file largefile in repo d
393 395
394 396 changeset: 8:a381d2c8c80e
395 397 user: test
396 398 date: Thu Jan 01 00:00:00 1970 +0000
397 399 summary: modify normal file and largefile in repo b
398 400
399 401 changeset: 7:daea875e9014
400 402 user: test
401 403 date: Thu Jan 01 00:00:00 1970 +0000
402 404 summary: add/edit more largefiles
403 405
404 406 changeset: 6:4355d653f84f
405 407 user: test
406 408 date: Thu Jan 01 00:00:00 1970 +0000
407 409 summary: edit files yet again
408 410
409 411 changeset: 5:9d5af5072dbd
410 412 user: test
411 413 date: Thu Jan 01 00:00:00 1970 +0000
412 414 summary: edit files again
413 415
414 416 changeset: 4:74c02385b94c
415 417 user: test
416 418 date: Thu Jan 01 00:00:00 1970 +0000
417 419 summary: move files
418 420
419 421 changeset: 3:9e8fbc4bce62
420 422 user: test
421 423 date: Thu Jan 01 00:00:00 1970 +0000
422 424 summary: copy files
423 425
424 426 changeset: 2:51a0ae4d5864
425 427 user: test
426 428 date: Thu Jan 01 00:00:00 1970 +0000
427 429 summary: remove files
428 430
429 431 changeset: 1:ce8896473775
430 432 user: test
431 433 date: Thu Jan 01 00:00:00 1970 +0000
432 434 summary: edit files
433 435
434 436 changeset: 0:30d30fe6a5be
435 437 user: test
436 438 date: Thu Jan 01 00:00:00 1970 +0000
437 439 summary: add files
438 440
439 441 $ cat normal3
440 442 normal3-modified
441 443 $ cat sub/normal4
442 444 normal4-modified
443 445 $ cat sub/large4
444 446 large4-modified
445 447 $ cat sub2/large6
446 448 large6-modified
447 449 $ cat sub2/large7
448 450 large7
449 451
450 452 Rollback on largefiles.
451 453
452 454 $ echo large4-modified-again > sub/large4
453 455 $ hg commit -m "Modify large4 again"
454 456 $ hg rollback
455 457 repository tip rolled back to revision 9 (undo commit)
456 458 working directory now based on revision 9
457 459 $ hg st
458 460 M sub/large4
459 461 $ hg log
460 462 changeset: 9:598410d3eb9a
461 463 tag: tip
462 464 user: test
463 465 date: Thu Jan 01 00:00:00 1970 +0000
464 466 summary: modify normal file largefile in repo d
465 467
466 468 changeset: 8:a381d2c8c80e
467 469 user: test
468 470 date: Thu Jan 01 00:00:00 1970 +0000
469 471 summary: modify normal file and largefile in repo b
470 472
471 473 changeset: 7:daea875e9014
472 474 user: test
473 475 date: Thu Jan 01 00:00:00 1970 +0000
474 476 summary: add/edit more largefiles
475 477
476 478 changeset: 6:4355d653f84f
477 479 user: test
478 480 date: Thu Jan 01 00:00:00 1970 +0000
479 481 summary: edit files yet again
480 482
481 483 changeset: 5:9d5af5072dbd
482 484 user: test
483 485 date: Thu Jan 01 00:00:00 1970 +0000
484 486 summary: edit files again
485 487
486 488 changeset: 4:74c02385b94c
487 489 user: test
488 490 date: Thu Jan 01 00:00:00 1970 +0000
489 491 summary: move files
490 492
491 493 changeset: 3:9e8fbc4bce62
492 494 user: test
493 495 date: Thu Jan 01 00:00:00 1970 +0000
494 496 summary: copy files
495 497
496 498 changeset: 2:51a0ae4d5864
497 499 user: test
498 500 date: Thu Jan 01 00:00:00 1970 +0000
499 501 summary: remove files
500 502
501 503 changeset: 1:ce8896473775
502 504 user: test
503 505 date: Thu Jan 01 00:00:00 1970 +0000
504 506 summary: edit files
505 507
506 508 changeset: 0:30d30fe6a5be
507 509 user: test
508 510 date: Thu Jan 01 00:00:00 1970 +0000
509 511 summary: add files
510 512
511 513 $ cat sub/large4
512 514 large4-modified-again
513 515
514 516 "update --check" refuses to update with uncommitted changes.
515 517 $ hg update --check 8
516 518 abort: uncommitted local changes
517 519 [255]
518 520
519 521 "update --clean" leaves correct largefiles in working copy.
520 522
521 523 $ hg update --clean
522 524 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 525 getting changed largefiles
524 526 1 largefiles updated, 0 removed
525 527 $ cat normal3
526 528 normal3-modified
527 529 $ cat sub/normal4
528 530 normal4-modified
529 531 $ cat sub/large4
530 532 large4-modified
531 533 $ cat sub2/large6
532 534 large6-modified
533 535 $ cat sub2/large7
534 536 large7
535 537
536 538 Now "update check" is happy.
537 539 $ hg update --check 8
538 540 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
539 541 getting changed largefiles
540 542 1 largefiles updated, 0 removed
541 543 $ hg update --check
542 544 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
543 545 getting changed largefiles
544 546 1 largefiles updated, 0 removed
545 547
546 548 "revert" works on largefiles (and normal files too).
547 549 $ echo hack3 >> normal3
548 550 $ echo hack4 >> sub/normal4
549 551 $ echo hack4 >> sub/large4
550 552 $ hg rm sub2/large6
551 553 $ echo new >> sub2/large8
552 554 $ hg add --large sub2/large8
553 555 # XXX we don't really want to report that we're reverting the standin;
554 556 # that's just an implementation detail. But I don't see an obvious fix. ;-(
555 557 $ hg revert sub
556 558 reverting .hglf/sub/large4
557 559 reverting sub/normal4
558 560 $ hg status
559 561 M normal3
560 562 A sub2/large8
561 563 R sub2/large6
562 564 ? sub/large4.orig
563 565 ? sub/normal4.orig
564 566 $ cat sub/normal4
565 567 normal4-modified
566 568 $ cat sub/large4
567 569 large4-modified
568 570 $ hg revert -a --no-backup
569 571 undeleting .hglf/sub2/large6
570 572 forgetting .hglf/sub2/large8
571 573 reverting normal3
572 574 $ hg status
573 575 ? sub/large4.orig
574 576 ? sub/normal4.orig
575 577 ? sub2/large8
576 578 $ cat normal3
577 579 normal3-modified
578 580 $ cat sub2/large6
579 581 large6-modified
580 582 $ rm sub/*.orig sub2/large8
581 583
582 584 revert some files to an older revision
583 585 $ hg revert --no-backup -r 8 sub2
584 586 reverting .hglf/sub2/large6
585 587 $ cat sub2/large6
586 588 large6
587 589 $ hg revert --no-backup sub2
588 590 reverting .hglf/sub2/large6
589 591 $ hg status
590 592
591 593 "verify --large" actually verifies largefiles
592 594
593 595 $ hg verify --large
594 596 checking changesets
595 597 checking manifests
596 598 crosschecking files in changesets and manifests
597 599 checking files
598 600 10 files, 10 changesets, 28 total revisions
599 601 searching 1 changesets for largefiles
600 602 verified existence of 3 revisions of 3 largefiles
601 603
602 604 Merging does not revert to old versions of largefiles (this has also
603 605 been very problematic).
604 606
605 607 $ cd ..
606 608 $ hg clone -r 7 e f
607 609 adding changesets
608 610 adding manifests
609 611 adding file changes
610 612 added 8 changesets with 24 changes to 10 files
611 613 updating to branch default
612 614 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
613 615 getting changed largefiles
614 616 3 largefiles updated, 0 removed
615 617 $ cd f
616 618 $ echo "large4-merge-test" > sub/large4
617 619 $ hg commit -m "Modify large4 to test merge"
618 620 $ hg pull ../e
619 621 pulling from ../e
620 622 searching for changes
621 623 adding changesets
622 624 adding manifests
623 625 adding file changes
624 626 added 2 changesets with 4 changes to 4 files (+1 heads)
625 627 (run 'hg heads' to see heads, 'hg merge' to merge)
626 628 $ hg merge
627 629 merging sub/large4
628 630 largefile sub/large4 has a merge conflict
629 631 keep (l)ocal or take (o)ther? l
630 632 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
631 633 (branch merge, don't forget to commit)
632 634 getting changed largefiles
633 635 1 largefiles updated, 0 removed
634 636 $ hg commit -m "Merge repos e and f"
635 637 $ cat normal3
636 638 normal3-modified
637 639 $ cat sub/normal4
638 640 normal4-modified
639 641 $ cat sub/large4
640 642 large4-merge-test
641 643 $ cat sub2/large6
642 644 large6-modified
643 645 $ cat sub2/large7
644 646 large7
645 647
646 648 Test that a normal file and a largefile with the same name and path cannot
647 649 coexist.
648 650
649 651 $ rm sub2/large7
650 652 $ echo "largeasnormal" > sub2/large7
651 653 $ hg add sub2/large7
652 654 sub2/large7 already a largefile
653 655
654 656 Test that transplanting a largefile change works correctly.
655 657
656 658 $ cd ..
657 659 $ hg clone -r 8 d g
658 660 adding changesets
659 661 adding manifests
660 662 adding file changes
661 663 added 9 changesets with 26 changes to 10 files
662 664 updating to branch default
663 665 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 666 getting changed largefiles
665 667 3 largefiles updated, 0 removed
666 668 $ cd g
667 669 $ hg transplant -s ../d 598410d3eb9a
668 670 searching for changes
669 671 searching for changes
670 672 adding changesets
671 673 adding manifests
672 674 adding file changes
673 675 added 1 changesets with 2 changes to 2 files
674 676 getting changed largefiles
675 677 1 largefiles updated, 0 removed
676 678 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
677 679 9:598410d3eb9a modify normal file largefile in repo d
678 680 8:a381d2c8c80e modify normal file and largefile in repo b
679 681 7:daea875e9014 add/edit more largefiles
680 682 6:4355d653f84f edit files yet again
681 683 5:9d5af5072dbd edit files again
682 684 4:74c02385b94c move files
683 685 3:9e8fbc4bce62 copy files
684 686 2:51a0ae4d5864 remove files
685 687 1:ce8896473775 edit files
686 688 0:30d30fe6a5be add files
687 689 $ cat normal3
688 690 normal3-modified
689 691 $ cat sub/normal4
690 692 normal4-modified
691 693 $ cat sub/large4
692 694 large4-modified
693 695 $ cat sub2/large6
694 696 large6-modified
695 697 $ cat sub2/large7
696 698 large7
697 699 $ cd ..
698 700
699 701 vanilla clients not locked out from largefiles servers on vanilla repos
700 702 $ mkdir r1
701 703 $ cd r1
702 704 $ hg init
703 705 $ echo c1 > f1
704 706 $ hg add f1
705 707 $ hg com -m "m1"
706 708 $ cd ..
707 709 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
708 710 $ cat hg.pid >> $DAEMON_PIDS
709 711 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
710 712 requesting all changes
711 713 adding changesets
712 714 adding manifests
713 715 adding file changes
714 716 added 1 changesets with 1 changes to 1 files
715 717 updating to branch default
716 718 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
717 719
718 720 largefiles clients still work with vanilla servers
719 721 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
720 722 $ cat hg.pid >> $DAEMON_PIDS
721 723 $ hg clone http://localhost:$HGPORT1 r3
722 724 requesting all changes
723 725 adding changesets
724 726 adding manifests
725 727 adding file changes
726 728 added 1 changesets with 1 changes to 1 files
727 729 updating to branch default
728 730 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
729 731
730 732 vanilla clients locked out from largefiles http repos
731 733 $ mkdir r4
732 734 $ cd r4
733 735 $ hg init
734 736 $ echo c1 > f1
735 737 $ hg add --large f1
736 738 $ hg com -m "m1"
737 739 $ cd ..
738 740 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
739 741 $ cat hg.pid >> $DAEMON_PIDS
740 742 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
741 743 abort: remote error:
742 744
743 745 This repository uses the largefiles extension.
744 746
745 747 Please enable it in your Mercurial config file.
746 748 [255]
747 749
748 750 used all HGPORTs, kill all daemons
749 751 $ "$TESTDIR/killdaemons.py"
750 752
751 753 vanilla clients locked out from largefiles ssh repos
752 754 $ hg --config extensions.largefiles=! clone -e "python $TESTDIR/dummyssh" ssh://user@dummy/r4 r5
753 755 abort: remote error:
754 756
755 757 This repository uses the largefiles extension.
756 758
757 759 Please enable it in your Mercurial config file.
758 760 [255]
759 761
760 762 largefiles clients refuse to push largefiles repos to vanilla servers
761 763 $ mkdir r6
762 764 $ cd r6
763 765 $ hg init
764 766 $ echo c1 > f1
765 767 $ hg add f1
766 768 $ hg com -m "m1"
767 769 $ cat >> .hg/hgrc <<!
768 770 > [web]
769 771 > push_ssl = false
770 772 > allow_push = *
771 773 > !
772 774 $ cd ..
773 775 $ hg clone r6 r7
774 776 updating to branch default
775 777 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
776 778 $ cd r7
777 779 $ echo c2 > f2
778 780 $ hg add --large f2
779 781 $ hg com -m "m2"
780 782 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
781 783 $ cat ../hg.pid >> $DAEMON_PIDS
782 784 $ hg push http://localhost:$HGPORT
783 785 pushing to http://localhost:$HGPORT/
784 786 searching for changes
785 787 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
786 788 [255]
787 789 $ cd ..
788 790
789 791 $ cd ..
790 792
791 793 Clone a local repository owned by another user
792 794 We have to simulate that here by setting $HOME and removing write permissions
793 795 $ ORIGHOME="$HOME"
794 796 $ mkdir alice
795 797 $ HOME="`pwd`/alice"
796 798 $ cd alice
797 799 $ hg init pubrepo
798 800 $ cd pubrepo
799 801 $ dd if=/dev/urandom bs=1k count=11k > a-large-file 2> /dev/null
800 802 $ hg add --large a-large-file
801 803 $ hg commit -m "Add a large file"
802 804 $ cd ..
803 805 $ chmod -R a-w pubrepo
804 806 $ cd ..
805 807 $ mkdir bob
806 808 $ HOME="`pwd`/bob"
807 809 $ cd bob
808 810 $ hg clone --pull ../alice/pubrepo pubrepo
809 811 requesting all changes
810 812 adding changesets
811 813 adding manifests
812 814 adding file changes
813 815 added 1 changesets with 1 changes to 1 files
814 816 updating to branch default
815 817 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
816 818 getting changed largefiles
817 819 1 largefiles updated, 0 removed
818 820 $ cd ..
819 821 $ HOME="$ORIGHOME"
820 822
821 823 Symlink to a large largefile should behave the same as a symlink to a normal file
822 824 $ hg init largesymlink
823 825 $ cd largesymlink
824 826 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
825 827 $ hg add --large largefile
826 828 $ hg commit -m "commit a large file"
827 829 $ ln -s largefile largelink
828 830 $ hg add largelink
829 831 $ hg commit -m "commit a large symlink"
830 832 $ rm -f largelink
831 833 $ hg up >/dev/null
832 834 $ test -f largelink
833 835 [1]
834 836 $ test -L largelink
835 837 [1]
836 838 $ rm -f largelink # make next part of the test independent of the previous
837 839 $ hg up -C >/dev/null
838 840 $ test -f largelink
839 841 $ test -L largelink
840 842 $ cd ..
841 843
842 844
@@ -1,69 +1,71
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 Source bundle was generated with the following script:
2 4
3 5 # hg init
4 6 # echo a > a
5 7 # ln -s a l
6 8 # hg ci -Ama -d'0 0'
7 9 # mkdir b
8 10 # echo a > b/a
9 11 # chmod +x b/a
10 12 # hg ci -Amb -d'1 0'
11 13
12 14 $ hg init
13 15 $ hg -q pull "$TESTDIR/bundles/test-manifest.hg"
14 16
15 17 The next call is expected to return nothing:
16 18
17 19 $ hg manifest
18 20
19 21 $ hg co
20 22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 23
22 24 $ hg manifest
23 25 a
24 26 b/a
25 27 l
26 28
27 29 $ hg manifest -v
28 30 644 a
29 31 755 * b/a
30 32 644 @ l
31 33
32 34 $ hg manifest --debug
33 35 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a
34 36 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a
35 37 047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l
36 38
37 39 $ hg manifest -r 0
38 40 a
39 41 l
40 42
41 43 $ hg manifest -r 1
42 44 a
43 45 b/a
44 46 l
45 47
46 48 $ hg manifest -r tip
47 49 a
48 50 b/a
49 51 l
50 52
51 53 $ hg manifest tip
52 54 a
53 55 b/a
54 56 l
55 57
56 58 $ hg manifest --all
57 59 a
58 60 b/a
59 61 l
60 62
61 63 The next two calls are expected to abort:
62 64
63 65 $ hg manifest -r 2
64 66 abort: unknown revision '2'!
65 67 [255]
66 68
67 69 $ hg manifest -r tip tip
68 70 abort: please specify just one revision
69 71 [255]
@@ -1,62 +1,63
1 $ "$TESTDIR/hghave" symlink || exit 80
1 2
2 3 $ cat > echo.py <<EOF
3 4 > #!/usr/bin/env python
4 5 > import os, sys
5 6 > try:
6 7 > import msvcrt
7 8 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
8 9 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
9 10 > except ImportError:
10 11 > pass
11 12 >
12 13 > for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
13 14 > print k, os.environ[k]
14 15 > EOF
15 16
16 17 Create 2 heads containing the same file, once as
17 18 a file, once as a link. Bundle was generated with:
18 19
19 20 # hg init t
20 21 # cd t
21 22 # echo a > a
22 23 # hg ci -qAm t0 -d '0 0'
23 24 # echo l > l
24 25 # hg ci -qAm t1 -d '1 0'
25 26 # hg up -C 0
26 27 # ln -s a l
27 28 # hg ci -qAm t2 -d '2 0'
28 29 # echo l2 > l2
29 30 # hg ci -qAm t3 -d '3 0'
30 31
31 32 $ hg init t
32 33 $ cd t
33 34 $ hg -q pull "$TESTDIR/bundles/test-merge-symlinks.hg"
34 35 $ hg up -C 3
35 36 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 37
37 38 Merge them and display *_ISLINK vars
38 39 merge heads
39 40
40 41 $ hg merge --tool="python ../echo.py"
41 42 merging l
42 43 HG_FILE l
43 44 HG_MY_ISLINK 1
44 45 HG_OTHER_ISLINK 0
45 46 HG_BASE_ISLINK 0
46 47 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
47 48 (branch merge, don't forget to commit)
48 49
49 50 Test working directory symlink bit calculation wrt copies,
50 51 especially on non-supporting systems.
51 52 merge working directory
52 53
53 54 $ hg up -C 2
54 55 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 56 $ hg copy l l2
56 57 $ HGMERGE="python ../echo.py" hg up 3
57 58 merging l2
58 59 HG_FILE l2
59 60 HG_MY_ISLINK 1
60 61 HG_OTHER_ISLINK 0
61 62 HG_BASE_ISLINK 0
62 63 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -1,70 +1,72
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ hg init
2 4
3 5 $ echo a > a
4 6 $ hg ci -Amadd
5 7 adding a
6 8
7 9 $ chmod +x a
8 10 $ hg ci -mexecutable
9 11
10 12 $ hg up 0
11 13 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 14 $ rm a
13 15 $ ln -s symlink a
14 16 $ hg ci -msymlink
15 17 created new head
16 18
17 19 $ hg merge --debug
18 20 searching for copies back to rev 1
19 21 resolving manifests
20 22 overwrite None partial False
21 23 ancestor c334dc3be0da local 521a1e40188f+ remote 3574f3e69b1c
22 24 conflicting flags for a
23 25 (n)one, e(x)ec or sym(l)ink? n
24 26 a: update permissions -> e
25 27 updating: a 1/1 files (100.00%)
26 28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 29 (branch merge, don't forget to commit)
28 30
29 31
30 32 Symlink is local parent, executable is other:
31 33
32 34 $ if [ -h a ]; then
33 35 > echo a is a symlink
34 36 > $TESTDIR/readlink.py a
35 37 > elif [ -x a ]; then
36 38 > echo a is executable
37 39 > else
38 40 > echo "a has no flags (default for conflicts)"
39 41 > fi
40 42 a has no flags (default for conflicts)
41 43
42 44 $ hg update -C 1
43 45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 46
45 47 $ hg merge --debug
46 48 searching for copies back to rev 1
47 49 resolving manifests
48 50 overwrite None partial False
49 51 ancestor c334dc3be0da local 3574f3e69b1c+ remote 521a1e40188f
50 52 conflicting flags for a
51 53 (n)one, e(x)ec or sym(l)ink? n
52 54 a: remote is newer -> g
53 55 updating: a 1/1 files (100.00%)
54 56 getting a
55 57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
56 58 (branch merge, don't forget to commit)
57 59
58 60
59 61 Symlink is other parent, executable is local:
60 62
61 63 $ if [ -h a ]; then
62 64 > echo a is a symlink
63 65 > $TESTDIR/readlink.py a
64 66 > elif [ -x a ]; then
65 67 > echo a is executable
66 68 > else
67 69 > echo "a has no flags (default for conflicts)"
68 70 > fi
69 71 a has no flags (default for conflicts)
70 72
@@ -1,635 +1,637
1 $ "$TESTDIR/hghave" symlink || exit 80
2
1 3 $ hg init
2 4 $ mkdir d1 d1/d11 d2
3 5 $ echo d1/a > d1/a
4 6 $ echo d1/ba > d1/ba
5 7 $ echo d1/a1 > d1/d11/a1
6 8 $ echo d1/b > d1/b
7 9 $ echo d2/b > d2/b
8 10 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 11 $ hg commit -m "1"
10 12
11 13 rename a single file
12 14
13 15 $ hg rename d1/d11/a1 d2/c
14 16 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
15 17 abort: filename contains 'con', which is reserved on Windows: 'd1/con.xml'
16 18 [255]
17 19 $ hg sum
18 20 parent: 0:9b4b6e7b2c26 tip
19 21 1
20 22 branch: default
21 23 commit: 1 renamed
22 24 update: (current)
23 25 $ hg status -C
24 26 A d2/c
25 27 d1/d11/a1
26 28 R d1/d11/a1
27 29 $ hg update -C
28 30 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 31 $ rm d2/c
30 32
31 33 rename a single file using absolute paths
32 34
33 35 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
34 36 $ hg status -C
35 37 A d2/c
36 38 d1/d11/a1
37 39 R d1/d11/a1
38 40 $ hg update -C
39 41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 42 $ rm d2/c
41 43
42 44 rename --after a single file
43 45
44 46 $ mv d1/d11/a1 d2/c
45 47 $ hg rename --after d1/d11/a1 d2/c
46 48 $ hg status -C
47 49 A d2/c
48 50 d1/d11/a1
49 51 R d1/d11/a1
50 52 $ hg update -C
51 53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 54 $ rm d2/c
53 55
54 56 rename --after a single file when src and tgt already tracked
55 57
56 58 $ mv d1/d11/a1 d2/c
57 59 $ hg addrem -s 0
58 60 removing d1/d11/a1
59 61 adding d2/c
60 62 $ hg rename --after d1/d11/a1 d2/c
61 63 $ hg status -C
62 64 A d2/c
63 65 d1/d11/a1
64 66 R d1/d11/a1
65 67 $ hg update -C
66 68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 69 $ rm d2/c
68 70
69 71 rename --after a single file to a nonexistant target filename
70 72
71 73 $ hg rename --after d1/a dummy
72 74 d1/a: not recording move - dummy does not exist
73 75
74 76 move a single file to an existing directory
75 77
76 78 $ hg rename d1/d11/a1 d2
77 79 $ hg status -C
78 80 A d2/a1
79 81 d1/d11/a1
80 82 R d1/d11/a1
81 83 $ hg update -C
82 84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 85 $ rm d2/a1
84 86
85 87 move --after a single file to an existing directory
86 88
87 89 $ mv d1/d11/a1 d2
88 90 $ hg rename --after d1/d11/a1 d2
89 91 $ hg status -C
90 92 A d2/a1
91 93 d1/d11/a1
92 94 R d1/d11/a1
93 95 $ hg update -C
94 96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 97 $ rm d2/a1
96 98
97 99 rename a file using a relative path
98 100
99 101 $ (cd d1/d11; hg rename ../../d2/b e)
100 102 $ hg status -C
101 103 A d1/d11/e
102 104 d2/b
103 105 R d2/b
104 106 $ hg update -C
105 107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 108 $ rm d1/d11/e
107 109
108 110 rename --after a file using a relative path
109 111
110 112 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
111 113 $ hg status -C
112 114 A d1/d11/e
113 115 d2/b
114 116 R d2/b
115 117 $ hg update -C
116 118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 119 $ rm d1/d11/e
118 120
119 121 rename directory d1 as d3
120 122
121 123 $ hg rename d1/ d3
122 124 moving d1/a to d3/a
123 125 moving d1/b to d3/b
124 126 moving d1/ba to d3/ba
125 127 moving d1/d11/a1 to d3/d11/a1
126 128 $ hg status -C
127 129 A d3/a
128 130 d1/a
129 131 A d3/b
130 132 d1/b
131 133 A d3/ba
132 134 d1/ba
133 135 A d3/d11/a1
134 136 d1/d11/a1
135 137 R d1/a
136 138 R d1/b
137 139 R d1/ba
138 140 R d1/d11/a1
139 141 $ hg update -C
140 142 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 143 $ rm -rf d3
142 144
143 145 rename --after directory d1 as d3
144 146
145 147 $ mv d1 d3
146 148 $ hg rename --after d1 d3
147 149 moving d1/a to d3/a
148 150 moving d1/b to d3/b
149 151 moving d1/ba to d3/ba
150 152 moving d1/d11/a1 to d3/d11/a1
151 153 $ hg status -C
152 154 A d3/a
153 155 d1/a
154 156 A d3/b
155 157 d1/b
156 158 A d3/ba
157 159 d1/ba
158 160 A d3/d11/a1
159 161 d1/d11/a1
160 162 R d1/a
161 163 R d1/b
162 164 R d1/ba
163 165 R d1/d11/a1
164 166 $ hg update -C
165 167 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 168 $ rm -rf d3
167 169
168 170 move a directory using a relative path
169 171
170 172 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
171 173 moving ../d1/d11/a1 to d3/d11/a1
172 174 $ hg status -C
173 175 A d2/d3/d11/a1
174 176 d1/d11/a1
175 177 R d1/d11/a1
176 178 $ hg update -C
177 179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 180 $ rm -rf d2/d3
179 181
180 182 move --after a directory using a relative path
181 183
182 184 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
183 185 moving ../d1/d11/a1 to d3/d11/a1
184 186 $ hg status -C
185 187 A d2/d3/d11/a1
186 188 d1/d11/a1
187 189 R d1/d11/a1
188 190 $ hg update -C
189 191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 192 $ rm -rf d2/d3
191 193
192 194 move directory d1/d11 to an existing directory d2 (removes empty d1)
193 195
194 196 $ hg rename d1/d11/ d2
195 197 moving d1/d11/a1 to d2/d11/a1
196 198 $ hg status -C
197 199 A d2/d11/a1
198 200 d1/d11/a1
199 201 R d1/d11/a1
200 202 $ hg update -C
201 203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 204 $ rm -rf d2/d11
203 205
204 206 move directories d1 and d2 to a new directory d3
205 207
206 208 $ mkdir d3
207 209 $ hg rename d1 d2 d3
208 210 moving d1/a to d3/d1/a
209 211 moving d1/b to d3/d1/b
210 212 moving d1/ba to d3/d1/ba
211 213 moving d1/d11/a1 to d3/d1/d11/a1
212 214 moving d2/b to d3/d2/b
213 215 $ hg status -C
214 216 A d3/d1/a
215 217 d1/a
216 218 A d3/d1/b
217 219 d1/b
218 220 A d3/d1/ba
219 221 d1/ba
220 222 A d3/d1/d11/a1
221 223 d1/d11/a1
222 224 A d3/d2/b
223 225 d2/b
224 226 R d1/a
225 227 R d1/b
226 228 R d1/ba
227 229 R d1/d11/a1
228 230 R d2/b
229 231 $ hg update -C
230 232 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 233 $ rm -rf d3
232 234
233 235 move --after directories d1 and d2 to a new directory d3
234 236
235 237 $ mkdir d3
236 238 $ mv d1 d2 d3
237 239 $ hg rename --after d1 d2 d3
238 240 moving d1/a to d3/d1/a
239 241 moving d1/b to d3/d1/b
240 242 moving d1/ba to d3/d1/ba
241 243 moving d1/d11/a1 to d3/d1/d11/a1
242 244 moving d2/b to d3/d2/b
243 245 $ hg status -C
244 246 A d3/d1/a
245 247 d1/a
246 248 A d3/d1/b
247 249 d1/b
248 250 A d3/d1/ba
249 251 d1/ba
250 252 A d3/d1/d11/a1
251 253 d1/d11/a1
252 254 A d3/d2/b
253 255 d2/b
254 256 R d1/a
255 257 R d1/b
256 258 R d1/ba
257 259 R d1/d11/a1
258 260 R d2/b
259 261 $ hg update -C
260 262 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 263 $ rm -rf d3
262 264
263 265 move everything under directory d1 to existing directory d2, do not
264 266 overwrite existing files (d2/b)
265 267
266 268 $ hg rename d1/* d2
267 269 d2/b: not overwriting - file exists
268 270 moving d1/d11/a1 to d2/d11/a1
269 271 $ hg status -C
270 272 A d2/a
271 273 d1/a
272 274 A d2/ba
273 275 d1/ba
274 276 A d2/d11/a1
275 277 d1/d11/a1
276 278 R d1/a
277 279 R d1/ba
278 280 R d1/d11/a1
279 281 $ diff -u d1/b d2/b
280 282 --- d1/b * (glob)
281 283 +++ d2/b * (glob)
282 284 @@ * (glob)
283 285 -d1/b
284 286 +d2/b
285 287 [1]
286 288 $ hg update -C
287 289 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 290 $ rm d2/a d2/ba d2/d11/a1
289 291
290 292 attempt to move one file into a non-existent directory
291 293
292 294 $ hg rename d1/a dx/
293 295 abort: destination dx/ is not a directory
294 296 [255]
295 297 $ hg status -C
296 298 $ hg update -C
297 299 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
298 300
299 301 attempt to move potentially more than one file into a non-existent directory
300 302
301 303 $ hg rename 'glob:d1/**' dx
302 304 abort: with multiple sources, destination must be an existing directory
303 305 [255]
304 306
305 307 move every file under d1 to d2/d21 (glob)
306 308
307 309 $ mkdir d2/d21
308 310 $ hg rename 'glob:d1/**' d2/d21
309 311 moving d1/a to d2/d21/a
310 312 moving d1/b to d2/d21/b
311 313 moving d1/ba to d2/d21/ba
312 314 moving d1/d11/a1 to d2/d21/a1
313 315 $ hg status -C
314 316 A d2/d21/a
315 317 d1/a
316 318 A d2/d21/a1
317 319 d1/d11/a1
318 320 A d2/d21/b
319 321 d1/b
320 322 A d2/d21/ba
321 323 d1/ba
322 324 R d1/a
323 325 R d1/b
324 326 R d1/ba
325 327 R d1/d11/a1
326 328 $ hg update -C
327 329 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 330 $ rm -rf d2/d21
329 331
330 332 move --after some files under d1 to d2/d21 (glob)
331 333
332 334 $ mkdir d2/d21
333 335 $ mv d1/a d1/d11/a1 d2/d21
334 336 $ hg rename --after 'glob:d1/**' d2/d21
335 337 moving d1/a to d2/d21/a
336 338 d1/b: not recording move - d2/d21/b does not exist
337 339 d1/ba: not recording move - d2/d21/ba does not exist
338 340 moving d1/d11/a1 to d2/d21/a1
339 341 $ hg status -C
340 342 A d2/d21/a
341 343 d1/a
342 344 A d2/d21/a1
343 345 d1/d11/a1
344 346 R d1/a
345 347 R d1/d11/a1
346 348 $ hg update -C
347 349 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 350 $ rm -rf d2/d21
349 351
350 352 move every file under d1 starting with an 'a' to d2/d21 (regexp)
351 353
352 354 $ mkdir d2/d21
353 355 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
354 356 moving d1/a to d2/d21/a
355 357 moving d1/d11/a1 to d2/d21/a1
356 358 $ hg status -C
357 359 A d2/d21/a
358 360 d1/a
359 361 A d2/d21/a1
360 362 d1/d11/a1
361 363 R d1/a
362 364 R d1/d11/a1
363 365 $ hg update -C
364 366 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
365 367 $ rm -rf d2/d21
366 368
367 369 attempt to overwrite an existing file
368 370
369 371 $ echo "ca" > d1/ca
370 372 $ hg rename d1/ba d1/ca
371 373 d1/ca: not overwriting - file exists
372 374 $ hg status -C
373 375 ? d1/ca
374 376 $ hg update -C
375 377 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 378
377 379 forced overwrite of an existing file
378 380
379 381 $ echo "ca" > d1/ca
380 382 $ hg rename --force d1/ba d1/ca
381 383 $ hg status -C
382 384 A d1/ca
383 385 d1/ba
384 386 R d1/ba
385 387 $ hg update -C
386 388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 389 $ rm d1/ca
388 390
389 391 attempt to overwrite an existing broken symlink
390 392
391 393 $ ln -s ba d1/ca
392 394 $ hg rename --traceback d1/ba d1/ca
393 395 d1/ca: not overwriting - file exists
394 396 $ hg status -C
395 397 ? d1/ca
396 398 $ hg update -C
397 399 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 400 $ rm d1/ca
399 401
400 402 replace a symlink with a file
401 403
402 404 $ ln -s ba d1/ca
403 405 $ hg rename --force d1/ba d1/ca
404 406 $ hg status -C
405 407 A d1/ca
406 408 d1/ba
407 409 R d1/ba
408 410 $ hg update -C
409 411 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 412 $ rm d1/ca
411 413
412 414 do not copy more than one source file to the same destination file
413 415
414 416 $ mkdir d3
415 417 $ hg rename d1/* d2/* d3
416 418 moving d1/d11/a1 to d3/d11/a1
417 419 d3/b: not overwriting - d2/b collides with d1/b
418 420 $ hg status -C
419 421 A d3/a
420 422 d1/a
421 423 A d3/b
422 424 d1/b
423 425 A d3/ba
424 426 d1/ba
425 427 A d3/d11/a1
426 428 d1/d11/a1
427 429 R d1/a
428 430 R d1/b
429 431 R d1/ba
430 432 R d1/d11/a1
431 433 $ hg update -C
432 434 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
433 435 $ rm -rf d3
434 436
435 437 move a whole subtree with "hg rename ."
436 438
437 439 $ mkdir d3
438 440 $ (cd d1; hg rename . ../d3)
439 441 moving a to ../d3/d1/a
440 442 moving b to ../d3/d1/b
441 443 moving ba to ../d3/d1/ba
442 444 moving d11/a1 to ../d3/d1/d11/a1
443 445 $ hg status -C
444 446 A d3/d1/a
445 447 d1/a
446 448 A d3/d1/b
447 449 d1/b
448 450 A d3/d1/ba
449 451 d1/ba
450 452 A d3/d1/d11/a1
451 453 d1/d11/a1
452 454 R d1/a
453 455 R d1/b
454 456 R d1/ba
455 457 R d1/d11/a1
456 458 $ hg update -C
457 459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
458 460 $ rm -rf d3
459 461
460 462 move a whole subtree with "hg rename --after ."
461 463
462 464 $ mkdir d3
463 465 $ mv d1/* d3
464 466 $ (cd d1; hg rename --after . ../d3)
465 467 moving a to ../d3/a
466 468 moving b to ../d3/b
467 469 moving ba to ../d3/ba
468 470 moving d11/a1 to ../d3/d11/a1
469 471 $ hg status -C
470 472 A d3/a
471 473 d1/a
472 474 A d3/b
473 475 d1/b
474 476 A d3/ba
475 477 d1/ba
476 478 A d3/d11/a1
477 479 d1/d11/a1
478 480 R d1/a
479 481 R d1/b
480 482 R d1/ba
481 483 R d1/d11/a1
482 484 $ hg update -C
483 485 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 486 $ rm -rf d3
485 487
486 488 move the parent tree with "hg rename .."
487 489
488 490 $ (cd d1/d11; hg rename .. ../../d3)
489 491 moving ../a to ../../d3/a
490 492 moving ../b to ../../d3/b
491 493 moving ../ba to ../../d3/ba
492 494 moving a1 to ../../d3/d11/a1
493 495 $ hg status -C
494 496 A d3/a
495 497 d1/a
496 498 A d3/b
497 499 d1/b
498 500 A d3/ba
499 501 d1/ba
500 502 A d3/d11/a1
501 503 d1/d11/a1
502 504 R d1/a
503 505 R d1/b
504 506 R d1/ba
505 507 R d1/d11/a1
506 508 $ hg update -C
507 509 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
508 510 $ rm -rf d3
509 511
510 512 skip removed files
511 513
512 514 $ hg remove d1/b
513 515 $ hg rename d1 d3
514 516 moving d1/a to d3/a
515 517 moving d1/ba to d3/ba
516 518 moving d1/d11/a1 to d3/d11/a1
517 519 $ hg status -C
518 520 A d3/a
519 521 d1/a
520 522 A d3/ba
521 523 d1/ba
522 524 A d3/d11/a1
523 525 d1/d11/a1
524 526 R d1/a
525 527 R d1/b
526 528 R d1/ba
527 529 R d1/d11/a1
528 530 $ hg update -C
529 531 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
530 532 $ rm -rf d3
531 533
532 534 transitive rename
533 535
534 536 $ hg rename d1/b d1/bb
535 537 $ hg rename d1/bb d1/bc
536 538 $ hg status -C
537 539 A d1/bc
538 540 d1/b
539 541 R d1/b
540 542 $ hg update -C
541 543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 544 $ rm d1/bc
543 545
544 546 transitive rename --after
545 547
546 548 $ hg rename d1/b d1/bb
547 549 $ mv d1/bb d1/bc
548 550 $ hg rename --after d1/bb d1/bc
549 551 $ hg status -C
550 552 A d1/bc
551 553 d1/b
552 554 R d1/b
553 555 $ hg update -C
554 556 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
555 557 $ rm d1/bc
556 558
557 559 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
558 560 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
559 561 $ hg rename d1/b d1/bb
560 562 $ echo "some stuff added to d1/bb" >> d1/bb
561 563 $ hg rename d1/bb d1/b
562 564 $ hg status -C
563 565 M d1/b
564 566 $ hg update -C
565 567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
566 568
567 569 overwriting with renames (issue1959)
568 570
569 571 $ hg rename d1/a d1/c
570 572 $ hg rename d1/b d1/a
571 573 $ hg status -C
572 574 A d1/a
573 575 d1/b
574 576 A d1/c
575 577 d1/a
576 578 R d1/b
577 579 $ hg diff --git
578 580 diff --git a/d1/b b/d1/a
579 581 rename from d1/b
580 582 rename to d1/a
581 583 diff --git a/d1/a b/d1/c
582 584 copy from d1/a
583 585 copy to d1/c
584 586 $ hg update -C
585 587 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
586 588
587 589 check illegal path components
588 590
589 591 $ hg rename d1/d11/a1 .hg/foo
590 592 abort: path contains illegal component: .hg/foo
591 593 [255]
592 594 $ hg status -C
593 595 $ hg rename d1/d11/a1 ../foo
594 596 abort: ../foo not under root
595 597 [255]
596 598 $ hg status -C
597 599
598 600 $ mv d1/d11/a1 .hg/foo
599 601 $ hg rename --after d1/d11/a1 .hg/foo
600 602 abort: path contains illegal component: .hg/foo
601 603 [255]
602 604 $ hg status -C
603 605 ! d1/d11/a1
604 606 $ hg update -C
605 607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
606 608 $ rm .hg/foo
607 609
608 610 $ hg rename d1/d11/a1 .hg
609 611 abort: path contains illegal component: .hg/a1
610 612 [255]
611 613 $ hg status -C
612 614 $ hg rename d1/d11/a1 ..
613 615 abort: ../a1 not under root
614 616 [255]
615 617 $ hg status -C
616 618
617 619 $ mv d1/d11/a1 .hg
618 620 $ hg rename --after d1/d11/a1 .hg
619 621 abort: path contains illegal component: .hg/a1
620 622 [255]
621 623 $ hg status -C
622 624 ! d1/d11/a1
623 625 $ hg update -C
624 626 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
625 627 $ rm .hg/a1
626 628
627 629 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
628 630 abort: path contains illegal component: .hg/foo
629 631 [255]
630 632 $ hg status -C
631 633 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
632 634 abort: ../../../foo not under root
633 635 [255]
634 636 $ hg status -C
635 637
General Comments 0
You need to be logged in to leave comments. Login now