##// END OF EJS Templates
tests: introduce hghave hardlinks...
Mads Kiilerich -
r16971:8aeb2f1a default
parent child Browse files
Show More
@@ -1,290 +1,306 b''
1 import os, stat, socket
1 import os, stat, socket
2 import re
2 import re
3 import sys
3 import sys
4 import tempfile
4 import tempfile
5
5
6 tempprefix = 'hg-hghave-'
6 tempprefix = 'hg-hghave-'
7
7
8 def matchoutput(cmd, regexp, ignorestatus=False):
8 def matchoutput(cmd, regexp, ignorestatus=False):
9 """Return True if cmd executes successfully and its output
9 """Return True if cmd executes successfully and its output
10 is matched by the supplied regular expression.
10 is matched by the supplied regular expression.
11 """
11 """
12 r = re.compile(regexp)
12 r = re.compile(regexp)
13 fh = os.popen(cmd)
13 fh = os.popen(cmd)
14 s = fh.read()
14 s = fh.read()
15 try:
15 try:
16 ret = fh.close()
16 ret = fh.close()
17 except IOError:
17 except IOError:
18 # Happen in Windows test environment
18 # Happen in Windows test environment
19 ret = 1
19 ret = 1
20 return (ignorestatus or ret is None) and r.search(s)
20 return (ignorestatus or ret is None) and r.search(s)
21
21
22 def has_baz():
22 def has_baz():
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
24
24
25 def has_bzr():
25 def has_bzr():
26 try:
26 try:
27 import bzrlib
27 import bzrlib
28 return bzrlib.__doc__ is not None
28 return bzrlib.__doc__ is not None
29 except ImportError:
29 except ImportError:
30 return False
30 return False
31
31
32 def has_bzr114():
32 def has_bzr114():
33 try:
33 try:
34 import bzrlib
34 import bzrlib
35 return (bzrlib.__doc__ is not None
35 return (bzrlib.__doc__ is not None
36 and bzrlib.version_info[:2] >= (1, 14))
36 and bzrlib.version_info[:2] >= (1, 14))
37 except ImportError:
37 except ImportError:
38 return False
38 return False
39
39
40 def has_cvs():
40 def has_cvs():
41 re = r'Concurrent Versions System.*?server'
41 re = r'Concurrent Versions System.*?server'
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
43
43
44 def has_darcs():
44 def has_darcs():
45 return matchoutput('darcs --version', r'2\.[2-9]', True)
45 return matchoutput('darcs --version', r'2\.[2-9]', True)
46
46
47 def has_mtn():
47 def has_mtn():
48 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
48 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
49 'mtn --version', r'monotone 0\.', True)
49 'mtn --version', r'monotone 0\.', True)
50
50
51 def has_eol_in_paths():
51 def has_eol_in_paths():
52 try:
52 try:
53 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
53 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
54 os.close(fd)
54 os.close(fd)
55 os.remove(path)
55 os.remove(path)
56 return True
56 return True
57 except (IOError, OSError):
57 except (IOError, OSError):
58 return False
58 return False
59
59
60 def has_executablebit():
60 def has_executablebit():
61 try:
61 try:
62 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
62 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
63 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
63 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
64 try:
64 try:
65 os.close(fh)
65 os.close(fh)
66 m = os.stat(fn).st_mode & 0777
66 m = os.stat(fn).st_mode & 0777
67 new_file_has_exec = m & EXECFLAGS
67 new_file_has_exec = m & EXECFLAGS
68 os.chmod(fn, m ^ EXECFLAGS)
68 os.chmod(fn, m ^ EXECFLAGS)
69 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
69 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
70 finally:
70 finally:
71 os.unlink(fn)
71 os.unlink(fn)
72 except (IOError, OSError):
72 except (IOError, OSError):
73 # we don't care, the user probably won't be able to commit anyway
73 # we don't care, the user probably won't be able to commit anyway
74 return False
74 return False
75 return not (new_file_has_exec or exec_flags_cannot_flip)
75 return not (new_file_has_exec or exec_flags_cannot_flip)
76
76
77 def has_icasefs():
77 def has_icasefs():
78 # Stolen from mercurial.util
78 # Stolen from mercurial.util
79 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
79 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
80 os.close(fd)
80 os.close(fd)
81 try:
81 try:
82 s1 = os.stat(path)
82 s1 = os.stat(path)
83 d, b = os.path.split(path)
83 d, b = os.path.split(path)
84 p2 = os.path.join(d, b.upper())
84 p2 = os.path.join(d, b.upper())
85 if path == p2:
85 if path == p2:
86 p2 = os.path.join(d, b.lower())
86 p2 = os.path.join(d, b.lower())
87 try:
87 try:
88 s2 = os.stat(p2)
88 s2 = os.stat(p2)
89 return s2 == s1
89 return s2 == s1
90 except OSError:
90 except OSError:
91 return False
91 return False
92 finally:
92 finally:
93 os.remove(path)
93 os.remove(path)
94
94
95 def has_inotify():
95 def has_inotify():
96 try:
96 try:
97 import hgext.inotify.linux.watcher
97 import hgext.inotify.linux.watcher
98 except ImportError:
98 except ImportError:
99 return False
99 return False
100 name = tempfile.mktemp(dir='.', prefix=tempprefix)
100 name = tempfile.mktemp(dir='.', prefix=tempprefix)
101 sock = socket.socket(socket.AF_UNIX)
101 sock = socket.socket(socket.AF_UNIX)
102 try:
102 try:
103 sock.bind(name)
103 sock.bind(name)
104 except socket.error, err:
104 except socket.error, err:
105 return False
105 return False
106 sock.close()
106 sock.close()
107 os.unlink(name)
107 os.unlink(name)
108 return True
108 return True
109
109
110 def has_fifo():
110 def has_fifo():
111 if getattr(os, "mkfifo", None) is None:
111 if getattr(os, "mkfifo", None) is None:
112 return False
112 return False
113 name = tempfile.mktemp(dir='.', prefix=tempprefix)
113 name = tempfile.mktemp(dir='.', prefix=tempprefix)
114 try:
114 try:
115 os.mkfifo(name)
115 os.mkfifo(name)
116 os.unlink(name)
116 os.unlink(name)
117 return True
117 return True
118 except OSError:
118 except OSError:
119 return False
119 return False
120
120
121 def has_cacheable_fs():
121 def has_cacheable_fs():
122 from mercurial import util
122 from mercurial import util
123
123
124 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
124 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
125 os.close(fd)
125 os.close(fd)
126 try:
126 try:
127 return util.cachestat(path).cacheable()
127 return util.cachestat(path).cacheable()
128 finally:
128 finally:
129 os.remove(path)
129 os.remove(path)
130
130
131 def has_lsprof():
131 def has_lsprof():
132 try:
132 try:
133 import _lsprof
133 import _lsprof
134 return True
134 return True
135 except ImportError:
135 except ImportError:
136 return False
136 return False
137
137
138 def has_gettext():
138 def has_gettext():
139 return matchoutput('msgfmt --version', 'GNU gettext-tools')
139 return matchoutput('msgfmt --version', 'GNU gettext-tools')
140
140
141 def has_git():
141 def has_git():
142 return matchoutput('git --version 2>&1', r'^git version')
142 return matchoutput('git --version 2>&1', r'^git version')
143
143
144 def has_docutils():
144 def has_docutils():
145 try:
145 try:
146 from docutils.core import publish_cmdline
146 from docutils.core import publish_cmdline
147 return True
147 return True
148 except ImportError:
148 except ImportError:
149 return False
149 return False
150
150
151 def getsvnversion():
151 def getsvnversion():
152 m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)')
152 m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)')
153 if not m:
153 if not m:
154 return (0, 0)
154 return (0, 0)
155 return (int(m.group(1)), int(m.group(2)))
155 return (int(m.group(1)), int(m.group(2)))
156
156
157 def has_svn15():
157 def has_svn15():
158 return getsvnversion() >= (1, 5)
158 return getsvnversion() >= (1, 5)
159
159
160 def has_svn13():
160 def has_svn13():
161 return getsvnversion() >= (1, 3)
161 return getsvnversion() >= (1, 3)
162
162
163 def has_svn():
163 def has_svn():
164 return matchoutput('svn --version 2>&1', r'^svn, version') and \
164 return matchoutput('svn --version 2>&1', r'^svn, version') and \
165 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
165 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
166
166
167 def has_svn_bindings():
167 def has_svn_bindings():
168 try:
168 try:
169 import svn.core
169 import svn.core
170 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
170 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
171 if version < (1, 4):
171 if version < (1, 4):
172 return False
172 return False
173 return True
173 return True
174 except ImportError:
174 except ImportError:
175 return False
175 return False
176
176
177 def has_p4():
177 def has_p4():
178 return (matchoutput('p4 -V', r'Rev\. P4/') and
178 return (matchoutput('p4 -V', r'Rev\. P4/') and
179 matchoutput('p4d -V', r'Rev\. P4D/'))
179 matchoutput('p4d -V', r'Rev\. P4D/'))
180
180
181 def has_symlink():
181 def has_symlink():
182 if getattr(os, "symlink", None) is None:
182 if getattr(os, "symlink", None) is None:
183 return False
183 return False
184 name = tempfile.mktemp(dir='.', prefix=tempprefix)
184 name = tempfile.mktemp(dir='.', prefix=tempprefix)
185 try:
185 try:
186 os.symlink(".", name)
186 os.symlink(".", name)
187 os.unlink(name)
187 os.unlink(name)
188 return True
188 return True
189 except (OSError, AttributeError):
189 except (OSError, AttributeError):
190 return False
190 return False
191
191
192 def has_hardlink():
193 from mercurial import util
194 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
195 os.close(fh)
196 name = tempfile.mktemp(dir='.', prefix=tempprefix)
197 try:
198 try:
199 util.oslink(fn, name)
200 os.unlink(name)
201 return True
202 except OSError:
203 return False
204 finally:
205 os.unlink(fn)
206
192 def has_tla():
207 def has_tla():
193 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
208 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
194
209
195 def has_gpg():
210 def has_gpg():
196 return matchoutput('gpg --version 2>&1', r'GnuPG')
211 return matchoutput('gpg --version 2>&1', r'GnuPG')
197
212
198 def has_unix_permissions():
213 def has_unix_permissions():
199 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
214 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
200 try:
215 try:
201 fname = os.path.join(d, 'foo')
216 fname = os.path.join(d, 'foo')
202 for umask in (077, 007, 022):
217 for umask in (077, 007, 022):
203 os.umask(umask)
218 os.umask(umask)
204 f = open(fname, 'w')
219 f = open(fname, 'w')
205 f.close()
220 f.close()
206 mode = os.stat(fname).st_mode
221 mode = os.stat(fname).st_mode
207 os.unlink(fname)
222 os.unlink(fname)
208 if mode & 0777 != ~umask & 0666:
223 if mode & 0777 != ~umask & 0666:
209 return False
224 return False
210 return True
225 return True
211 finally:
226 finally:
212 os.rmdir(d)
227 os.rmdir(d)
213
228
214 def has_pyflakes():
229 def has_pyflakes():
215 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
230 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
216 r"<stdin>:1: 're' imported but unused",
231 r"<stdin>:1: 're' imported but unused",
217 True)
232 True)
218
233
219 def has_pygments():
234 def has_pygments():
220 try:
235 try:
221 import pygments
236 import pygments
222 return True
237 return True
223 except ImportError:
238 except ImportError:
224 return False
239 return False
225
240
226 def has_outer_repo():
241 def has_outer_repo():
227 return matchoutput('hg root 2>&1', r'')
242 return matchoutput('hg root 2>&1', r'')
228
243
229 def has_ssl():
244 def has_ssl():
230 try:
245 try:
231 import ssl
246 import ssl
232 import OpenSSL
247 import OpenSSL
233 OpenSSL.SSL.Context
248 OpenSSL.SSL.Context
234 return True
249 return True
235 except ImportError:
250 except ImportError:
236 return False
251 return False
237
252
238 def has_windows():
253 def has_windows():
239 return os.name == 'nt'
254 return os.name == 'nt'
240
255
241 def has_system_sh():
256 def has_system_sh():
242 return os.name != 'nt'
257 return os.name != 'nt'
243
258
244 def has_serve():
259 def has_serve():
245 return os.name != 'nt' # gross approximation
260 return os.name != 'nt' # gross approximation
246
261
247 def has_tic():
262 def has_tic():
248 return matchoutput('test -x "`which tic`"', '')
263 return matchoutput('test -x "`which tic`"', '')
249
264
250 def has_msys():
265 def has_msys():
251 return os.getenv('MSYSTEM')
266 return os.getenv('MSYSTEM')
252
267
253 checks = {
268 checks = {
254 "true": (lambda: True, "yak shaving"),
269 "true": (lambda: True, "yak shaving"),
255 "false": (lambda: False, "nail clipper"),
270 "false": (lambda: False, "nail clipper"),
256 "baz": (has_baz, "GNU Arch baz client"),
271 "baz": (has_baz, "GNU Arch baz client"),
257 "bzr": (has_bzr, "Canonical's Bazaar client"),
272 "bzr": (has_bzr, "Canonical's Bazaar client"),
258 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
273 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
259 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
274 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
260 "cvs": (has_cvs, "cvs client/server"),
275 "cvs": (has_cvs, "cvs client/server"),
261 "darcs": (has_darcs, "darcs client"),
276 "darcs": (has_darcs, "darcs client"),
262 "docutils": (has_docutils, "Docutils text processing library"),
277 "docutils": (has_docutils, "Docutils text processing library"),
263 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
278 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
264 "execbit": (has_executablebit, "executable bit"),
279 "execbit": (has_executablebit, "executable bit"),
265 "fifo": (has_fifo, "named pipes"),
280 "fifo": (has_fifo, "named pipes"),
266 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
281 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
267 "git": (has_git, "git command line client"),
282 "git": (has_git, "git command line client"),
268 "gpg": (has_gpg, "gpg client"),
283 "gpg": (has_gpg, "gpg client"),
284 "hardlink": (has_hardlink, "hardlinks"),
269 "icasefs": (has_icasefs, "case insensitive file system"),
285 "icasefs": (has_icasefs, "case insensitive file system"),
270 "inotify": (has_inotify, "inotify extension support"),
286 "inotify": (has_inotify, "inotify extension support"),
271 "lsprof": (has_lsprof, "python lsprof module"),
287 "lsprof": (has_lsprof, "python lsprof module"),
272 "mtn": (has_mtn, "monotone client (>= 1.0)"),
288 "mtn": (has_mtn, "monotone client (>= 1.0)"),
273 "outer-repo": (has_outer_repo, "outer repo"),
289 "outer-repo": (has_outer_repo, "outer repo"),
274 "p4": (has_p4, "Perforce server and client"),
290 "p4": (has_p4, "Perforce server and client"),
275 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
291 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
276 "pygments": (has_pygments, "Pygments source highlighting library"),
292 "pygments": (has_pygments, "Pygments source highlighting library"),
277 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
293 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
278 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
294 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
279 "svn": (has_svn, "subversion client and admin tools"),
295 "svn": (has_svn, "subversion client and admin tools"),
280 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
296 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
281 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
297 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
282 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
298 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
283 "symlink": (has_symlink, "symbolic links"),
299 "symlink": (has_symlink, "symbolic links"),
284 "system-sh": (has_system_sh, "system() uses sh"),
300 "system-sh": (has_system_sh, "system() uses sh"),
285 "tic": (has_tic, "terminfo compiler"),
301 "tic": (has_tic, "terminfo compiler"),
286 "tla": (has_tla, "GNU Arch tla client"),
302 "tla": (has_tla, "GNU Arch tla client"),
287 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
303 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
288 "windows": (has_windows, "Windows"),
304 "windows": (has_windows, "Windows"),
289 "msys": (has_msys, "Windows with MSYS"),
305 "msys": (has_msys, "Windows with MSYS"),
290 }
306 }
@@ -1,559 +1,564 b''
1 Prepare repo a:
1 Prepare repo a:
2
2
3 $ hg init a
3 $ hg init a
4 $ cd a
4 $ cd a
5 $ echo a > a
5 $ echo a > a
6 $ hg add a
6 $ hg add a
7 $ hg commit -m test
7 $ hg commit -m test
8 $ echo first line > b
8 $ echo first line > b
9 $ hg add b
9 $ hg add b
10
10
11 Create a non-inlined filelog:
11 Create a non-inlined filelog:
12
12
13 $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
13 $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 > cat data1 >> b
15 > cat data1 >> b
16 > hg commit -m test
16 > hg commit -m test
17 > done
17 > done
18
18
19 List files in store/data (should show a 'b.d'):
19 List files in store/data (should show a 'b.d'):
20
20
21 $ for i in .hg/store/data/*; do
21 $ for i in .hg/store/data/*; do
22 > echo $i
22 > echo $i
23 > done
23 > done
24 .hg/store/data/a.i
24 .hg/store/data/a.i
25 .hg/store/data/b.d
25 .hg/store/data/b.d
26 .hg/store/data/b.i
26 .hg/store/data/b.i
27
27
28 Default operation:
28 Default operation:
29
29
30 $ hg clone . ../b
30 $ hg clone . ../b
31 updating to branch default
31 updating to branch default
32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 $ cd ../b
33 $ cd ../b
34 $ cat a
34 $ cat a
35 a
35 a
36 $ hg verify
36 $ hg verify
37 checking changesets
37 checking changesets
38 checking manifests
38 checking manifests
39 crosschecking files in changesets and manifests
39 crosschecking files in changesets and manifests
40 checking files
40 checking files
41 2 files, 11 changesets, 11 total revisions
41 2 files, 11 changesets, 11 total revisions
42
42
43 Invalid dest '' must abort:
43 Invalid dest '' must abort:
44
44
45 $ hg clone . ''
45 $ hg clone . ''
46 abort: * (glob)
46 abort: * (glob)
47 [255]
47 [255]
48
48
49 No update, with debug option:
49 No update, with debug option:
50
50
51 #if hardlink
51 $ hg --debug clone -U . ../c
52 $ hg --debug clone -U . ../c
52 linked 8 files
53 linked 8 files
54 #else
55 $ hg --debug clone -U . ../c
56 copied 8 files
57 #endif
53 $ cd ../c
58 $ cd ../c
54 $ cat a 2>/dev/null || echo "a not present"
59 $ cat a 2>/dev/null || echo "a not present"
55 a not present
60 a not present
56 $ hg verify
61 $ hg verify
57 checking changesets
62 checking changesets
58 checking manifests
63 checking manifests
59 crosschecking files in changesets and manifests
64 crosschecking files in changesets and manifests
60 checking files
65 checking files
61 2 files, 11 changesets, 11 total revisions
66 2 files, 11 changesets, 11 total revisions
62
67
63 Default destination:
68 Default destination:
64
69
65 $ mkdir ../d
70 $ mkdir ../d
66 $ cd ../d
71 $ cd ../d
67 $ hg clone ../a
72 $ hg clone ../a
68 destination directory: a
73 destination directory: a
69 updating to branch default
74 updating to branch default
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 $ cd a
76 $ cd a
72 $ hg cat a
77 $ hg cat a
73 a
78 a
74 $ cd ../..
79 $ cd ../..
75
80
76 Check that we drop the 'file:' from the path before writing the .hgrc:
81 Check that we drop the 'file:' from the path before writing the .hgrc:
77
82
78 $ hg clone file:a e
83 $ hg clone file:a e
79 updating to branch default
84 updating to branch default
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 $ grep 'file:' e/.hg/hgrc
86 $ grep 'file:' e/.hg/hgrc
82 [1]
87 [1]
83
88
84 Check that path aliases are expanded:
89 Check that path aliases are expanded:
85
90
86 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
91 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
87 $ hg -R f showconfig paths.default
92 $ hg -R f showconfig paths.default
88 $TESTTMP/a#0 (glob)
93 $TESTTMP/a#0 (glob)
89
94
90 Use --pull:
95 Use --pull:
91
96
92 $ hg clone --pull a g
97 $ hg clone --pull a g
93 requesting all changes
98 requesting all changes
94 adding changesets
99 adding changesets
95 adding manifests
100 adding manifests
96 adding file changes
101 adding file changes
97 added 11 changesets with 11 changes to 2 files
102 added 11 changesets with 11 changes to 2 files
98 updating to branch default
103 updating to branch default
99 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
104 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 $ hg -R g verify
105 $ hg -R g verify
101 checking changesets
106 checking changesets
102 checking manifests
107 checking manifests
103 crosschecking files in changesets and manifests
108 crosschecking files in changesets and manifests
104 checking files
109 checking files
105 2 files, 11 changesets, 11 total revisions
110 2 files, 11 changesets, 11 total revisions
106
111
107 Invalid dest '' with --pull must abort (issue2528):
112 Invalid dest '' with --pull must abort (issue2528):
108
113
109 $ hg clone --pull a ''
114 $ hg clone --pull a ''
110 abort: * (glob)
115 abort: * (glob)
111 [255]
116 [255]
112
117
113 Clone to '.':
118 Clone to '.':
114
119
115 $ mkdir h
120 $ mkdir h
116 $ cd h
121 $ cd h
117 $ hg clone ../a .
122 $ hg clone ../a .
118 updating to branch default
123 updating to branch default
119 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd ..
125 $ cd ..
121
126
122
127
123 *** Tests for option -u ***
128 *** Tests for option -u ***
124
129
125 Adding some more history to repo a:
130 Adding some more history to repo a:
126
131
127 $ cd a
132 $ cd a
128 $ hg tag ref1
133 $ hg tag ref1
129 $ echo the quick brown fox >a
134 $ echo the quick brown fox >a
130 $ hg ci -m "hacked default"
135 $ hg ci -m "hacked default"
131 $ hg up ref1
136 $ hg up ref1
132 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
137 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
133 $ hg branch stable
138 $ hg branch stable
134 marked working directory as branch stable
139 marked working directory as branch stable
135 (branches are permanent and global, did you want a bookmark?)
140 (branches are permanent and global, did you want a bookmark?)
136 $ echo some text >a
141 $ echo some text >a
137 $ hg ci -m "starting branch stable"
142 $ hg ci -m "starting branch stable"
138 $ hg tag ref2
143 $ hg tag ref2
139 $ echo some more text >a
144 $ echo some more text >a
140 $ hg ci -m "another change for branch stable"
145 $ hg ci -m "another change for branch stable"
141 $ hg up ref2
146 $ hg up ref2
142 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
147 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
143 $ hg parents
148 $ hg parents
144 changeset: 13:e8ece76546a6
149 changeset: 13:e8ece76546a6
145 branch: stable
150 branch: stable
146 tag: ref2
151 tag: ref2
147 parent: 10:a7949464abda
152 parent: 10:a7949464abda
148 user: test
153 user: test
149 date: Thu Jan 01 00:00:00 1970 +0000
154 date: Thu Jan 01 00:00:00 1970 +0000
150 summary: starting branch stable
155 summary: starting branch stable
151
156
152
157
153 Repo a has two heads:
158 Repo a has two heads:
154
159
155 $ hg heads
160 $ hg heads
156 changeset: 15:0aae7cf88f0d
161 changeset: 15:0aae7cf88f0d
157 branch: stable
162 branch: stable
158 tag: tip
163 tag: tip
159 user: test
164 user: test
160 date: Thu Jan 01 00:00:00 1970 +0000
165 date: Thu Jan 01 00:00:00 1970 +0000
161 summary: another change for branch stable
166 summary: another change for branch stable
162
167
163 changeset: 12:f21241060d6a
168 changeset: 12:f21241060d6a
164 user: test
169 user: test
165 date: Thu Jan 01 00:00:00 1970 +0000
170 date: Thu Jan 01 00:00:00 1970 +0000
166 summary: hacked default
171 summary: hacked default
167
172
168
173
169 $ cd ..
174 $ cd ..
170
175
171
176
172 Testing --noupdate with --updaterev (must abort):
177 Testing --noupdate with --updaterev (must abort):
173
178
174 $ hg clone --noupdate --updaterev 1 a ua
179 $ hg clone --noupdate --updaterev 1 a ua
175 abort: cannot specify both --noupdate and --updaterev
180 abort: cannot specify both --noupdate and --updaterev
176 [255]
181 [255]
177
182
178
183
179 Testing clone -u:
184 Testing clone -u:
180
185
181 $ hg clone -u . a ua
186 $ hg clone -u . a ua
182 updating to branch stable
187 updating to branch stable
183 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
188 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
184
189
185 Repo ua has both heads:
190 Repo ua has both heads:
186
191
187 $ hg -R ua heads
192 $ hg -R ua heads
188 changeset: 15:0aae7cf88f0d
193 changeset: 15:0aae7cf88f0d
189 branch: stable
194 branch: stable
190 tag: tip
195 tag: tip
191 user: test
196 user: test
192 date: Thu Jan 01 00:00:00 1970 +0000
197 date: Thu Jan 01 00:00:00 1970 +0000
193 summary: another change for branch stable
198 summary: another change for branch stable
194
199
195 changeset: 12:f21241060d6a
200 changeset: 12:f21241060d6a
196 user: test
201 user: test
197 date: Thu Jan 01 00:00:00 1970 +0000
202 date: Thu Jan 01 00:00:00 1970 +0000
198 summary: hacked default
203 summary: hacked default
199
204
200
205
201 Same revision checked out in repo a and ua:
206 Same revision checked out in repo a and ua:
202
207
203 $ hg -R a parents --template "{node|short}\n"
208 $ hg -R a parents --template "{node|short}\n"
204 e8ece76546a6
209 e8ece76546a6
205 $ hg -R ua parents --template "{node|short}\n"
210 $ hg -R ua parents --template "{node|short}\n"
206 e8ece76546a6
211 e8ece76546a6
207
212
208 $ rm -r ua
213 $ rm -r ua
209
214
210
215
211 Testing clone --pull -u:
216 Testing clone --pull -u:
212
217
213 $ hg clone --pull -u . a ua
218 $ hg clone --pull -u . a ua
214 requesting all changes
219 requesting all changes
215 adding changesets
220 adding changesets
216 adding manifests
221 adding manifests
217 adding file changes
222 adding file changes
218 added 16 changesets with 16 changes to 3 files (+1 heads)
223 added 16 changesets with 16 changes to 3 files (+1 heads)
219 updating to branch stable
224 updating to branch stable
220 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
221
226
222 Repo ua has both heads:
227 Repo ua has both heads:
223
228
224 $ hg -R ua heads
229 $ hg -R ua heads
225 changeset: 15:0aae7cf88f0d
230 changeset: 15:0aae7cf88f0d
226 branch: stable
231 branch: stable
227 tag: tip
232 tag: tip
228 user: test
233 user: test
229 date: Thu Jan 01 00:00:00 1970 +0000
234 date: Thu Jan 01 00:00:00 1970 +0000
230 summary: another change for branch stable
235 summary: another change for branch stable
231
236
232 changeset: 12:f21241060d6a
237 changeset: 12:f21241060d6a
233 user: test
238 user: test
234 date: Thu Jan 01 00:00:00 1970 +0000
239 date: Thu Jan 01 00:00:00 1970 +0000
235 summary: hacked default
240 summary: hacked default
236
241
237
242
238 Same revision checked out in repo a and ua:
243 Same revision checked out in repo a and ua:
239
244
240 $ hg -R a parents --template "{node|short}\n"
245 $ hg -R a parents --template "{node|short}\n"
241 e8ece76546a6
246 e8ece76546a6
242 $ hg -R ua parents --template "{node|short}\n"
247 $ hg -R ua parents --template "{node|short}\n"
243 e8ece76546a6
248 e8ece76546a6
244
249
245 $ rm -r ua
250 $ rm -r ua
246
251
247
252
248 Testing clone -u <branch>:
253 Testing clone -u <branch>:
249
254
250 $ hg clone -u stable a ua
255 $ hg clone -u stable a ua
251 updating to branch stable
256 updating to branch stable
252 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
253
258
254 Repo ua has both heads:
259 Repo ua has both heads:
255
260
256 $ hg -R ua heads
261 $ hg -R ua heads
257 changeset: 15:0aae7cf88f0d
262 changeset: 15:0aae7cf88f0d
258 branch: stable
263 branch: stable
259 tag: tip
264 tag: tip
260 user: test
265 user: test
261 date: Thu Jan 01 00:00:00 1970 +0000
266 date: Thu Jan 01 00:00:00 1970 +0000
262 summary: another change for branch stable
267 summary: another change for branch stable
263
268
264 changeset: 12:f21241060d6a
269 changeset: 12:f21241060d6a
265 user: test
270 user: test
266 date: Thu Jan 01 00:00:00 1970 +0000
271 date: Thu Jan 01 00:00:00 1970 +0000
267 summary: hacked default
272 summary: hacked default
268
273
269
274
270 Branch 'stable' is checked out:
275 Branch 'stable' is checked out:
271
276
272 $ hg -R ua parents
277 $ hg -R ua parents
273 changeset: 15:0aae7cf88f0d
278 changeset: 15:0aae7cf88f0d
274 branch: stable
279 branch: stable
275 tag: tip
280 tag: tip
276 user: test
281 user: test
277 date: Thu Jan 01 00:00:00 1970 +0000
282 date: Thu Jan 01 00:00:00 1970 +0000
278 summary: another change for branch stable
283 summary: another change for branch stable
279
284
280
285
281 $ rm -r ua
286 $ rm -r ua
282
287
283
288
284 Testing default checkout:
289 Testing default checkout:
285
290
286 $ hg clone a ua
291 $ hg clone a ua
287 updating to branch default
292 updating to branch default
288 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
289
294
290 Repo ua has both heads:
295 Repo ua has both heads:
291
296
292 $ hg -R ua heads
297 $ hg -R ua heads
293 changeset: 15:0aae7cf88f0d
298 changeset: 15:0aae7cf88f0d
294 branch: stable
299 branch: stable
295 tag: tip
300 tag: tip
296 user: test
301 user: test
297 date: Thu Jan 01 00:00:00 1970 +0000
302 date: Thu Jan 01 00:00:00 1970 +0000
298 summary: another change for branch stable
303 summary: another change for branch stable
299
304
300 changeset: 12:f21241060d6a
305 changeset: 12:f21241060d6a
301 user: test
306 user: test
302 date: Thu Jan 01 00:00:00 1970 +0000
307 date: Thu Jan 01 00:00:00 1970 +0000
303 summary: hacked default
308 summary: hacked default
304
309
305
310
306 Branch 'default' is checked out:
311 Branch 'default' is checked out:
307
312
308 $ hg -R ua parents
313 $ hg -R ua parents
309 changeset: 12:f21241060d6a
314 changeset: 12:f21241060d6a
310 user: test
315 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
316 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: hacked default
317 summary: hacked default
313
318
314
319
315 $ rm -r ua
320 $ rm -r ua
316
321
317
322
318 Testing #<branch>:
323 Testing #<branch>:
319
324
320 $ hg clone -u . a#stable ua
325 $ hg clone -u . a#stable ua
321 adding changesets
326 adding changesets
322 adding manifests
327 adding manifests
323 adding file changes
328 adding file changes
324 added 14 changesets with 14 changes to 3 files
329 added 14 changesets with 14 changes to 3 files
325 updating to branch stable
330 updating to branch stable
326 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
327
332
328 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
333 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
329
334
330 $ hg -R ua heads
335 $ hg -R ua heads
331 changeset: 13:0aae7cf88f0d
336 changeset: 13:0aae7cf88f0d
332 branch: stable
337 branch: stable
333 tag: tip
338 tag: tip
334 user: test
339 user: test
335 date: Thu Jan 01 00:00:00 1970 +0000
340 date: Thu Jan 01 00:00:00 1970 +0000
336 summary: another change for branch stable
341 summary: another change for branch stable
337
342
338 changeset: 10:a7949464abda
343 changeset: 10:a7949464abda
339 user: test
344 user: test
340 date: Thu Jan 01 00:00:00 1970 +0000
345 date: Thu Jan 01 00:00:00 1970 +0000
341 summary: test
346 summary: test
342
347
343
348
344 Same revision checked out in repo a and ua:
349 Same revision checked out in repo a and ua:
345
350
346 $ hg -R a parents --template "{node|short}\n"
351 $ hg -R a parents --template "{node|short}\n"
347 e8ece76546a6
352 e8ece76546a6
348 $ hg -R ua parents --template "{node|short}\n"
353 $ hg -R ua parents --template "{node|short}\n"
349 e8ece76546a6
354 e8ece76546a6
350
355
351 $ rm -r ua
356 $ rm -r ua
352
357
353
358
354 Testing -u -r <branch>:
359 Testing -u -r <branch>:
355
360
356 $ hg clone -u . -r stable a ua
361 $ hg clone -u . -r stable a ua
357 adding changesets
362 adding changesets
358 adding manifests
363 adding manifests
359 adding file changes
364 adding file changes
360 added 14 changesets with 14 changes to 3 files
365 added 14 changesets with 14 changes to 3 files
361 updating to branch stable
366 updating to branch stable
362 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
363
368
364 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
369 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
365
370
366 $ hg -R ua heads
371 $ hg -R ua heads
367 changeset: 13:0aae7cf88f0d
372 changeset: 13:0aae7cf88f0d
368 branch: stable
373 branch: stable
369 tag: tip
374 tag: tip
370 user: test
375 user: test
371 date: Thu Jan 01 00:00:00 1970 +0000
376 date: Thu Jan 01 00:00:00 1970 +0000
372 summary: another change for branch stable
377 summary: another change for branch stable
373
378
374 changeset: 10:a7949464abda
379 changeset: 10:a7949464abda
375 user: test
380 user: test
376 date: Thu Jan 01 00:00:00 1970 +0000
381 date: Thu Jan 01 00:00:00 1970 +0000
377 summary: test
382 summary: test
378
383
379
384
380 Same revision checked out in repo a and ua:
385 Same revision checked out in repo a and ua:
381
386
382 $ hg -R a parents --template "{node|short}\n"
387 $ hg -R a parents --template "{node|short}\n"
383 e8ece76546a6
388 e8ece76546a6
384 $ hg -R ua parents --template "{node|short}\n"
389 $ hg -R ua parents --template "{node|short}\n"
385 e8ece76546a6
390 e8ece76546a6
386
391
387 $ rm -r ua
392 $ rm -r ua
388
393
389
394
390 Testing -r <branch>:
395 Testing -r <branch>:
391
396
392 $ hg clone -r stable a ua
397 $ hg clone -r stable a ua
393 adding changesets
398 adding changesets
394 adding manifests
399 adding manifests
395 adding file changes
400 adding file changes
396 added 14 changesets with 14 changes to 3 files
401 added 14 changesets with 14 changes to 3 files
397 updating to branch stable
402 updating to branch stable
398 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
399
404
400 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
405 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
401
406
402 $ hg -R ua heads
407 $ hg -R ua heads
403 changeset: 13:0aae7cf88f0d
408 changeset: 13:0aae7cf88f0d
404 branch: stable
409 branch: stable
405 tag: tip
410 tag: tip
406 user: test
411 user: test
407 date: Thu Jan 01 00:00:00 1970 +0000
412 date: Thu Jan 01 00:00:00 1970 +0000
408 summary: another change for branch stable
413 summary: another change for branch stable
409
414
410 changeset: 10:a7949464abda
415 changeset: 10:a7949464abda
411 user: test
416 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
417 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: test
418 summary: test
414
419
415
420
416 Branch 'stable' is checked out:
421 Branch 'stable' is checked out:
417
422
418 $ hg -R ua parents
423 $ hg -R ua parents
419 changeset: 13:0aae7cf88f0d
424 changeset: 13:0aae7cf88f0d
420 branch: stable
425 branch: stable
421 tag: tip
426 tag: tip
422 user: test
427 user: test
423 date: Thu Jan 01 00:00:00 1970 +0000
428 date: Thu Jan 01 00:00:00 1970 +0000
424 summary: another change for branch stable
429 summary: another change for branch stable
425
430
426
431
427 $ rm -r ua
432 $ rm -r ua
428
433
429
434
430 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
435 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
431 iterable in addbranchrevs()
436 iterable in addbranchrevs()
432
437
433 $ cat <<EOF > simpleclone.py
438 $ cat <<EOF > simpleclone.py
434 > from mercurial import ui, hg
439 > from mercurial import ui, hg
435 > myui = ui.ui()
440 > myui = ui.ui()
436 > repo = hg.repository(myui, 'a')
441 > repo = hg.repository(myui, 'a')
437 > hg.clone(myui, {}, repo, dest="ua")
442 > hg.clone(myui, {}, repo, dest="ua")
438 > EOF
443 > EOF
439
444
440 $ python simpleclone.py
445 $ python simpleclone.py
441 updating to branch default
446 updating to branch default
442 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
443
448
444 $ rm -r ua
449 $ rm -r ua
445
450
446 $ cat <<EOF > branchclone.py
451 $ cat <<EOF > branchclone.py
447 > from mercurial import ui, hg
452 > from mercurial import ui, hg
448 > myui = ui.ui()
453 > myui = ui.ui()
449 > repo = hg.repository(myui, 'a')
454 > repo = hg.repository(myui, 'a')
450 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
455 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
451 > EOF
456 > EOF
452
457
453 $ python branchclone.py
458 $ python branchclone.py
454 adding changesets
459 adding changesets
455 adding manifests
460 adding manifests
456 adding file changes
461 adding file changes
457 added 14 changesets with 14 changes to 3 files
462 added 14 changesets with 14 changes to 3 files
458 updating to branch stable
463 updating to branch stable
459 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
464 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 $ rm -r ua
465 $ rm -r ua
461
466
462
467
463 Testing failures:
468 Testing failures:
464
469
465 $ mkdir fail
470 $ mkdir fail
466 $ cd fail
471 $ cd fail
467
472
468 No local source
473 No local source
469
474
470 $ hg clone a b
475 $ hg clone a b
471 abort: repository a not found!
476 abort: repository a not found!
472 [255]
477 [255]
473
478
474 No remote source
479 No remote source
475
480
476 $ hg clone http://127.0.0.1:3121/a b
481 $ hg clone http://127.0.0.1:3121/a b
477 abort: error: *refused* (glob)
482 abort: error: *refused* (glob)
478 [255]
483 [255]
479 $ rm -rf b # work around bug with http clone
484 $ rm -rf b # work around bug with http clone
480
485
481
486
482 #if unix-permissions
487 #if unix-permissions
483
488
484 Inaccessible source
489 Inaccessible source
485
490
486 $ mkdir a
491 $ mkdir a
487 $ chmod 000 a
492 $ chmod 000 a
488 $ hg clone a b
493 $ hg clone a b
489 abort: repository a not found!
494 abort: repository a not found!
490 [255]
495 [255]
491
496
492 Inaccessible destination
497 Inaccessible destination
493
498
494 $ hg init b
499 $ hg init b
495 $ cd b
500 $ cd b
496 $ hg clone . ../a
501 $ hg clone . ../a
497 abort: Permission denied: ../a
502 abort: Permission denied: ../a
498 [255]
503 [255]
499 $ cd ..
504 $ cd ..
500 $ chmod 700 a
505 $ chmod 700 a
501 $ rm -r a b
506 $ rm -r a b
502
507
503 #endif
508 #endif
504
509
505
510
506 #if fifo
511 #if fifo
507
512
508 Source of wrong type
513 Source of wrong type
509
514
510 $ mkfifo a
515 $ mkfifo a
511 $ hg clone a b
516 $ hg clone a b
512 abort: repository a not found!
517 abort: repository a not found!
513 [255]
518 [255]
514 $ rm a
519 $ rm a
515
520
516 #endif
521 #endif
517
522
518 Default destination, same directory
523 Default destination, same directory
519
524
520 $ hg init q
525 $ hg init q
521 $ hg clone q
526 $ hg clone q
522 destination directory: q
527 destination directory: q
523 abort: destination 'q' is not empty
528 abort: destination 'q' is not empty
524 [255]
529 [255]
525
530
526 destination directory not empty
531 destination directory not empty
527
532
528 $ mkdir a
533 $ mkdir a
529 $ echo stuff > a/a
534 $ echo stuff > a/a
530 $ hg clone q a
535 $ hg clone q a
531 abort: destination 'a' is not empty
536 abort: destination 'a' is not empty
532 [255]
537 [255]
533
538
534
539
535 #if unix-permissions
540 #if unix-permissions
536
541
537 leave existing directory in place after clone failure
542 leave existing directory in place after clone failure
538
543
539 $ hg init c
544 $ hg init c
540 $ cd c
545 $ cd c
541 $ echo c > c
546 $ echo c > c
542 $ hg commit -A -m test
547 $ hg commit -A -m test
543 adding c
548 adding c
544 $ chmod -rx .hg/store/data
549 $ chmod -rx .hg/store/data
545 $ cd ..
550 $ cd ..
546 $ mkdir d
551 $ mkdir d
547 $ hg clone c d 2> err
552 $ hg clone c d 2> err
548 [255]
553 [255]
549 $ test -d d
554 $ test -d d
550 $ test -d d/.hg
555 $ test -d d/.hg
551 [1]
556 [1]
552
557
553 reenable perm to allow deletion
558 reenable perm to allow deletion
554
559
555 $ chmod +rx c/.hg/store/data
560 $ chmod +rx c/.hg/store/data
556
561
557 #endif
562 #endif
558
563
559 $ cd ..
564 $ cd ..
@@ -1,302 +1,306 b''
1 Set vars:
1 Set vars:
2
2
3 $ CONTRIBDIR="$TESTDIR/../contrib"
3 $ CONTRIBDIR="$TESTDIR/../contrib"
4
4
5 Prepare repo-a:
5 Prepare repo-a:
6
6
7 $ hg init repo-a
7 $ hg init repo-a
8 $ cd repo-a
8 $ cd repo-a
9
9
10 $ echo this is file a > a
10 $ echo this is file a > a
11 $ hg add a
11 $ hg add a
12 $ hg commit -m first
12 $ hg commit -m first
13
13
14 $ echo adding to file a >> a
14 $ echo adding to file a >> a
15 $ hg commit -m second
15 $ hg commit -m second
16
16
17 $ echo adding more to file a >> a
17 $ echo adding more to file a >> a
18 $ hg commit -m third
18 $ hg commit -m third
19
19
20 $ hg verify
20 $ hg verify
21 checking changesets
21 checking changesets
22 checking manifests
22 checking manifests
23 crosschecking files in changesets and manifests
23 crosschecking files in changesets and manifests
24 checking files
24 checking files
25 1 files, 3 changesets, 3 total revisions
25 1 files, 3 changesets, 3 total revisions
26
26
27 Dumping revlog of file a to stdout:
27 Dumping revlog of file a to stdout:
28
28
29 $ python "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
29 $ python "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i
30 file: .hg/store/data/a.i
30 file: .hg/store/data/a.i
31 node: 183d2312b35066fb6b3b449b84efc370d50993d0
31 node: 183d2312b35066fb6b3b449b84efc370d50993d0
32 linkrev: 0
32 linkrev: 0
33 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
33 parents: 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
34 length: 15
34 length: 15
35 -start-
35 -start-
36 this is file a
36 this is file a
37
37
38 -end-
38 -end-
39 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
39 node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b
40 linkrev: 1
40 linkrev: 1
41 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
41 parents: 183d2312b35066fb6b3b449b84efc370d50993d0 0000000000000000000000000000000000000000
42 length: 32
42 length: 32
43 -start-
43 -start-
44 this is file a
44 this is file a
45 adding to file a
45 adding to file a
46
46
47 -end-
47 -end-
48 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
48 node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1
49 linkrev: 2
49 linkrev: 2
50 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
50 parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b 0000000000000000000000000000000000000000
51 length: 54
51 length: 54
52 -start-
52 -start-
53 this is file a
53 this is file a
54 adding to file a
54 adding to file a
55 adding more to file a
55 adding more to file a
56
56
57 -end-
57 -end-
58
58
59 Dump all revlogs to file repo.dump:
59 Dump all revlogs to file repo.dump:
60
60
61 $ find .hg/store -name "*.i" | sort | xargs python "$CONTRIBDIR/dumprevlog" > ../repo.dump
61 $ find .hg/store -name "*.i" | sort | xargs python "$CONTRIBDIR/dumprevlog" > ../repo.dump
62 $ cd ..
62 $ cd ..
63
63
64 Undumping into repo-b:
64 Undumping into repo-b:
65
65
66 $ hg init repo-b
66 $ hg init repo-b
67 $ cd repo-b
67 $ cd repo-b
68 $ python "$CONTRIBDIR/undumprevlog" < ../repo.dump
68 $ python "$CONTRIBDIR/undumprevlog" < ../repo.dump
69 .hg/store/00changelog.i
69 .hg/store/00changelog.i
70 .hg/store/00manifest.i
70 .hg/store/00manifest.i
71 .hg/store/data/a.i
71 .hg/store/data/a.i
72 $ cd ..
72 $ cd ..
73
73
74 Rebuild fncache with clone --pull:
74 Rebuild fncache with clone --pull:
75
75
76 $ hg clone --pull -U repo-b repo-c
76 $ hg clone --pull -U repo-b repo-c
77 requesting all changes
77 requesting all changes
78 adding changesets
78 adding changesets
79 adding manifests
79 adding manifests
80 adding file changes
80 adding file changes
81 added 3 changesets with 3 changes to 1 files
81 added 3 changesets with 3 changes to 1 files
82
82
83 Verify:
83 Verify:
84
84
85 $ hg -R repo-c verify
85 $ hg -R repo-c verify
86 checking changesets
86 checking changesets
87 checking manifests
87 checking manifests
88 crosschecking files in changesets and manifests
88 crosschecking files in changesets and manifests
89 checking files
89 checking files
90 1 files, 3 changesets, 3 total revisions
90 1 files, 3 changesets, 3 total revisions
91
91
92 Compare repos:
92 Compare repos:
93
93
94 $ hg -R repo-c incoming repo-a
94 $ hg -R repo-c incoming repo-a
95 comparing with repo-a
95 comparing with repo-a
96 searching for changes
96 searching for changes
97 no changes found
97 no changes found
98 [1]
98 [1]
99
99
100 $ hg -R repo-a incoming repo-c
100 $ hg -R repo-a incoming repo-c
101 comparing with repo-c
101 comparing with repo-c
102 searching for changes
102 searching for changes
103 no changes found
103 no changes found
104 [1]
104 [1]
105
105
106
106
107 #if hardlink
108
107 Test shrink-revlog:
109 Test shrink-revlog:
108 $ cd repo-a
110 $ cd repo-a
109 $ hg --config extensions.shrink="$CONTRIBDIR/shrink-revlog.py" shrink
111 $ hg --config extensions.shrink="$CONTRIBDIR/shrink-revlog.py" shrink
110 shrinking $TESTTMP/repo-a/.hg/store/00manifest.i (glob)
112 shrinking $TESTTMP/repo-a/.hg/store/00manifest.i (glob)
111 reading revs
113 reading revs
112 sorting revs
114 sorting revs
113 writing revs
115 writing revs
114 old file size: 324 bytes ( 0.0 MiB)
116 old file size: 324 bytes ( 0.0 MiB)
115 new file size: 324 bytes ( 0.0 MiB)
117 new file size: 324 bytes ( 0.0 MiB)
116 shrinkage: 0.0% (1.0x)
118 shrinkage: 0.0% (1.0x)
117 note: old revlog saved in:
119 note: old revlog saved in:
118 $TESTTMP/repo-a/.hg/store/00manifest.i.old (glob)
120 $TESTTMP/repo-a/.hg/store/00manifest.i.old (glob)
119 $TESTTMP/repo-a/.hg/store/00manifest.d.old (glob)
121 $TESTTMP/repo-a/.hg/store/00manifest.d.old (glob)
120 (You can delete those files when you are satisfied that your
122 (You can delete those files when you are satisfied that your
121 repository is still sane. Running 'hg verify' is strongly recommended.)
123 repository is still sane. Running 'hg verify' is strongly recommended.)
122 $ hg verify
124 $ hg verify
123 checking changesets
125 checking changesets
124 checking manifests
126 checking manifests
125 crosschecking files in changesets and manifests
127 crosschecking files in changesets and manifests
126 checking files
128 checking files
127 1 files, 3 changesets, 3 total revisions
129 1 files, 3 changesets, 3 total revisions
128 $ cd ..
130 $ cd ..
129
131
132 #endif
133
130 Test simplemerge command:
134 Test simplemerge command:
131
135
132 $ cp "$CONTRIBDIR/simplemerge" .
136 $ cp "$CONTRIBDIR/simplemerge" .
133 $ echo base > base
137 $ echo base > base
134 $ echo local > local
138 $ echo local > local
135 $ cat base >> local
139 $ cat base >> local
136 $ cp local orig
140 $ cp local orig
137 $ cat base > other
141 $ cat base > other
138 $ echo other >> other
142 $ echo other >> other
139
143
140 changing local directly
144 changing local directly
141
145
142 $ python simplemerge local base other && echo "merge succeeded"
146 $ python simplemerge local base other && echo "merge succeeded"
143 merge succeeded
147 merge succeeded
144 $ cat local
148 $ cat local
145 local
149 local
146 base
150 base
147 other
151 other
148 $ cp orig local
152 $ cp orig local
149
153
150 printing to stdout
154 printing to stdout
151
155
152 $ python simplemerge -p local base other
156 $ python simplemerge -p local base other
153 local
157 local
154 base
158 base
155 other
159 other
156
160
157 local:
161 local:
158
162
159 $ cat local
163 $ cat local
160 local
164 local
161 base
165 base
162
166
163 conflicts
167 conflicts
164
168
165 $ cp base conflict-local
169 $ cp base conflict-local
166 $ cp other conflict-other
170 $ cp other conflict-other
167 $ echo not other >> conflict-local
171 $ echo not other >> conflict-local
168 $ echo end >> conflict-local
172 $ echo end >> conflict-local
169 $ echo end >> conflict-other
173 $ echo end >> conflict-other
170 $ python simplemerge -p conflict-local base conflict-other
174 $ python simplemerge -p conflict-local base conflict-other
171 base
175 base
172 <<<<<<< conflict-local
176 <<<<<<< conflict-local
173 not other
177 not other
174 =======
178 =======
175 other
179 other
176 >>>>>>> conflict-other
180 >>>>>>> conflict-other
177 end
181 end
178 warning: conflicts during merge.
182 warning: conflicts during merge.
179 [1]
183 [1]
180
184
181 --no-minimal
185 --no-minimal
182
186
183 $ python simplemerge -p --no-minimal conflict-local base conflict-other
187 $ python simplemerge -p --no-minimal conflict-local base conflict-other
184 base
188 base
185 <<<<<<< conflict-local
189 <<<<<<< conflict-local
186 not other
190 not other
187 end
191 end
188 =======
192 =======
189 other
193 other
190 end
194 end
191 >>>>>>> conflict-other
195 >>>>>>> conflict-other
192 warning: conflicts during merge.
196 warning: conflicts during merge.
193 [1]
197 [1]
194
198
195 1 label
199 1 label
196
200
197 $ python simplemerge -p -L foo conflict-local base conflict-other
201 $ python simplemerge -p -L foo conflict-local base conflict-other
198 base
202 base
199 <<<<<<< foo
203 <<<<<<< foo
200 not other
204 not other
201 =======
205 =======
202 other
206 other
203 >>>>>>> conflict-other
207 >>>>>>> conflict-other
204 end
208 end
205 warning: conflicts during merge.
209 warning: conflicts during merge.
206 [1]
210 [1]
207
211
208 2 labels
212 2 labels
209
213
210 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
214 $ python simplemerge -p -L foo -L bar conflict-local base conflict-other
211 base
215 base
212 <<<<<<< foo
216 <<<<<<< foo
213 not other
217 not other
214 =======
218 =======
215 other
219 other
216 >>>>>>> bar
220 >>>>>>> bar
217 end
221 end
218 warning: conflicts during merge.
222 warning: conflicts during merge.
219 [1]
223 [1]
220
224
221 too many labels
225 too many labels
222
226
223 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
227 $ python simplemerge -p -L foo -L bar -L baz conflict-local base conflict-other
224 abort: can only specify two labels.
228 abort: can only specify two labels.
225 [255]
229 [255]
226
230
227 binary file
231 binary file
228
232
229 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
233 $ python -c "f = file('binary-local', 'w'); f.write('\x00'); f.close()"
230 $ cat orig >> binary-local
234 $ cat orig >> binary-local
231 $ python simplemerge -p binary-local base other
235 $ python simplemerge -p binary-local base other
232 warning: binary-local looks like a binary file.
236 warning: binary-local looks like a binary file.
233 [1]
237 [1]
234
238
235 binary file --text
239 binary file --text
236
240
237 $ python simplemerge -a -p binary-local base other 2>&1
241 $ python simplemerge -a -p binary-local base other 2>&1
238 warning: binary-local looks like a binary file.
242 warning: binary-local looks like a binary file.
239 \x00local (esc)
243 \x00local (esc)
240 base
244 base
241 other
245 other
242
246
243 help
247 help
244
248
245 $ python simplemerge --help
249 $ python simplemerge --help
246 simplemerge [OPTS] LOCAL BASE OTHER
250 simplemerge [OPTS] LOCAL BASE OTHER
247
251
248 Simple three-way file merge utility with a minimal feature set.
252 Simple three-way file merge utility with a minimal feature set.
249
253
250 Apply to LOCAL the changes necessary to go from BASE to OTHER.
254 Apply to LOCAL the changes necessary to go from BASE to OTHER.
251
255
252 By default, LOCAL is overwritten with the results of this operation.
256 By default, LOCAL is overwritten with the results of this operation.
253
257
254 options:
258 options:
255 -L --label labels to use on conflict markers
259 -L --label labels to use on conflict markers
256 -a --text treat all files as text
260 -a --text treat all files as text
257 -p --print print results instead of overwriting LOCAL
261 -p --print print results instead of overwriting LOCAL
258 --no-minimal do not try to minimize conflict regions
262 --no-minimal do not try to minimize conflict regions
259 -h --help display help and exit
263 -h --help display help and exit
260 -q --quiet suppress output
264 -q --quiet suppress output
261
265
262 wrong number of arguments
266 wrong number of arguments
263
267
264 $ python simplemerge
268 $ python simplemerge
265 simplemerge: wrong number of arguments
269 simplemerge: wrong number of arguments
266 simplemerge [OPTS] LOCAL BASE OTHER
270 simplemerge [OPTS] LOCAL BASE OTHER
267
271
268 Simple three-way file merge utility with a minimal feature set.
272 Simple three-way file merge utility with a minimal feature set.
269
273
270 Apply to LOCAL the changes necessary to go from BASE to OTHER.
274 Apply to LOCAL the changes necessary to go from BASE to OTHER.
271
275
272 By default, LOCAL is overwritten with the results of this operation.
276 By default, LOCAL is overwritten with the results of this operation.
273
277
274 options:
278 options:
275 -L --label labels to use on conflict markers
279 -L --label labels to use on conflict markers
276 -a --text treat all files as text
280 -a --text treat all files as text
277 -p --print print results instead of overwriting LOCAL
281 -p --print print results instead of overwriting LOCAL
278 --no-minimal do not try to minimize conflict regions
282 --no-minimal do not try to minimize conflict regions
279 -h --help display help and exit
283 -h --help display help and exit
280 -q --quiet suppress output
284 -q --quiet suppress output
281 [1]
285 [1]
282
286
283 bad option
287 bad option
284
288
285 $ python simplemerge --foo -p local base other
289 $ python simplemerge --foo -p local base other
286 simplemerge: option --foo not recognized
290 simplemerge: option --foo not recognized
287 simplemerge [OPTS] LOCAL BASE OTHER
291 simplemerge [OPTS] LOCAL BASE OTHER
288
292
289 Simple three-way file merge utility with a minimal feature set.
293 Simple three-way file merge utility with a minimal feature set.
290
294
291 Apply to LOCAL the changes necessary to go from BASE to OTHER.
295 Apply to LOCAL the changes necessary to go from BASE to OTHER.
292
296
293 By default, LOCAL is overwritten with the results of this operation.
297 By default, LOCAL is overwritten with the results of this operation.
294
298
295 options:
299 options:
296 -L --label labels to use on conflict markers
300 -L --label labels to use on conflict markers
297 -a --text treat all files as text
301 -a --text treat all files as text
298 -p --print print results instead of overwriting LOCAL
302 -p --print print results instead of overwriting LOCAL
299 --no-minimal do not try to minimize conflict regions
303 --no-minimal do not try to minimize conflict regions
300 -h --help display help and exit
304 -h --help display help and exit
301 -q --quiet suppress output
305 -q --quiet suppress output
302 [1]
306 [1]
@@ -1,349 +1,351 b''
1 $ "$TESTDIR/hghave" hardlink || exit 80
2
1 $ cat > nlinks.py <<EOF
3 $ cat > nlinks.py <<EOF
2 > import sys
4 > import sys
3 > from mercurial import util
5 > from mercurial import util
4 > for f in sorted(sys.stdin.readlines()):
6 > for f in sorted(sys.stdin.readlines()):
5 > f = f[:-1]
7 > f = f[:-1]
6 > print util.nlinks(f), f
8 > print util.nlinks(f), f
7 > EOF
9 > EOF
8
10
9 $ nlinksdir()
11 $ nlinksdir()
10 > {
12 > {
11 > find $1 -type f | python $TESTTMP/nlinks.py
13 > find $1 -type f | python $TESTTMP/nlinks.py
12 > }
14 > }
13
15
14 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
16 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
15
17
16 $ cat > linkcp.py <<EOF
18 $ cat > linkcp.py <<EOF
17 > from mercurial import util
19 > from mercurial import util
18 > import sys
20 > import sys
19 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
21 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
20 > EOF
22 > EOF
21
23
22 $ linkcp()
24 $ linkcp()
23 > {
25 > {
24 > python $TESTTMP/linkcp.py $1 $2
26 > python $TESTTMP/linkcp.py $1 $2
25 > }
27 > }
26
28
27 Prepare repo r1:
29 Prepare repo r1:
28
30
29 $ hg init r1
31 $ hg init r1
30 $ cd r1
32 $ cd r1
31
33
32 $ echo c1 > f1
34 $ echo c1 > f1
33 $ hg add f1
35 $ hg add f1
34 $ hg ci -m0
36 $ hg ci -m0
35
37
36 $ mkdir d1
38 $ mkdir d1
37 $ cd d1
39 $ cd d1
38 $ echo c2 > f2
40 $ echo c2 > f2
39 $ hg add f2
41 $ hg add f2
40 $ hg ci -m1
42 $ hg ci -m1
41 $ cd ../..
43 $ cd ../..
42
44
43 $ nlinksdir r1/.hg/store
45 $ nlinksdir r1/.hg/store
44 1 r1/.hg/store/00changelog.i
46 1 r1/.hg/store/00changelog.i
45 1 r1/.hg/store/00manifest.i
47 1 r1/.hg/store/00manifest.i
46 1 r1/.hg/store/data/d1/f2.i
48 1 r1/.hg/store/data/d1/f2.i
47 1 r1/.hg/store/data/f1.i
49 1 r1/.hg/store/data/f1.i
48 1 r1/.hg/store/fncache
50 1 r1/.hg/store/fncache
49 1 r1/.hg/store/phaseroots
51 1 r1/.hg/store/phaseroots
50 1 r1/.hg/store/undo
52 1 r1/.hg/store/undo
51 1 r1/.hg/store/undo.phaseroots
53 1 r1/.hg/store/undo.phaseroots
52
54
53
55
54 Create hardlinked clone r2:
56 Create hardlinked clone r2:
55
57
56 $ hg clone -U --debug r1 r2
58 $ hg clone -U --debug r1 r2
57 linked 7 files
59 linked 7 files
58
60
59 Create non-hardlinked clone r3:
61 Create non-hardlinked clone r3:
60
62
61 $ hg clone --pull r1 r3
63 $ hg clone --pull r1 r3
62 requesting all changes
64 requesting all changes
63 adding changesets
65 adding changesets
64 adding manifests
66 adding manifests
65 adding file changes
67 adding file changes
66 added 2 changesets with 2 changes to 2 files
68 added 2 changesets with 2 changes to 2 files
67 updating to branch default
69 updating to branch default
68 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
69
71
70
72
71 Repos r1 and r2 should now contain hardlinked files:
73 Repos r1 and r2 should now contain hardlinked files:
72
74
73 $ nlinksdir r1/.hg/store
75 $ nlinksdir r1/.hg/store
74 2 r1/.hg/store/00changelog.i
76 2 r1/.hg/store/00changelog.i
75 2 r1/.hg/store/00manifest.i
77 2 r1/.hg/store/00manifest.i
76 2 r1/.hg/store/data/d1/f2.i
78 2 r1/.hg/store/data/d1/f2.i
77 2 r1/.hg/store/data/f1.i
79 2 r1/.hg/store/data/f1.i
78 2 r1/.hg/store/fncache
80 2 r1/.hg/store/fncache
79 1 r1/.hg/store/phaseroots
81 1 r1/.hg/store/phaseroots
80 1 r1/.hg/store/undo
82 1 r1/.hg/store/undo
81 1 r1/.hg/store/undo.phaseroots
83 1 r1/.hg/store/undo.phaseroots
82
84
83 $ nlinksdir r2/.hg/store
85 $ nlinksdir r2/.hg/store
84 2 r2/.hg/store/00changelog.i
86 2 r2/.hg/store/00changelog.i
85 2 r2/.hg/store/00manifest.i
87 2 r2/.hg/store/00manifest.i
86 2 r2/.hg/store/data/d1/f2.i
88 2 r2/.hg/store/data/d1/f2.i
87 2 r2/.hg/store/data/f1.i
89 2 r2/.hg/store/data/f1.i
88 2 r2/.hg/store/fncache
90 2 r2/.hg/store/fncache
89
91
90 Repo r3 should not be hardlinked:
92 Repo r3 should not be hardlinked:
91
93
92 $ nlinksdir r3/.hg/store
94 $ nlinksdir r3/.hg/store
93 1 r3/.hg/store/00changelog.i
95 1 r3/.hg/store/00changelog.i
94 1 r3/.hg/store/00manifest.i
96 1 r3/.hg/store/00manifest.i
95 1 r3/.hg/store/data/d1/f2.i
97 1 r3/.hg/store/data/d1/f2.i
96 1 r3/.hg/store/data/f1.i
98 1 r3/.hg/store/data/f1.i
97 1 r3/.hg/store/fncache
99 1 r3/.hg/store/fncache
98 1 r3/.hg/store/phaseroots
100 1 r3/.hg/store/phaseroots
99 1 r3/.hg/store/undo
101 1 r3/.hg/store/undo
100 1 r3/.hg/store/undo.phaseroots
102 1 r3/.hg/store/undo.phaseroots
101
103
102
104
103 Create a non-inlined filelog in r3:
105 Create a non-inlined filelog in r3:
104
106
105 $ cd r3/d1
107 $ cd r3/d1
106 >>> f = open('data1', 'wb')
108 >>> f = open('data1', 'wb')
107 >>> for x in range(10000):
109 >>> for x in range(10000):
108 ... f.write("%s\n" % str(x))
110 ... f.write("%s\n" % str(x))
109 >>> f.close()
111 >>> f.close()
110 $ for j in 0 1 2 3 4 5 6 7 8 9; do
112 $ for j in 0 1 2 3 4 5 6 7 8 9; do
111 > cat data1 >> f2
113 > cat data1 >> f2
112 > hg commit -m$j
114 > hg commit -m$j
113 > done
115 > done
114 $ cd ../..
116 $ cd ../..
115
117
116 $ nlinksdir r3/.hg/store
118 $ nlinksdir r3/.hg/store
117 1 r3/.hg/store/00changelog.i
119 1 r3/.hg/store/00changelog.i
118 1 r3/.hg/store/00manifest.i
120 1 r3/.hg/store/00manifest.i
119 1 r3/.hg/store/data/d1/f2.d
121 1 r3/.hg/store/data/d1/f2.d
120 1 r3/.hg/store/data/d1/f2.i
122 1 r3/.hg/store/data/d1/f2.i
121 1 r3/.hg/store/data/f1.i
123 1 r3/.hg/store/data/f1.i
122 1 r3/.hg/store/fncache
124 1 r3/.hg/store/fncache
123 1 r3/.hg/store/phaseroots
125 1 r3/.hg/store/phaseroots
124 1 r3/.hg/store/undo
126 1 r3/.hg/store/undo
125 1 r3/.hg/store/undo.phaseroots
127 1 r3/.hg/store/undo.phaseroots
126
128
127 Push to repo r1 should break up most hardlinks in r2:
129 Push to repo r1 should break up most hardlinks in r2:
128
130
129 $ hg -R r2 verify
131 $ hg -R r2 verify
130 checking changesets
132 checking changesets
131 checking manifests
133 checking manifests
132 crosschecking files in changesets and manifests
134 crosschecking files in changesets and manifests
133 checking files
135 checking files
134 2 files, 2 changesets, 2 total revisions
136 2 files, 2 changesets, 2 total revisions
135
137
136 $ cd r3
138 $ cd r3
137 $ hg push
139 $ hg push
138 pushing to $TESTTMP/r1 (glob)
140 pushing to $TESTTMP/r1 (glob)
139 searching for changes
141 searching for changes
140 adding changesets
142 adding changesets
141 adding manifests
143 adding manifests
142 adding file changes
144 adding file changes
143 added 10 changesets with 10 changes to 1 files
145 added 10 changesets with 10 changes to 1 files
144
146
145 $ cd ..
147 $ cd ..
146
148
147 $ nlinksdir r2/.hg/store
149 $ nlinksdir r2/.hg/store
148 1 r2/.hg/store/00changelog.i
150 1 r2/.hg/store/00changelog.i
149 1 r2/.hg/store/00manifest.i
151 1 r2/.hg/store/00manifest.i
150 1 r2/.hg/store/data/d1/f2.i
152 1 r2/.hg/store/data/d1/f2.i
151 2 r2/.hg/store/data/f1.i
153 2 r2/.hg/store/data/f1.i
152 1 r2/.hg/store/fncache
154 1 r2/.hg/store/fncache
153
155
154 $ hg -R r2 verify
156 $ hg -R r2 verify
155 checking changesets
157 checking changesets
156 checking manifests
158 checking manifests
157 crosschecking files in changesets and manifests
159 crosschecking files in changesets and manifests
158 checking files
160 checking files
159 2 files, 2 changesets, 2 total revisions
161 2 files, 2 changesets, 2 total revisions
160
162
161
163
162 $ cd r1
164 $ cd r1
163 $ hg up
165 $ hg up
164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
165
167
166 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
168 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
167
169
168 $ echo c1c1 >> f1
170 $ echo c1c1 >> f1
169 $ hg ci -m00
171 $ hg ci -m00
170 $ cd ..
172 $ cd ..
171
173
172 $ nlinksdir r2/.hg/store
174 $ nlinksdir r2/.hg/store
173 1 r2/.hg/store/00changelog.i
175 1 r2/.hg/store/00changelog.i
174 1 r2/.hg/store/00manifest.i
176 1 r2/.hg/store/00manifest.i
175 1 r2/.hg/store/data/d1/f2.i
177 1 r2/.hg/store/data/d1/f2.i
176 1 r2/.hg/store/data/f1.i
178 1 r2/.hg/store/data/f1.i
177 1 r2/.hg/store/fncache
179 1 r2/.hg/store/fncache
178
180
179
181
180 $ cd r3
182 $ cd r3
181 $ hg tip --template '{rev}:{node|short}\n'
183 $ hg tip --template '{rev}:{node|short}\n'
182 11:a6451b6bc41f
184 11:a6451b6bc41f
183 $ echo bla > f1
185 $ echo bla > f1
184 $ hg ci -m1
186 $ hg ci -m1
185 $ cd ..
187 $ cd ..
186
188
187 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
189 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
188
190
189 $ linkcp r3 r4
191 $ linkcp r3 r4
190
192
191 r4 has hardlinks in the working dir (not just inside .hg):
193 r4 has hardlinks in the working dir (not just inside .hg):
192
194
193 $ nlinksdir r4
195 $ nlinksdir r4
194 2 r4/.hg/00changelog.i
196 2 r4/.hg/00changelog.i
195 2 r4/.hg/branch
197 2 r4/.hg/branch
196 2 r4/.hg/cache/branchheads
198 2 r4/.hg/cache/branchheads
197 2 r4/.hg/cache/tags
199 2 r4/.hg/cache/tags
198 2 r4/.hg/dirstate
200 2 r4/.hg/dirstate
199 2 r4/.hg/hgrc
201 2 r4/.hg/hgrc
200 2 r4/.hg/last-message.txt
202 2 r4/.hg/last-message.txt
201 2 r4/.hg/requires
203 2 r4/.hg/requires
202 2 r4/.hg/store/00changelog.i
204 2 r4/.hg/store/00changelog.i
203 2 r4/.hg/store/00manifest.i
205 2 r4/.hg/store/00manifest.i
204 2 r4/.hg/store/data/d1/f2.d
206 2 r4/.hg/store/data/d1/f2.d
205 2 r4/.hg/store/data/d1/f2.i
207 2 r4/.hg/store/data/d1/f2.i
206 2 r4/.hg/store/data/f1.i
208 2 r4/.hg/store/data/f1.i
207 2 r4/.hg/store/fncache
209 2 r4/.hg/store/fncache
208 2 r4/.hg/store/phaseroots
210 2 r4/.hg/store/phaseroots
209 2 r4/.hg/store/undo
211 2 r4/.hg/store/undo
210 2 r4/.hg/store/undo.phaseroots
212 2 r4/.hg/store/undo.phaseroots
211 2 r4/.hg/undo.bookmarks
213 2 r4/.hg/undo.bookmarks
212 2 r4/.hg/undo.branch
214 2 r4/.hg/undo.branch
213 2 r4/.hg/undo.desc
215 2 r4/.hg/undo.desc
214 2 r4/.hg/undo.dirstate
216 2 r4/.hg/undo.dirstate
215 2 r4/d1/data1
217 2 r4/d1/data1
216 2 r4/d1/f2
218 2 r4/d1/f2
217 2 r4/f1
219 2 r4/f1
218
220
219 Update back to revision 11 in r4 should break hardlink of file f1:
221 Update back to revision 11 in r4 should break hardlink of file f1:
220
222
221 $ hg -R r4 up 11
223 $ hg -R r4 up 11
222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223
225
224 $ nlinksdir r4
226 $ nlinksdir r4
225 2 r4/.hg/00changelog.i
227 2 r4/.hg/00changelog.i
226 1 r4/.hg/branch
228 1 r4/.hg/branch
227 2 r4/.hg/cache/branchheads
229 2 r4/.hg/cache/branchheads
228 2 r4/.hg/cache/tags
230 2 r4/.hg/cache/tags
229 1 r4/.hg/dirstate
231 1 r4/.hg/dirstate
230 2 r4/.hg/hgrc
232 2 r4/.hg/hgrc
231 2 r4/.hg/last-message.txt
233 2 r4/.hg/last-message.txt
232 2 r4/.hg/requires
234 2 r4/.hg/requires
233 2 r4/.hg/store/00changelog.i
235 2 r4/.hg/store/00changelog.i
234 2 r4/.hg/store/00manifest.i
236 2 r4/.hg/store/00manifest.i
235 2 r4/.hg/store/data/d1/f2.d
237 2 r4/.hg/store/data/d1/f2.d
236 2 r4/.hg/store/data/d1/f2.i
238 2 r4/.hg/store/data/d1/f2.i
237 2 r4/.hg/store/data/f1.i
239 2 r4/.hg/store/data/f1.i
238 2 r4/.hg/store/fncache
240 2 r4/.hg/store/fncache
239 2 r4/.hg/store/phaseroots
241 2 r4/.hg/store/phaseroots
240 2 r4/.hg/store/undo
242 2 r4/.hg/store/undo
241 2 r4/.hg/store/undo.phaseroots
243 2 r4/.hg/store/undo.phaseroots
242 2 r4/.hg/undo.bookmarks
244 2 r4/.hg/undo.bookmarks
243 2 r4/.hg/undo.branch
245 2 r4/.hg/undo.branch
244 2 r4/.hg/undo.desc
246 2 r4/.hg/undo.desc
245 2 r4/.hg/undo.dirstate
247 2 r4/.hg/undo.dirstate
246 2 r4/d1/data1
248 2 r4/d1/data1
247 2 r4/d1/f2
249 2 r4/d1/f2
248 1 r4/f1
250 1 r4/f1
249
251
250
252
251 Test hardlinking outside hg:
253 Test hardlinking outside hg:
252
254
253 $ mkdir x
255 $ mkdir x
254 $ echo foo > x/a
256 $ echo foo > x/a
255
257
256 $ linkcp x y
258 $ linkcp x y
257 $ echo bar >> y/a
259 $ echo bar >> y/a
258
260
259 No diff if hardlink:
261 No diff if hardlink:
260
262
261 $ diff x/a y/a
263 $ diff x/a y/a
262
264
263 Test mq hardlinking:
265 Test mq hardlinking:
264
266
265 $ echo "[extensions]" >> $HGRCPATH
267 $ echo "[extensions]" >> $HGRCPATH
266 $ echo "mq=" >> $HGRCPATH
268 $ echo "mq=" >> $HGRCPATH
267
269
268 $ hg init a
270 $ hg init a
269 $ cd a
271 $ cd a
270
272
271 $ hg qimport -n foo - << EOF
273 $ hg qimport -n foo - << EOF
272 > # HG changeset patch
274 > # HG changeset patch
273 > # Date 1 0
275 > # Date 1 0
274 > diff -r 2588a8b53d66 a
276 > diff -r 2588a8b53d66 a
275 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
277 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
276 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
278 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
277 > @@ -0,0 +1,1 @@
279 > @@ -0,0 +1,1 @@
278 > +a
280 > +a
279 > EOF
281 > EOF
280 adding foo to series file
282 adding foo to series file
281
283
282 $ hg qpush
284 $ hg qpush
283 applying foo
285 applying foo
284 now at: foo
286 now at: foo
285
287
286 $ cd ..
288 $ cd ..
287 $ linkcp a b
289 $ linkcp a b
288 $ cd b
290 $ cd b
289
291
290 $ hg qimport -n bar - << EOF
292 $ hg qimport -n bar - << EOF
291 > # HG changeset patch
293 > # HG changeset patch
292 > # Date 2 0
294 > # Date 2 0
293 > diff -r 2588a8b53d66 a
295 > diff -r 2588a8b53d66 a
294 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
296 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
295 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
297 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
296 > @@ -0,0 +1,1 @@
298 > @@ -0,0 +1,1 @@
297 > +b
299 > +b
298 > EOF
300 > EOF
299 adding bar to series file
301 adding bar to series file
300
302
301 $ hg qpush
303 $ hg qpush
302 applying bar
304 applying bar
303 now at: bar
305 now at: bar
304
306
305 $ cat .hg/patches/status
307 $ cat .hg/patches/status
306 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
308 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
307 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
309 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
308
310
309 $ cat .hg/patches/series
311 $ cat .hg/patches/series
310 foo
312 foo
311 bar
313 bar
312
314
313 $ cat ../a/.hg/patches/status
315 $ cat ../a/.hg/patches/status
314 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
316 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
315
317
316 $ cat ../a/.hg/patches/series
318 $ cat ../a/.hg/patches/series
317 foo
319 foo
318
320
319 Test tags hardlinking:
321 Test tags hardlinking:
320
322
321 $ hg qdel -r qbase:qtip
323 $ hg qdel -r qbase:qtip
322 patch foo finalized without changeset message
324 patch foo finalized without changeset message
323 patch bar finalized without changeset message
325 patch bar finalized without changeset message
324
326
325 $ hg tag -l lfoo
327 $ hg tag -l lfoo
326 $ hg tag foo
328 $ hg tag foo
327
329
328 $ cd ..
330 $ cd ..
329 $ linkcp b c
331 $ linkcp b c
330 $ cd c
332 $ cd c
331
333
332 $ hg tag -l -r 0 lbar
334 $ hg tag -l -r 0 lbar
333 $ hg tag -r 0 bar
335 $ hg tag -r 0 bar
334
336
335 $ cat .hgtags
337 $ cat .hgtags
336 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
338 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
337 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
339 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
338
340
339 $ cat .hg/localtags
341 $ cat .hg/localtags
340 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
342 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
341 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
343 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
342
344
343 $ cat ../b/.hgtags
345 $ cat ../b/.hgtags
344 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
346 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
345
347
346 $ cat ../b/.hg/localtags
348 $ cat ../b/.hg/localtags
347 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
349 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
348
350
349 $ cd ..
351 $ cd ..
@@ -1,98 +1,100 b''
1 $ "$TESTDIR/hghave" hardlink || exit 80
2
1 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "relink=" >> $HGRCPATH
4 $ echo "relink=" >> $HGRCPATH
3
5
4 $ fix_path() {
6 $ fix_path() {
5 > tr '\\' /
7 > tr '\\' /
6 > }
8 > }
7
9
8 $ cat > arelinked.py <<EOF
10 $ cat > arelinked.py <<EOF
9 > import sys, os
11 > import sys, os
10 > from mercurial import util
12 > from mercurial import util
11 > path1, path2 = sys.argv[1:3]
13 > path1, path2 = sys.argv[1:3]
12 > if util.samefile(path1, path2):
14 > if util.samefile(path1, path2):
13 > print '%s == %s' % (path1, path2)
15 > print '%s == %s' % (path1, path2)
14 > else:
16 > else:
15 > print '%s != %s' % (path1, path2)
17 > print '%s != %s' % (path1, path2)
16 > EOF
18 > EOF
17
19
18
20
19 create source repository
21 create source repository
20
22
21 $ hg init repo
23 $ hg init repo
22 $ cd repo
24 $ cd repo
23 $ echo a > a
25 $ echo a > a
24 $ echo b > b
26 $ echo b > b
25 $ hg ci -Am addfile
27 $ hg ci -Am addfile
26 adding a
28 adding a
27 adding b
29 adding b
28 $ cat "$TESTDIR/binfile.bin" >> a
30 $ cat "$TESTDIR/binfile.bin" >> a
29 $ cat "$TESTDIR/binfile.bin" >> b
31 $ cat "$TESTDIR/binfile.bin" >> b
30 $ hg ci -Am changefiles
32 $ hg ci -Am changefiles
31
33
32 make another commit to create files larger than 1 KB to test
34 make another commit to create files larger than 1 KB to test
33 formatting of final byte count
35 formatting of final byte count
34
36
35 $ cat "$TESTDIR/binfile.bin" >> a
37 $ cat "$TESTDIR/binfile.bin" >> a
36 $ cat "$TESTDIR/binfile.bin" >> b
38 $ cat "$TESTDIR/binfile.bin" >> b
37 $ hg ci -m anotherchange
39 $ hg ci -m anotherchange
38
40
39 don't sit forever trying to double-lock the source repo
41 don't sit forever trying to double-lock the source repo
40
42
41 $ hg relink .
43 $ hg relink .
42 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
44 relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store (glob)
43 there is nothing to relink
45 there is nothing to relink
44
46
45
47
46 Test files are read in binary mode
48 Test files are read in binary mode
47
49
48 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
50 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
49 $ cd ..
51 $ cd ..
50
52
51
53
52 clone and pull to break links
54 clone and pull to break links
53
55
54 $ hg clone --pull -r0 repo clone
56 $ hg clone --pull -r0 repo clone
55 adding changesets
57 adding changesets
56 adding manifests
58 adding manifests
57 adding file changes
59 adding file changes
58 added 1 changesets with 2 changes to 2 files
60 added 1 changesets with 2 changes to 2 files
59 updating to branch default
61 updating to branch default
60 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 $ cd clone
63 $ cd clone
62 $ hg pull -q
64 $ hg pull -q
63 $ echo b >> b
65 $ echo b >> b
64 $ hg ci -m changeb
66 $ hg ci -m changeb
65 created new head
67 created new head
66 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
68 $ python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
67
69
68
70
69 relink
71 relink
70
72
71 $ hg relink --debug | fix_path
73 $ hg relink --debug | fix_path
72 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
74 relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store
73 tip has 2 files, estimated total number of files: 3
75 tip has 2 files, estimated total number of files: 3
74 collecting: 00changelog.i 1/3 files (33.33%)
76 collecting: 00changelog.i 1/3 files (33.33%)
75 collecting: 00manifest.i 2/3 files (66.67%)
77 collecting: 00manifest.i 2/3 files (66.67%)
76 collecting: a.i 3/3 files (100.00%)
78 collecting: a.i 3/3 files (100.00%)
77 collecting: b.i 4/3 files (133.33%)
79 collecting: b.i 4/3 files (133.33%)
78 collecting: dummy.i 5/3 files (166.67%)
80 collecting: dummy.i 5/3 files (166.67%)
79 collected 5 candidate storage files
81 collected 5 candidate storage files
80 not linkable: 00changelog.i
82 not linkable: 00changelog.i
81 not linkable: 00manifest.i
83 not linkable: 00manifest.i
82 pruning: data/a.i 3/5 files (60.00%)
84 pruning: data/a.i 3/5 files (60.00%)
83 not linkable: data/b.i
85 not linkable: data/b.i
84 pruning: data/dummy.i 5/5 files (100.00%)
86 pruning: data/dummy.i 5/5 files (100.00%)
85 pruned down to 2 probably relinkable files
87 pruned down to 2 probably relinkable files
86 relinking: data/a.i 1/2 files (50.00%)
88 relinking: data/a.i 1/2 files (50.00%)
87 not linkable: data/dummy.i
89 not linkable: data/dummy.i
88 relinked 1 files (1.37 KB reclaimed)
90 relinked 1 files (1.37 KB reclaimed)
89 $ cd ..
91 $ cd ..
90
92
91
93
92 check hardlinks
94 check hardlinks
93
95
94 $ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
96 $ python arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i
95 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
97 repo/.hg/store/data/a.i == clone/.hg/store/data/a.i
96 $ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
98 $ python arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i
97 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
99 repo/.hg/store/data/b.i != clone/.hg/store/data/b.i
98
100
General Comments 0
You need to be logged in to leave comments. Login now