Show More
@@ -1,322 +1,326 b'' | |||
|
1 | 1 | # archival.py - revision archival for mercurial |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | from i18n import _ |
|
9 | 9 | import match as matchmod |
|
10 | 10 | import cmdutil |
|
11 | 11 | import scmutil, util, encoding |
|
12 | 12 | import cStringIO, os, tarfile, time, zipfile |
|
13 | 13 | import zlib, gzip |
|
14 | 14 | import struct |
|
15 | 15 | import error |
|
16 | 16 | |
|
17 | 17 | # from unzip source code: |
|
18 | 18 | _UNX_IFREG = 0x8000 |
|
19 | 19 | _UNX_IFLNK = 0xa000 |
|
20 | 20 | |
|
21 | 21 | def tidyprefix(dest, kind, prefix): |
|
22 | 22 | '''choose prefix to use for names in archive. make sure prefix is |
|
23 | 23 | safe for consumers.''' |
|
24 | 24 | |
|
25 | 25 | if prefix: |
|
26 | 26 | prefix = util.normpath(prefix) |
|
27 | 27 | else: |
|
28 | 28 | if not isinstance(dest, str): |
|
29 | 29 | raise ValueError('dest must be string if no prefix') |
|
30 | 30 | prefix = os.path.basename(dest) |
|
31 | 31 | lower = prefix.lower() |
|
32 | 32 | for sfx in exts.get(kind, []): |
|
33 | 33 | if lower.endswith(sfx): |
|
34 | 34 | prefix = prefix[:-len(sfx)] |
|
35 | 35 | break |
|
36 | 36 | lpfx = os.path.normpath(util.localpath(prefix)) |
|
37 | 37 | prefix = util.pconvert(lpfx) |
|
38 | 38 | if not prefix.endswith('/'): |
|
39 | 39 | prefix += '/' |
|
40 | # Drop the leading '.' path component if present, so Windows can read the | |
|
41 | # zip files (issue4634) | |
|
42 | if prefix.startswith('./'): | |
|
43 | prefix = prefix[2:] | |
|
40 | 44 | if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: |
|
41 | 45 | raise util.Abort(_('archive prefix contains illegal components')) |
|
42 | 46 | return prefix |
|
43 | 47 | |
|
44 | 48 | exts = { |
|
45 | 49 | 'tar': ['.tar'], |
|
46 | 50 | 'tbz2': ['.tbz2', '.tar.bz2'], |
|
47 | 51 | 'tgz': ['.tgz', '.tar.gz'], |
|
48 | 52 | 'zip': ['.zip'], |
|
49 | 53 | } |
|
50 | 54 | |
|
51 | 55 | def guesskind(dest): |
|
52 | 56 | for kind, extensions in exts.iteritems(): |
|
53 | 57 | if util.any(dest.endswith(ext) for ext in extensions): |
|
54 | 58 | return kind |
|
55 | 59 | return None |
|
56 | 60 | |
|
57 | 61 | def _rootctx(repo): |
|
58 | 62 | # repo[0] may be hidden |
|
59 | 63 | for rev in repo: |
|
60 | 64 | return repo[rev] |
|
61 | 65 | return repo['null'] |
|
62 | 66 | |
|
63 | 67 | def buildmetadata(ctx): |
|
64 | 68 | '''build content of .hg_archival.txt''' |
|
65 | 69 | repo = ctx.repo() |
|
66 | 70 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( |
|
67 | 71 | _rootctx(repo).hex(), ctx.hex(), encoding.fromlocal(ctx.branch())) |
|
68 | 72 | |
|
69 | 73 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() |
|
70 | 74 | if repo.tagtype(t) == 'global') |
|
71 | 75 | if not tags: |
|
72 | 76 | repo.ui.pushbuffer() |
|
73 | 77 | opts = {'template': '{latesttag}\n{latesttagdistance}', |
|
74 | 78 | 'style': '', 'patch': None, 'git': None} |
|
75 | 79 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
|
76 | 80 | ltags, dist = repo.ui.popbuffer().split('\n') |
|
77 | 81 | ltags = ltags.split(':') |
|
78 | 82 | changessince = len(repo.revs('only(.,%s)', ltags[0])) |
|
79 | 83 | tags = ''.join('latesttag: %s\n' % t for t in ltags) |
|
80 | 84 | tags += 'latesttagdistance: %s\n' % dist |
|
81 | 85 | tags += 'changessincelatesttag: %s\n' % changessince |
|
82 | 86 | |
|
83 | 87 | return base + tags |
|
84 | 88 | |
|
85 | 89 | class tarit(object): |
|
86 | 90 | '''write archive to tar file or stream. can write uncompressed, |
|
87 | 91 | or compress with gzip or bzip2.''' |
|
88 | 92 | |
|
89 | 93 | class GzipFileWithTime(gzip.GzipFile): |
|
90 | 94 | |
|
91 | 95 | def __init__(self, *args, **kw): |
|
92 | 96 | timestamp = None |
|
93 | 97 | if 'timestamp' in kw: |
|
94 | 98 | timestamp = kw.pop('timestamp') |
|
95 | 99 | if timestamp is None: |
|
96 | 100 | self.timestamp = time.time() |
|
97 | 101 | else: |
|
98 | 102 | self.timestamp = timestamp |
|
99 | 103 | gzip.GzipFile.__init__(self, *args, **kw) |
|
100 | 104 | |
|
101 | 105 | def _write_gzip_header(self): |
|
102 | 106 | self.fileobj.write('\037\213') # magic header |
|
103 | 107 | self.fileobj.write('\010') # compression method |
|
104 | 108 | # Python 2.6 introduced self.name and deprecated self.filename |
|
105 | 109 | try: |
|
106 | 110 | fname = self.name |
|
107 | 111 | except AttributeError: |
|
108 | 112 | fname = self.filename |
|
109 | 113 | if fname and fname.endswith('.gz'): |
|
110 | 114 | fname = fname[:-3] |
|
111 | 115 | flags = 0 |
|
112 | 116 | if fname: |
|
113 | 117 | flags = gzip.FNAME |
|
114 | 118 | self.fileobj.write(chr(flags)) |
|
115 | 119 | gzip.write32u(self.fileobj, long(self.timestamp)) |
|
116 | 120 | self.fileobj.write('\002') |
|
117 | 121 | self.fileobj.write('\377') |
|
118 | 122 | if fname: |
|
119 | 123 | self.fileobj.write(fname + '\000') |
|
120 | 124 | |
|
121 | 125 | def __init__(self, dest, mtime, kind=''): |
|
122 | 126 | self.mtime = mtime |
|
123 | 127 | self.fileobj = None |
|
124 | 128 | |
|
125 | 129 | def taropen(name, mode, fileobj=None): |
|
126 | 130 | if kind == 'gz': |
|
127 | 131 | mode = mode[0] |
|
128 | 132 | if not fileobj: |
|
129 | 133 | fileobj = open(name, mode + 'b') |
|
130 | 134 | gzfileobj = self.GzipFileWithTime(name, mode + 'b', |
|
131 | 135 | zlib.Z_BEST_COMPRESSION, |
|
132 | 136 | fileobj, timestamp=mtime) |
|
133 | 137 | self.fileobj = gzfileobj |
|
134 | 138 | return tarfile.TarFile.taropen(name, mode, gzfileobj) |
|
135 | 139 | else: |
|
136 | 140 | return tarfile.open(name, mode + kind, fileobj) |
|
137 | 141 | |
|
138 | 142 | if isinstance(dest, str): |
|
139 | 143 | self.z = taropen(dest, mode='w:') |
|
140 | 144 | else: |
|
141 | 145 | # Python 2.5-2.5.1 have a regression that requires a name arg |
|
142 | 146 | self.z = taropen(name='', mode='w|', fileobj=dest) |
|
143 | 147 | |
|
144 | 148 | def addfile(self, name, mode, islink, data): |
|
145 | 149 | i = tarfile.TarInfo(name) |
|
146 | 150 | i.mtime = self.mtime |
|
147 | 151 | i.size = len(data) |
|
148 | 152 | if islink: |
|
149 | 153 | i.type = tarfile.SYMTYPE |
|
150 | 154 | i.mode = 0777 |
|
151 | 155 | i.linkname = data |
|
152 | 156 | data = None |
|
153 | 157 | i.size = 0 |
|
154 | 158 | else: |
|
155 | 159 | i.mode = mode |
|
156 | 160 | data = cStringIO.StringIO(data) |
|
157 | 161 | self.z.addfile(i, data) |
|
158 | 162 | |
|
159 | 163 | def done(self): |
|
160 | 164 | self.z.close() |
|
161 | 165 | if self.fileobj: |
|
162 | 166 | self.fileobj.close() |
|
163 | 167 | |
|
164 | 168 | class tellable(object): |
|
165 | 169 | '''provide tell method for zipfile.ZipFile when writing to http |
|
166 | 170 | response file object.''' |
|
167 | 171 | |
|
168 | 172 | def __init__(self, fp): |
|
169 | 173 | self.fp = fp |
|
170 | 174 | self.offset = 0 |
|
171 | 175 | |
|
172 | 176 | def __getattr__(self, key): |
|
173 | 177 | return getattr(self.fp, key) |
|
174 | 178 | |
|
175 | 179 | def write(self, s): |
|
176 | 180 | self.fp.write(s) |
|
177 | 181 | self.offset += len(s) |
|
178 | 182 | |
|
179 | 183 | def tell(self): |
|
180 | 184 | return self.offset |
|
181 | 185 | |
|
182 | 186 | class zipit(object): |
|
183 | 187 | '''write archive to zip file or stream. can write uncompressed, |
|
184 | 188 | or compressed with deflate.''' |
|
185 | 189 | |
|
186 | 190 | def __init__(self, dest, mtime, compress=True): |
|
187 | 191 | if not isinstance(dest, str): |
|
188 | 192 | try: |
|
189 | 193 | dest.tell() |
|
190 | 194 | except (AttributeError, IOError): |
|
191 | 195 | dest = tellable(dest) |
|
192 | 196 | self.z = zipfile.ZipFile(dest, 'w', |
|
193 | 197 | compress and zipfile.ZIP_DEFLATED or |
|
194 | 198 | zipfile.ZIP_STORED) |
|
195 | 199 | |
|
196 | 200 | # Python's zipfile module emits deprecation warnings if we try |
|
197 | 201 | # to store files with a date before 1980. |
|
198 | 202 | epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0)) |
|
199 | 203 | if mtime < epoch: |
|
200 | 204 | mtime = epoch |
|
201 | 205 | |
|
202 | 206 | self.mtime = mtime |
|
203 | 207 | self.date_time = time.gmtime(mtime)[:6] |
|
204 | 208 | |
|
205 | 209 | def addfile(self, name, mode, islink, data): |
|
206 | 210 | i = zipfile.ZipInfo(name, self.date_time) |
|
207 | 211 | i.compress_type = self.z.compression |
|
208 | 212 | # unzip will not honor unix file modes unless file creator is |
|
209 | 213 | # set to unix (id 3). |
|
210 | 214 | i.create_system = 3 |
|
211 | 215 | ftype = _UNX_IFREG |
|
212 | 216 | if islink: |
|
213 | 217 | mode = 0777 |
|
214 | 218 | ftype = _UNX_IFLNK |
|
215 | 219 | i.external_attr = (mode | ftype) << 16L |
|
216 | 220 | # add "extended-timestamp" extra block, because zip archives |
|
217 | 221 | # without this will be extracted with unexpected timestamp, |
|
218 | 222 | # if TZ is not configured as GMT |
|
219 | 223 | i.extra += struct.pack('<hhBl', |
|
220 | 224 | 0x5455, # block type: "extended-timestamp" |
|
221 | 225 | 1 + 4, # size of this block |
|
222 | 226 | 1, # "modification time is present" |
|
223 | 227 | int(self.mtime)) # last modification (UTC) |
|
224 | 228 | self.z.writestr(i, data) |
|
225 | 229 | |
|
226 | 230 | def done(self): |
|
227 | 231 | self.z.close() |
|
228 | 232 | |
|
229 | 233 | class fileit(object): |
|
230 | 234 | '''write archive as files in directory.''' |
|
231 | 235 | |
|
232 | 236 | def __init__(self, name, mtime): |
|
233 | 237 | self.basedir = name |
|
234 | 238 | self.opener = scmutil.opener(self.basedir) |
|
235 | 239 | |
|
236 | 240 | def addfile(self, name, mode, islink, data): |
|
237 | 241 | if islink: |
|
238 | 242 | self.opener.symlink(data, name) |
|
239 | 243 | return |
|
240 | 244 | f = self.opener(name, "w", atomictemp=True) |
|
241 | 245 | f.write(data) |
|
242 | 246 | f.close() |
|
243 | 247 | destfile = os.path.join(self.basedir, name) |
|
244 | 248 | os.chmod(destfile, mode) |
|
245 | 249 | |
|
246 | 250 | def done(self): |
|
247 | 251 | pass |
|
248 | 252 | |
|
249 | 253 | archivers = { |
|
250 | 254 | 'files': fileit, |
|
251 | 255 | 'tar': tarit, |
|
252 | 256 | 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'), |
|
253 | 257 | 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'), |
|
254 | 258 | 'uzip': lambda name, mtime: zipit(name, mtime, False), |
|
255 | 259 | 'zip': zipit, |
|
256 | 260 | } |
|
257 | 261 | |
|
258 | 262 | def archive(repo, dest, node, kind, decode=True, matchfn=None, |
|
259 | 263 | prefix='', mtime=None, subrepos=False): |
|
260 | 264 | '''create archive of repo as it was at node. |
|
261 | 265 | |
|
262 | 266 | dest can be name of directory, name of archive file, or file |
|
263 | 267 | object to write archive to. |
|
264 | 268 | |
|
265 | 269 | kind is type of archive to create. |
|
266 | 270 | |
|
267 | 271 | decode tells whether to put files through decode filters from |
|
268 | 272 | hgrc. |
|
269 | 273 | |
|
270 | 274 | matchfn is function to filter names of files to write to archive. |
|
271 | 275 | |
|
272 | 276 | prefix is name of path to put before every archive member.''' |
|
273 | 277 | |
|
274 | 278 | if kind == 'files': |
|
275 | 279 | if prefix: |
|
276 | 280 | raise util.Abort(_('cannot give prefix when archiving to files')) |
|
277 | 281 | else: |
|
278 | 282 | prefix = tidyprefix(dest, kind, prefix) |
|
279 | 283 | |
|
280 | 284 | def write(name, mode, islink, getdata): |
|
281 | 285 | data = getdata() |
|
282 | 286 | if decode: |
|
283 | 287 | data = repo.wwritedata(name, data) |
|
284 | 288 | archiver.addfile(prefix + name, mode, islink, data) |
|
285 | 289 | |
|
286 | 290 | if kind not in archivers: |
|
287 | 291 | raise util.Abort(_("unknown archive type '%s'") % kind) |
|
288 | 292 | |
|
289 | 293 | ctx = repo[node] |
|
290 | 294 | archiver = archivers[kind](dest, mtime or ctx.date()[0]) |
|
291 | 295 | |
|
292 | 296 | if repo.ui.configbool("ui", "archivemeta", True): |
|
293 | 297 | name = '.hg_archival.txt' |
|
294 | 298 | if not matchfn or matchfn(name): |
|
295 | 299 | write(name, 0644, False, lambda: buildmetadata(ctx)) |
|
296 | 300 | |
|
297 | 301 | if matchfn: |
|
298 | 302 | files = [f for f in ctx.manifest().keys() if matchfn(f)] |
|
299 | 303 | else: |
|
300 | 304 | files = ctx.manifest().keys() |
|
301 | 305 | total = len(files) |
|
302 | 306 | if total: |
|
303 | 307 | files.sort() |
|
304 | 308 | repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) |
|
305 | 309 | for i, f in enumerate(files): |
|
306 | 310 | ff = ctx.flags(f) |
|
307 | 311 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
|
308 | 312 | repo.ui.progress(_('archiving'), i + 1, item=f, |
|
309 | 313 | unit=_('files'), total=total) |
|
310 | 314 | repo.ui.progress(_('archiving'), None) |
|
311 | 315 | |
|
312 | 316 | if subrepos: |
|
313 | 317 | for subpath in sorted(ctx.substate): |
|
314 | 318 | sub = ctx.sub(subpath) |
|
315 | 319 | submatch = matchmod.narrowmatcher(subpath, matchfn) |
|
316 | 320 | total += sub.archive(archiver, prefix, submatch) |
|
317 | 321 | |
|
318 | 322 | if total == 0: |
|
319 | 323 | raise error.Abort(_('no files match the archive pattern')) |
|
320 | 324 | |
|
321 | 325 | archiver.done() |
|
322 | 326 | return total |
@@ -1,543 +1,543 b'' | |||
|
1 | 1 | Preparing the subrepository 'sub2' |
|
2 | 2 | |
|
3 | 3 | $ hg init sub2 |
|
4 | 4 | $ echo sub2 > sub2/sub2 |
|
5 | 5 | $ hg add -R sub2 |
|
6 | 6 | adding sub2/sub2 (glob) |
|
7 | 7 | $ hg commit -R sub2 -m "sub2 import" |
|
8 | 8 | |
|
9 | 9 | Preparing the 'sub1' repo which depends on the subrepo 'sub2' |
|
10 | 10 | |
|
11 | 11 | $ hg init sub1 |
|
12 | 12 | $ echo sub1 > sub1/sub1 |
|
13 | 13 | $ echo "sub2 = ../sub2" > sub1/.hgsub |
|
14 | 14 | $ hg clone sub2 sub1/sub2 |
|
15 | 15 | updating to branch default |
|
16 | 16 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
17 | 17 | $ hg add -R sub1 |
|
18 | 18 | adding sub1/.hgsub (glob) |
|
19 | 19 | adding sub1/sub1 (glob) |
|
20 | 20 | $ hg commit -R sub1 -m "sub1 import" |
|
21 | 21 | |
|
22 | 22 | Preparing the 'main' repo which depends on the subrepo 'sub1' |
|
23 | 23 | |
|
24 | 24 | $ hg init main |
|
25 | 25 | $ echo main > main/main |
|
26 | 26 | $ echo "sub1 = ../sub1" > main/.hgsub |
|
27 | 27 | $ hg clone sub1 main/sub1 |
|
28 | 28 | updating to branch default |
|
29 | 29 | cloning subrepo sub2 from $TESTTMP/sub2 |
|
30 | 30 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
31 | 31 | $ hg add -R main |
|
32 | 32 | adding main/.hgsub (glob) |
|
33 | 33 | adding main/main (glob) |
|
34 | 34 | $ hg commit -R main -m "main import" |
|
35 | 35 | |
|
36 | 36 | Cleaning both repositories, just as a clone -U |
|
37 | 37 | |
|
38 | 38 | $ hg up -C -R sub2 null |
|
39 | 39 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
40 | 40 | $ hg up -C -R sub1 null |
|
41 | 41 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
42 | 42 | $ hg up -C -R main null |
|
43 | 43 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
44 | 44 | $ rm -rf main/sub1 |
|
45 | 45 | $ rm -rf sub1/sub2 |
|
46 | 46 | |
|
47 | 47 | Clone main |
|
48 | 48 | |
|
49 | 49 | $ hg --config extensions.largefiles= clone main cloned |
|
50 | 50 | updating to branch default |
|
51 | 51 | cloning subrepo sub1 from $TESTTMP/sub1 |
|
52 | 52 | cloning subrepo sub1/sub2 from $TESTTMP/sub2 (glob) |
|
53 | 53 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
54 | 54 | |
|
55 | 55 | Largefiles is NOT enabled in the clone if the source repo doesn't require it |
|
56 | 56 | $ cat cloned/.hg/hgrc |
|
57 | 57 | # example repository config (see "hg help config" for more info) |
|
58 | 58 | [paths] |
|
59 | 59 | default = $TESTTMP/main (glob) |
|
60 | 60 | |
|
61 | 61 | # path aliases to other clones of this repo in URLs or filesystem paths |
|
62 | 62 | # (see "hg help config.paths" for more info) |
|
63 | 63 | # |
|
64 | 64 | # default-push = ssh://jdoe@example.net/hg/jdoes-fork |
|
65 | 65 | # my-fork = ssh://jdoe@example.net/hg/jdoes-fork |
|
66 | 66 | # my-clone = /home/jdoe/jdoes-clone |
|
67 | 67 | |
|
68 | 68 | [ui] |
|
69 | 69 | # name and email (local to this repository, optional), e.g. |
|
70 | 70 | # username = Jane Doe <jdoe@example.com> |
|
71 | 71 | |
|
72 | 72 | Checking cloned repo ids |
|
73 | 73 | |
|
74 | 74 | $ printf "cloned " ; hg id -R cloned |
|
75 | 75 | cloned 7f491f53a367 tip |
|
76 | 76 | $ printf "cloned/sub1 " ; hg id -R cloned/sub1 |
|
77 | 77 | cloned/sub1 fc3b4ce2696f tip |
|
78 | 78 | $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2 |
|
79 | 79 | cloned/sub1/sub2 c57a0840e3ba tip |
|
80 | 80 | |
|
81 | 81 | debugsub output for main and sub1 |
|
82 | 82 | |
|
83 | 83 | $ hg debugsub -R cloned |
|
84 | 84 | path sub1 |
|
85 | 85 | source ../sub1 |
|
86 | 86 | revision fc3b4ce2696f7741438c79207583768f2ce6b0dd |
|
87 | 87 | $ hg debugsub -R cloned/sub1 |
|
88 | 88 | path sub2 |
|
89 | 89 | source ../sub2 |
|
90 | 90 | revision c57a0840e3badd667ef3c3ef65471609acb2ba3c |
|
91 | 91 | |
|
92 | 92 | Modifying deeply nested 'sub2' |
|
93 | 93 | |
|
94 | 94 | $ echo modified > cloned/sub1/sub2/sub2 |
|
95 | 95 | $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned |
|
96 | 96 | committing subrepository sub1 |
|
97 | 97 | committing subrepository sub1/sub2 (glob) |
|
98 | 98 | |
|
99 | 99 | Checking modified node ids |
|
100 | 100 | |
|
101 | 101 | $ printf "cloned " ; hg id -R cloned |
|
102 | 102 | cloned ffe6649062fe tip |
|
103 | 103 | $ printf "cloned/sub1 " ; hg id -R cloned/sub1 |
|
104 | 104 | cloned/sub1 2ecb03bf44a9 tip |
|
105 | 105 | $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2 |
|
106 | 106 | cloned/sub1/sub2 53dd3430bcaf tip |
|
107 | 107 | |
|
108 | 108 | debugsub output for main and sub1 |
|
109 | 109 | |
|
110 | 110 | $ hg debugsub -R cloned |
|
111 | 111 | path sub1 |
|
112 | 112 | source ../sub1 |
|
113 | 113 | revision 2ecb03bf44a94e749e8669481dd9069526ce7cb9 |
|
114 | 114 | $ hg debugsub -R cloned/sub1 |
|
115 | 115 | path sub2 |
|
116 | 116 | source ../sub2 |
|
117 | 117 | revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487 |
|
118 | 118 | |
|
119 | 119 | Check that deep archiving works |
|
120 | 120 | |
|
121 | 121 | $ cd cloned |
|
122 | 122 | $ echo 'test' > sub1/sub2/test.txt |
|
123 | 123 | $ hg --config extensions.largefiles=! add sub1/sub2/test.txt |
|
124 | 124 | $ mkdir sub1/sub2/folder |
|
125 | 125 | $ echo 'subfolder' > sub1/sub2/folder/test.txt |
|
126 | 126 | $ hg ci -ASm "add test.txt" |
|
127 | 127 | adding sub1/sub2/folder/test.txt |
|
128 | 128 | committing subrepository sub1 |
|
129 | 129 | committing subrepository sub1/sub2 (glob) |
|
130 | 130 | |
|
131 | 131 | .. but first take a detour through some deep removal testing |
|
132 | 132 | |
|
133 | 133 | $ hg remove -S -I 're:.*.txt' . |
|
134 | 134 | removing sub1/sub2/folder/test.txt (glob) |
|
135 | 135 | removing sub1/sub2/test.txt (glob) |
|
136 | 136 | $ hg status -S |
|
137 | 137 | R sub1/sub2/folder/test.txt |
|
138 | 138 | R sub1/sub2/test.txt |
|
139 | 139 | $ hg update -Cq |
|
140 | 140 | $ hg remove -I 're:.*.txt' sub1 |
|
141 | 141 | $ hg status -S |
|
142 | 142 | $ hg remove sub1/sub2/folder/test.txt |
|
143 | 143 | $ hg remove sub1/.hgsubstate |
|
144 | 144 | $ mv sub1/.hgsub sub1/x.hgsub |
|
145 | 145 | $ hg status -S |
|
146 | 146 | warning: subrepo spec file 'sub1/.hgsub' not found (glob) |
|
147 | 147 | R sub1/.hgsubstate |
|
148 | 148 | R sub1/sub2/folder/test.txt |
|
149 | 149 | ! sub1/.hgsub |
|
150 | 150 | ? sub1/x.hgsub |
|
151 | 151 | $ mv sub1/x.hgsub sub1/.hgsub |
|
152 | 152 | $ hg update -Cq |
|
153 | 153 | $ touch sub1/foo |
|
154 | 154 | $ hg forget sub1/sub2/folder/test.txt |
|
155 | 155 | $ rm sub1/sub2/test.txt |
|
156 | 156 | |
|
157 | 157 | Test relative path printing + subrepos |
|
158 | 158 | $ mkdir -p foo/bar |
|
159 | 159 | $ cd foo |
|
160 | 160 | $ touch bar/abc |
|
161 | 161 | $ hg addremove -S .. |
|
162 | 162 | adding ../sub1/sub2/folder/test.txt (glob) |
|
163 | 163 | removing ../sub1/sub2/test.txt (glob) |
|
164 | 164 | adding ../sub1/foo (glob) |
|
165 | 165 | adding bar/abc (glob) |
|
166 | 166 | $ cd .. |
|
167 | 167 | $ hg status -S |
|
168 | 168 | A foo/bar/abc |
|
169 | 169 | A sub1/foo |
|
170 | 170 | R sub1/sub2/test.txt |
|
171 | 171 | $ hg update -Cq |
|
172 | 172 | $ touch sub1/sub2/folder/bar |
|
173 | 173 | $ hg addremove sub1/sub2 |
|
174 | 174 | adding sub1/sub2/folder/bar (glob) |
|
175 | 175 | $ hg status -S |
|
176 | 176 | A sub1/sub2/folder/bar |
|
177 | 177 | ? foo/bar/abc |
|
178 | 178 | ? sub1/foo |
|
179 | 179 | $ hg update -Cq |
|
180 | 180 | $ hg addremove sub1 |
|
181 | 181 | adding sub1/sub2/folder/bar (glob) |
|
182 | 182 | adding sub1/foo (glob) |
|
183 | 183 | $ hg update -Cq |
|
184 | 184 | $ rm sub1/sub2/folder/test.txt |
|
185 | 185 | $ rm sub1/sub2/test.txt |
|
186 | 186 | $ hg ci -ASm "remove test.txt" |
|
187 | 187 | adding sub1/sub2/folder/bar |
|
188 | 188 | removing sub1/sub2/folder/test.txt |
|
189 | 189 | removing sub1/sub2/test.txt |
|
190 | 190 | adding sub1/foo |
|
191 | 191 | adding foo/bar/abc |
|
192 | 192 | committing subrepository sub1 |
|
193 | 193 | committing subrepository sub1/sub2 (glob) |
|
194 | 194 | |
|
195 | 195 | $ hg forget sub1/sub2/sub2 |
|
196 | 196 | $ echo x > sub1/sub2/x.txt |
|
197 | 197 | $ hg add sub1/sub2/x.txt |
|
198 | 198 | |
|
199 | 199 | Files sees uncommitted adds and removes in subrepos |
|
200 | 200 | $ hg files -S |
|
201 | 201 | .hgsub |
|
202 | 202 | .hgsubstate |
|
203 | 203 | foo/bar/abc (glob) |
|
204 | 204 | main |
|
205 | 205 | sub1/.hgsub (glob) |
|
206 | 206 | sub1/.hgsubstate (glob) |
|
207 | 207 | sub1/foo (glob) |
|
208 | 208 | sub1/sub1 (glob) |
|
209 | 209 | sub1/sub2/folder/bar (glob) |
|
210 | 210 | sub1/sub2/x.txt (glob) |
|
211 | 211 | |
|
212 | 212 | $ hg rollback -q |
|
213 | 213 | $ hg up -Cq |
|
214 | 214 | |
|
215 | 215 | $ hg --config extensions.largefiles=! archive -S ../archive_all |
|
216 | 216 | $ find ../archive_all | sort |
|
217 | 217 | ../archive_all |
|
218 | 218 | ../archive_all/.hg_archival.txt |
|
219 | 219 | ../archive_all/.hgsub |
|
220 | 220 | ../archive_all/.hgsubstate |
|
221 | 221 | ../archive_all/main |
|
222 | 222 | ../archive_all/sub1 |
|
223 | 223 | ../archive_all/sub1/.hgsub |
|
224 | 224 | ../archive_all/sub1/.hgsubstate |
|
225 | 225 | ../archive_all/sub1/sub1 |
|
226 | 226 | ../archive_all/sub1/sub2 |
|
227 | 227 | ../archive_all/sub1/sub2/folder |
|
228 | 228 | ../archive_all/sub1/sub2/folder/test.txt |
|
229 | 229 | ../archive_all/sub1/sub2/sub2 |
|
230 | 230 | ../archive_all/sub1/sub2/test.txt |
|
231 | 231 | |
|
232 | 232 | Check that archive -X works in deep subrepos |
|
233 | 233 | |
|
234 | 234 | $ hg --config extensions.largefiles=! archive -S -X '**test*' ../archive_exclude |
|
235 | 235 | $ find ../archive_exclude | sort |
|
236 | 236 | ../archive_exclude |
|
237 | 237 | ../archive_exclude/.hg_archival.txt |
|
238 | 238 | ../archive_exclude/.hgsub |
|
239 | 239 | ../archive_exclude/.hgsubstate |
|
240 | 240 | ../archive_exclude/main |
|
241 | 241 | ../archive_exclude/sub1 |
|
242 | 242 | ../archive_exclude/sub1/.hgsub |
|
243 | 243 | ../archive_exclude/sub1/.hgsubstate |
|
244 | 244 | ../archive_exclude/sub1/sub1 |
|
245 | 245 | ../archive_exclude/sub1/sub2 |
|
246 | 246 | ../archive_exclude/sub1/sub2/sub2 |
|
247 | 247 | |
|
248 | 248 | $ hg --config extensions.largefiles=! archive -S -I '**test*' ../archive_include |
|
249 | 249 | $ find ../archive_include | sort |
|
250 | 250 | ../archive_include |
|
251 | 251 | ../archive_include/sub1 |
|
252 | 252 | ../archive_include/sub1/sub2 |
|
253 | 253 | ../archive_include/sub1/sub2/folder |
|
254 | 254 | ../archive_include/sub1/sub2/folder/test.txt |
|
255 | 255 | ../archive_include/sub1/sub2/test.txt |
|
256 | 256 | |
|
257 | 257 | Check that deep archive works with largefiles (which overrides hgsubrepo impl) |
|
258 | 258 | This also tests the repo.ui regression in 43fb170a23bd, and that lf subrepo |
|
259 | 259 | subrepos are archived properly. |
|
260 | 260 | Note that add --large through a subrepo currently adds the file as a normal file |
|
261 | 261 | |
|
262 | 262 | $ echo "large" > sub1/sub2/large.bin |
|
263 | 263 | $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin |
|
264 | 264 | $ echo "large" > large.bin |
|
265 | 265 | $ hg --config extensions.largefiles= add --large large.bin |
|
266 | 266 | $ hg --config extensions.largefiles= ci -S -m "add large files" |
|
267 | 267 | committing subrepository sub1 |
|
268 | 268 | committing subrepository sub1/sub2 (glob) |
|
269 | 269 | |
|
270 | 270 | $ hg --config extensions.largefiles= archive -S ../archive_lf |
|
271 | 271 | $ find ../archive_lf | sort |
|
272 | 272 | ../archive_lf |
|
273 | 273 | ../archive_lf/.hg_archival.txt |
|
274 | 274 | ../archive_lf/.hgsub |
|
275 | 275 | ../archive_lf/.hgsubstate |
|
276 | 276 | ../archive_lf/large.bin |
|
277 | 277 | ../archive_lf/main |
|
278 | 278 | ../archive_lf/sub1 |
|
279 | 279 | ../archive_lf/sub1/.hgsub |
|
280 | 280 | ../archive_lf/sub1/.hgsubstate |
|
281 | 281 | ../archive_lf/sub1/sub1 |
|
282 | 282 | ../archive_lf/sub1/sub2 |
|
283 | 283 | ../archive_lf/sub1/sub2/folder |
|
284 | 284 | ../archive_lf/sub1/sub2/folder/test.txt |
|
285 | 285 | ../archive_lf/sub1/sub2/large.bin |
|
286 | 286 | ../archive_lf/sub1/sub2/sub2 |
|
287 | 287 | ../archive_lf/sub1/sub2/test.txt |
|
288 | 288 | $ rm -rf ../archive_lf |
|
289 | 289 | |
|
290 | 290 | Exclude large files from main and sub-sub repo |
|
291 | 291 | |
|
292 | 292 | $ hg --config extensions.largefiles= archive -S -X '**.bin' ../archive_lf |
|
293 | 293 | $ find ../archive_lf | sort |
|
294 | 294 | ../archive_lf |
|
295 | 295 | ../archive_lf/.hg_archival.txt |
|
296 | 296 | ../archive_lf/.hgsub |
|
297 | 297 | ../archive_lf/.hgsubstate |
|
298 | 298 | ../archive_lf/main |
|
299 | 299 | ../archive_lf/sub1 |
|
300 | 300 | ../archive_lf/sub1/.hgsub |
|
301 | 301 | ../archive_lf/sub1/.hgsubstate |
|
302 | 302 | ../archive_lf/sub1/sub1 |
|
303 | 303 | ../archive_lf/sub1/sub2 |
|
304 | 304 | ../archive_lf/sub1/sub2/folder |
|
305 | 305 | ../archive_lf/sub1/sub2/folder/test.txt |
|
306 | 306 | ../archive_lf/sub1/sub2/sub2 |
|
307 | 307 | ../archive_lf/sub1/sub2/test.txt |
|
308 | 308 | $ rm -rf ../archive_lf |
|
309 | 309 | |
|
310 | 310 | Exclude normal files from main and sub-sub repo |
|
311 | 311 | |
|
312 | $ hg --config extensions.largefiles= archive -S -X '**.txt' ../archive_lf.tgz | |
|
312 | $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz | |
|
313 | 313 | $ tar -tzf ../archive_lf.tgz | sort |
|
314 | archive_lf/.hgsub | |
|
315 |
|
|
|
316 |
|
|
|
317 | archive_lf/main | |
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
314 | .hgsub | |
|
315 | .hgsubstate | |
|
316 | large.bin | |
|
317 | main | |
|
318 | sub1/.hgsub | |
|
319 | sub1/.hgsubstate | |
|
320 | sub1/sub1 | |
|
321 | sub1/sub2/large.bin | |
|
322 | sub1/sub2/sub2 | |
|
323 | 323 | |
|
324 | 324 | Include normal files from within a largefiles subrepo |
|
325 | 325 | |
|
326 | 326 | $ hg --config extensions.largefiles= archive -S -I '**.txt' ../archive_lf |
|
327 | 327 | $ find ../archive_lf | sort |
|
328 | 328 | ../archive_lf |
|
329 | 329 | ../archive_lf/.hg_archival.txt |
|
330 | 330 | ../archive_lf/sub1 |
|
331 | 331 | ../archive_lf/sub1/sub2 |
|
332 | 332 | ../archive_lf/sub1/sub2/folder |
|
333 | 333 | ../archive_lf/sub1/sub2/folder/test.txt |
|
334 | 334 | ../archive_lf/sub1/sub2/test.txt |
|
335 | 335 | $ rm -rf ../archive_lf |
|
336 | 336 | |
|
337 | 337 | Include large files from within a largefiles subrepo |
|
338 | 338 | |
|
339 | 339 | $ hg --config extensions.largefiles= archive -S -I '**.bin' ../archive_lf |
|
340 | 340 | $ find ../archive_lf | sort |
|
341 | 341 | ../archive_lf |
|
342 | 342 | ../archive_lf/large.bin |
|
343 | 343 | ../archive_lf/sub1 |
|
344 | 344 | ../archive_lf/sub1/sub2 |
|
345 | 345 | ../archive_lf/sub1/sub2/large.bin |
|
346 | 346 | $ rm -rf ../archive_lf |
|
347 | 347 | |
|
348 | 348 | Find an exact largefile match in a largefiles subrepo |
|
349 | 349 | |
|
350 | 350 | $ hg --config extensions.largefiles= archive -S -I 'sub1/sub2/large.bin' ../archive_lf |
|
351 | 351 | $ find ../archive_lf | sort |
|
352 | 352 | ../archive_lf |
|
353 | 353 | ../archive_lf/sub1 |
|
354 | 354 | ../archive_lf/sub1/sub2 |
|
355 | 355 | ../archive_lf/sub1/sub2/large.bin |
|
356 | 356 | $ rm -rf ../archive_lf |
|
357 | 357 | |
|
358 | 358 | The local repo enables largefiles if a largefiles repo is cloned |
|
359 | 359 | $ hg showconfig extensions |
|
360 | 360 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
361 | 361 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
362 | 362 | [255] |
|
363 | 363 | $ hg --config extensions.largefiles= clone -qU . ../lfclone |
|
364 | 364 | $ cat ../lfclone/.hg/hgrc |
|
365 | 365 | # example repository config (see "hg help config" for more info) |
|
366 | 366 | [paths] |
|
367 | 367 | default = $TESTTMP/cloned (glob) |
|
368 | 368 | |
|
369 | 369 | # path aliases to other clones of this repo in URLs or filesystem paths |
|
370 | 370 | # (see "hg help config.paths" for more info) |
|
371 | 371 | # |
|
372 | 372 | # default-push = ssh://jdoe@example.net/hg/jdoes-fork |
|
373 | 373 | # my-fork = ssh://jdoe@example.net/hg/jdoes-fork |
|
374 | 374 | # my-clone = /home/jdoe/jdoes-clone |
|
375 | 375 | |
|
376 | 376 | [ui] |
|
377 | 377 | # name and email (local to this repository, optional), e.g. |
|
378 | 378 | # username = Jane Doe <jdoe@example.com> |
|
379 | 379 | |
|
380 | 380 | [extensions] |
|
381 | 381 | largefiles= |
|
382 | 382 | |
|
383 | 383 | Find an exact match to a standin (should archive nothing) |
|
384 | 384 | $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf |
|
385 | 385 | $ find ../archive_lf 2> /dev/null | sort |
|
386 | 386 | |
|
387 | 387 | $ cat >> $HGRCPATH <<EOF |
|
388 | 388 | > [extensions] |
|
389 | 389 | > largefiles= |
|
390 | 390 | > [largefiles] |
|
391 | 391 | > patterns=glob:**.dat |
|
392 | 392 | > EOF |
|
393 | 393 | |
|
394 | 394 | Test forget through a deep subrepo with the largefiles extension, both a |
|
395 | 395 | largefile and a normal file. Then a largefile that hasn't been committed yet. |
|
396 | 396 | $ touch sub1/sub2/untracked.txt |
|
397 | 397 | $ touch sub1/sub2/large.dat |
|
398 | 398 | $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt |
|
399 | 399 | not removing sub1/sub2/untracked.txt: file is already untracked (glob) |
|
400 | 400 | [1] |
|
401 | 401 | $ hg add --large --dry-run -v sub1/sub2/untracked.txt |
|
402 | 402 | adding sub1/sub2/untracked.txt as a largefile (glob) |
|
403 | 403 | $ hg add --large -v sub1/sub2/untracked.txt |
|
404 | 404 | adding sub1/sub2/untracked.txt as a largefile (glob) |
|
405 | 405 | $ hg add --normal -v sub1/sub2/large.dat |
|
406 | 406 | adding sub1/sub2/large.dat (glob) |
|
407 | 407 | $ hg forget -v sub1/sub2/untracked.txt |
|
408 | 408 | removing sub1/sub2/untracked.txt (glob) |
|
409 | 409 | $ hg status -S |
|
410 | 410 | A sub1/sub2/large.dat |
|
411 | 411 | R sub1/sub2/large.bin |
|
412 | 412 | R sub1/sub2/test.txt |
|
413 | 413 | ? foo/bar/abc |
|
414 | 414 | ? sub1/sub2/untracked.txt |
|
415 | 415 | ? sub1/sub2/x.txt |
|
416 | 416 | $ hg add sub1/sub2 |
|
417 | 417 | $ hg ci -Sqm 'forget testing' |
|
418 | 418 | |
|
419 | 419 | Test issue4330: commit a directory where only normal files have changed |
|
420 | 420 | $ touch foo/bar/large.dat |
|
421 | 421 | $ hg add --large foo/bar/large.dat |
|
422 | 422 | $ hg ci -m 'add foo/bar/large.dat' |
|
423 | 423 | $ touch a.txt |
|
424 | 424 | $ touch a.dat |
|
425 | 425 | $ hg add -v foo/bar/abc a.txt a.dat |
|
426 | 426 | adding a.dat as a largefile |
|
427 | 427 | adding a.txt |
|
428 | 428 | adding foo/bar/abc (glob) |
|
429 | 429 | $ hg ci -m 'dir commit with only normal file deltas' foo/bar |
|
430 | 430 | $ hg status |
|
431 | 431 | A a.dat |
|
432 | 432 | A a.txt |
|
433 | 433 | |
|
434 | 434 | Test a directory commit with a changed largefile and a changed normal file |
|
435 | 435 | $ echo changed > foo/bar/large.dat |
|
436 | 436 | $ echo changed > foo/bar/abc |
|
437 | 437 | $ hg ci -m 'dir commit with normal and lf file deltas' foo |
|
438 | 438 | $ hg status |
|
439 | 439 | A a.dat |
|
440 | 440 | A a.txt |
|
441 | 441 | |
|
442 | 442 | $ hg ci -m "add a.*" |
|
443 | 443 | $ hg mv a.dat b.dat |
|
444 | 444 | $ hg mv foo/bar/abc foo/bar/def |
|
445 | 445 | $ hg status -C |
|
446 | 446 | A b.dat |
|
447 | 447 | a.dat |
|
448 | 448 | A foo/bar/def |
|
449 | 449 | foo/bar/abc |
|
450 | 450 | R a.dat |
|
451 | 451 | R foo/bar/abc |
|
452 | 452 | |
|
453 | 453 | $ hg ci -m "move large and normal" |
|
454 | 454 | $ hg status -C --rev '.^' --rev . |
|
455 | 455 | A b.dat |
|
456 | 456 | a.dat |
|
457 | 457 | A foo/bar/def |
|
458 | 458 | foo/bar/abc |
|
459 | 459 | R a.dat |
|
460 | 460 | R foo/bar/abc |
|
461 | 461 | |
|
462 | 462 | |
|
463 | 463 | $ echo foo > main |
|
464 | 464 | $ hg ci -m "mod parent only" |
|
465 | 465 | $ hg init sub3 |
|
466 | 466 | $ echo "sub3 = sub3" >> .hgsub |
|
467 | 467 | $ echo xyz > sub3/a.txt |
|
468 | 468 | $ hg add sub3/a.txt |
|
469 | 469 | $ hg ci -Sm "add sub3" |
|
470 | 470 | committing subrepository sub3 |
|
471 | 471 | $ cat .hgsub | grep -v sub3 > .hgsub1 |
|
472 | 472 | $ mv .hgsub1 .hgsub |
|
473 | 473 | $ hg ci -m "remove sub3" |
|
474 | 474 | |
|
475 | 475 | $ hg log -r "subrepo()" --style compact |
|
476 | 476 | 0 7f491f53a367 1970-01-01 00:00 +0000 test |
|
477 | 477 | main import |
|
478 | 478 | |
|
479 | 479 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test |
|
480 | 480 | deep nested modif should trigger a commit |
|
481 | 481 | |
|
482 | 482 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test |
|
483 | 483 | add test.txt |
|
484 | 484 | |
|
485 | 485 | 3 7c64f035294f 1970-01-01 00:00 +0000 test |
|
486 | 486 | add large files |
|
487 | 487 | |
|
488 | 488 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test |
|
489 | 489 | forget testing |
|
490 | 490 | |
|
491 | 491 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
492 | 492 | add sub3 |
|
493 | 493 | |
|
494 | 494 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
495 | 495 | remove sub3 |
|
496 | 496 | |
|
497 | 497 | $ hg log -r "subrepo('sub3')" --style compact |
|
498 | 498 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
499 | 499 | add sub3 |
|
500 | 500 | |
|
501 | 501 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
502 | 502 | remove sub3 |
|
503 | 503 | |
|
504 | 504 | $ hg log -r "subrepo('bogus')" --style compact |
|
505 | 505 | |
|
506 | 506 | |
|
507 | 507 | Test .hgsubstate in the R state |
|
508 | 508 | |
|
509 | 509 | $ hg rm .hgsub .hgsubstate |
|
510 | 510 | $ hg ci -m 'trash subrepo tracking' |
|
511 | 511 | |
|
512 | 512 | $ hg log -r "subrepo('re:sub\d+')" --style compact |
|
513 | 513 | 0 7f491f53a367 1970-01-01 00:00 +0000 test |
|
514 | 514 | main import |
|
515 | 515 | |
|
516 | 516 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test |
|
517 | 517 | deep nested modif should trigger a commit |
|
518 | 518 | |
|
519 | 519 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test |
|
520 | 520 | add test.txt |
|
521 | 521 | |
|
522 | 522 | 3 7c64f035294f 1970-01-01 00:00 +0000 test |
|
523 | 523 | add large files |
|
524 | 524 | |
|
525 | 525 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test |
|
526 | 526 | forget testing |
|
527 | 527 | |
|
528 | 528 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
529 | 529 | add sub3 |
|
530 | 530 | |
|
531 | 531 | 12 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
532 | 532 | remove sub3 |
|
533 | 533 | |
|
534 | 534 | 13[tip] a68b2c361653 1970-01-01 00:00 +0000 test |
|
535 | 535 | trash subrepo tracking |
|
536 | 536 | |
|
537 | 537 | |
|
538 | 538 | Restore the trashed subrepo tracking |
|
539 | 539 | |
|
540 | 540 | $ hg rollback -q |
|
541 | 541 | $ hg update -Cq . |
|
542 | 542 | |
|
543 | 543 | $ cd .. |
@@ -1,1125 +1,1125 b'' | |||
|
1 | 1 | #require git |
|
2 | 2 | |
|
3 | 3 | make git commits repeatable |
|
4 | 4 | |
|
5 | 5 | $ echo "[core]" >> $HOME/.gitconfig |
|
6 | 6 | $ echo "autocrlf = false" >> $HOME/.gitconfig |
|
7 | 7 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
8 | 8 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
9 | 9 | $ GIT_AUTHOR_DATE='1234567891 +0000'; export GIT_AUTHOR_DATE |
|
10 | 10 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
11 | 11 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
12 | 12 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
13 | 13 | $ GIT_CONFIG_NOSYSTEM=1; export GIT_CONFIG_NOSYSTEM |
|
14 | 14 | |
|
15 | 15 | root hg repo |
|
16 | 16 | |
|
17 | 17 | $ hg init t |
|
18 | 18 | $ cd t |
|
19 | 19 | $ echo a > a |
|
20 | 20 | $ hg add a |
|
21 | 21 | $ hg commit -m a |
|
22 | 22 | $ cd .. |
|
23 | 23 | |
|
24 | 24 | new external git repo |
|
25 | 25 | |
|
26 | 26 | $ mkdir gitroot |
|
27 | 27 | $ cd gitroot |
|
28 | 28 | $ git init -q |
|
29 | 29 | $ echo g > g |
|
30 | 30 | $ git add g |
|
31 | 31 | $ git commit -q -m g |
|
32 | 32 | |
|
33 | 33 | add subrepo clone |
|
34 | 34 | |
|
35 | 35 | $ cd ../t |
|
36 | 36 | $ echo 's = [git]../gitroot' > .hgsub |
|
37 | 37 | $ git clone -q ../gitroot s |
|
38 | 38 | $ hg add .hgsub |
|
39 | 39 | $ hg commit -m 'new git subrepo' |
|
40 | 40 | $ hg debugsub |
|
41 | 41 | path s |
|
42 | 42 | source ../gitroot |
|
43 | 43 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
44 | 44 | |
|
45 | 45 | record a new commit from upstream from a different branch |
|
46 | 46 | |
|
47 | 47 | $ cd ../gitroot |
|
48 | 48 | $ git checkout -q -b testing |
|
49 | 49 | $ echo gg >> g |
|
50 | 50 | $ git commit -q -a -m gg |
|
51 | 51 | |
|
52 | 52 | $ cd ../t/s |
|
53 | 53 | $ git pull -q >/dev/null 2>/dev/null |
|
54 | 54 | $ git checkout -q -b testing origin/testing >/dev/null |
|
55 | 55 | |
|
56 | 56 | $ cd .. |
|
57 | 57 | $ hg status --subrepos |
|
58 | 58 | M s/g |
|
59 | 59 | $ hg commit -m 'update git subrepo' |
|
60 | 60 | $ hg debugsub |
|
61 | 61 | path s |
|
62 | 62 | source ../gitroot |
|
63 | 63 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
64 | 64 | |
|
65 | 65 | make $GITROOT pushable, by replacing it with a clone with nothing checked out |
|
66 | 66 | |
|
67 | 67 | $ cd .. |
|
68 | 68 | $ git clone gitroot gitrootbare --bare -q |
|
69 | 69 | $ rm -rf gitroot |
|
70 | 70 | $ mv gitrootbare gitroot |
|
71 | 71 | |
|
72 | 72 | clone root |
|
73 | 73 | |
|
74 | 74 | $ cd t |
|
75 | 75 | $ hg clone . ../tc 2> /dev/null |
|
76 | 76 | updating to branch default |
|
77 | 77 | cloning subrepo s from $TESTTMP/gitroot |
|
78 | 78 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
79 | 79 | $ cd ../tc |
|
80 | 80 | $ hg debugsub |
|
81 | 81 | path s |
|
82 | 82 | source ../gitroot |
|
83 | 83 | revision 126f2a14290cd5ce061fdedc430170e8d39e1c5a |
|
84 | 84 | |
|
85 | 85 | update to previous substate |
|
86 | 86 | |
|
87 | 87 | $ hg update 1 -q |
|
88 | 88 | $ cat s/g |
|
89 | 89 | g |
|
90 | 90 | $ hg debugsub |
|
91 | 91 | path s |
|
92 | 92 | source ../gitroot |
|
93 | 93 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
94 | 94 | |
|
95 | 95 | clone root, make local change |
|
96 | 96 | |
|
97 | 97 | $ cd ../t |
|
98 | 98 | $ hg clone . ../ta 2> /dev/null |
|
99 | 99 | updating to branch default |
|
100 | 100 | cloning subrepo s from $TESTTMP/gitroot |
|
101 | 101 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | |
|
103 | 103 | $ cd ../ta |
|
104 | 104 | $ echo ggg >> s/g |
|
105 | 105 | $ hg status --subrepos |
|
106 | 106 | M s/g |
|
107 | 107 | $ hg diff --subrepos |
|
108 | 108 | diff --git a/s/g b/s/g |
|
109 | 109 | index 089258f..85341ee 100644 |
|
110 | 110 | --- a/s/g |
|
111 | 111 | +++ b/s/g |
|
112 | 112 | @@ -1,2 +1,3 @@ |
|
113 | 113 | g |
|
114 | 114 | gg |
|
115 | 115 | +ggg |
|
116 | 116 | $ hg commit --subrepos -m ggg |
|
117 | 117 | committing subrepository s |
|
118 | 118 | $ hg debugsub |
|
119 | 119 | path s |
|
120 | 120 | source ../gitroot |
|
121 | 121 | revision 79695940086840c99328513acbe35f90fcd55e57 |
|
122 | 122 | |
|
123 | 123 | clone root separately, make different local change |
|
124 | 124 | |
|
125 | 125 | $ cd ../t |
|
126 | 126 | $ hg clone . ../tb 2> /dev/null |
|
127 | 127 | updating to branch default |
|
128 | 128 | cloning subrepo s from $TESTTMP/gitroot |
|
129 | 129 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
130 | 130 | |
|
131 | 131 | $ cd ../tb/s |
|
132 | 132 | $ hg status --subrepos |
|
133 | 133 | $ echo f > f |
|
134 | 134 | $ hg status --subrepos |
|
135 | 135 | ? s/f |
|
136 | 136 | $ hg add . |
|
137 | 137 | adding f |
|
138 | 138 | $ git add f |
|
139 | 139 | $ cd .. |
|
140 | 140 | |
|
141 | 141 | $ hg status --subrepos |
|
142 | 142 | A s/f |
|
143 | 143 | $ hg commit --subrepos -m f |
|
144 | 144 | committing subrepository s |
|
145 | 145 | $ hg debugsub |
|
146 | 146 | path s |
|
147 | 147 | source ../gitroot |
|
148 | 148 | revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
149 | 149 | |
|
150 | 150 | user b push changes |
|
151 | 151 | |
|
152 | 152 | $ hg push 2>/dev/null |
|
153 | 153 | pushing to $TESTTMP/t (glob) |
|
154 | 154 | pushing branch testing of subrepo s |
|
155 | 155 | searching for changes |
|
156 | 156 | adding changesets |
|
157 | 157 | adding manifests |
|
158 | 158 | adding file changes |
|
159 | 159 | added 1 changesets with 1 changes to 1 files |
|
160 | 160 | |
|
161 | 161 | user a pulls, merges, commits |
|
162 | 162 | |
|
163 | 163 | $ cd ../ta |
|
164 | 164 | $ hg pull |
|
165 | 165 | pulling from $TESTTMP/t (glob) |
|
166 | 166 | searching for changes |
|
167 | 167 | adding changesets |
|
168 | 168 | adding manifests |
|
169 | 169 | adding file changes |
|
170 | 170 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
171 | 171 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
172 | 172 | $ hg merge 2>/dev/null |
|
173 | 173 | subrepository s diverged (local revision: 7969594, remote revision: aa84837) |
|
174 | 174 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
175 | 175 | pulling subrepo s from $TESTTMP/gitroot |
|
176 | 176 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
177 | 177 | (branch merge, don't forget to commit) |
|
178 | 178 | $ hg st --subrepos s |
|
179 | 179 | A s/f |
|
180 | 180 | $ cat s/f |
|
181 | 181 | f |
|
182 | 182 | $ cat s/g |
|
183 | 183 | g |
|
184 | 184 | gg |
|
185 | 185 | ggg |
|
186 | 186 | $ hg commit --subrepos -m 'merge' |
|
187 | 187 | committing subrepository s |
|
188 | 188 | $ hg status --subrepos --rev 1:5 |
|
189 | 189 | M .hgsubstate |
|
190 | 190 | M s/g |
|
191 | 191 | A s/f |
|
192 | 192 | $ hg debugsub |
|
193 | 193 | path s |
|
194 | 194 | source ../gitroot |
|
195 | 195 | revision f47b465e1bce645dbf37232a00574aa1546ca8d3 |
|
196 | 196 | $ hg push 2>/dev/null |
|
197 | 197 | pushing to $TESTTMP/t (glob) |
|
198 | 198 | pushing branch testing of subrepo s |
|
199 | 199 | searching for changes |
|
200 | 200 | adding changesets |
|
201 | 201 | adding manifests |
|
202 | 202 | adding file changes |
|
203 | 203 | added 2 changesets with 2 changes to 1 files |
|
204 | 204 | |
|
205 | 205 | make upstream git changes |
|
206 | 206 | |
|
207 | 207 | $ cd .. |
|
208 | 208 | $ git clone -q gitroot gitclone |
|
209 | 209 | $ cd gitclone |
|
210 | 210 | $ echo ff >> f |
|
211 | 211 | $ git commit -q -a -m ff |
|
212 | 212 | $ echo fff >> f |
|
213 | 213 | $ git commit -q -a -m fff |
|
214 | 214 | $ git push origin testing 2>/dev/null |
|
215 | 215 | |
|
216 | 216 | make and push changes to hg without updating the subrepo |
|
217 | 217 | |
|
218 | 218 | $ cd ../t |
|
219 | 219 | $ hg clone . ../td 2>&1 | egrep -v '^Cloning into|^done\.' |
|
220 | 220 | updating to branch default |
|
221 | 221 | cloning subrepo s from $TESTTMP/gitroot |
|
222 | 222 | checking out detached HEAD in subrepo s |
|
223 | 223 | check out a git branch if you intend to make changes |
|
224 | 224 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
225 | 225 | $ cd ../td |
|
226 | 226 | $ echo aa >> a |
|
227 | 227 | $ hg commit -m aa |
|
228 | 228 | $ hg push |
|
229 | 229 | pushing to $TESTTMP/t (glob) |
|
230 | 230 | searching for changes |
|
231 | 231 | adding changesets |
|
232 | 232 | adding manifests |
|
233 | 233 | adding file changes |
|
234 | 234 | added 1 changesets with 1 changes to 1 files |
|
235 | 235 | |
|
236 | 236 | sync to upstream git, distribute changes |
|
237 | 237 | |
|
238 | 238 | $ cd ../ta |
|
239 | 239 | $ hg pull -u -q |
|
240 | 240 | $ cd s |
|
241 | 241 | $ git pull -q >/dev/null 2>/dev/null |
|
242 | 242 | $ cd .. |
|
243 | 243 | $ hg commit -m 'git upstream sync' |
|
244 | 244 | $ hg debugsub |
|
245 | 245 | path s |
|
246 | 246 | source ../gitroot |
|
247 | 247 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
248 | 248 | $ hg push -q |
|
249 | 249 | |
|
250 | 250 | $ cd ../tb |
|
251 | 251 | $ hg pull -q |
|
252 | 252 | $ hg update 2>/dev/null |
|
253 | 253 | pulling subrepo s from $TESTTMP/gitroot |
|
254 | 254 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
255 | 255 | $ hg debugsub |
|
256 | 256 | path s |
|
257 | 257 | source ../gitroot |
|
258 | 258 | revision 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
259 | 259 | |
|
260 | 260 | create a new git branch |
|
261 | 261 | |
|
262 | 262 | $ cd s |
|
263 | 263 | $ git checkout -b b2 |
|
264 | 264 | Switched to a new branch 'b2' |
|
265 | 265 | $ echo a>a |
|
266 | 266 | $ git add a |
|
267 | 267 | $ git commit -qm 'add a' |
|
268 | 268 | $ cd .. |
|
269 | 269 | $ hg commit -m 'add branch in s' |
|
270 | 270 | |
|
271 | 271 | pulling new git branch should not create tracking branch named 'origin/b2' |
|
272 | 272 | (issue3870) |
|
273 | 273 | $ cd ../td/s |
|
274 | 274 | $ git remote set-url origin $TESTTMP/tb/s |
|
275 | 275 | $ git branch --no-track oldtesting |
|
276 | 276 | $ cd .. |
|
277 | 277 | $ hg pull -q ../tb |
|
278 | 278 | $ hg up |
|
279 | 279 | From $TESTTMP/tb/s |
|
280 | 280 | * [new branch] b2 -> origin/b2 |
|
281 | 281 | Previous HEAD position was f47b465... merge |
|
282 | 282 | Switched to a new branch 'b2' |
|
283 | 283 | pulling subrepo s from $TESTTMP/tb/s |
|
284 | 284 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
285 | 285 | |
|
286 | 286 | update to a revision without the subrepo, keeping the local git repository |
|
287 | 287 | |
|
288 | 288 | $ cd ../t |
|
289 | 289 | $ hg up 0 |
|
290 | 290 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
291 | 291 | $ ls -a s |
|
292 | 292 | . |
|
293 | 293 | .. |
|
294 | 294 | .git |
|
295 | 295 | |
|
296 | 296 | $ hg up 2 |
|
297 | 297 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
298 | 298 | $ ls -a s |
|
299 | 299 | . |
|
300 | 300 | .. |
|
301 | 301 | .git |
|
302 | 302 | g |
|
303 | 303 | |
|
304 | 304 | archive subrepos |
|
305 | 305 | |
|
306 | 306 | $ cd ../tc |
|
307 | 307 | $ hg pull -q |
|
308 | 308 | $ hg archive --subrepos -r 5 ../archive 2>/dev/null |
|
309 | 309 | pulling subrepo s from $TESTTMP/gitroot |
|
310 | 310 | $ cd ../archive |
|
311 | 311 | $ cat s/f |
|
312 | 312 | f |
|
313 | 313 | $ cat s/g |
|
314 | 314 | g |
|
315 | 315 | gg |
|
316 | 316 | ggg |
|
317 | 317 | |
|
318 | 318 | $ hg -R ../tc archive --subrepo -r 5 -X ../tc/**f ../archive_x 2>/dev/null |
|
319 | 319 | $ find ../archive_x | sort | grep -v pax_global_header |
|
320 | 320 | ../archive_x |
|
321 | 321 | ../archive_x/.hg_archival.txt |
|
322 | 322 | ../archive_x/.hgsub |
|
323 | 323 | ../archive_x/.hgsubstate |
|
324 | 324 | ../archive_x/a |
|
325 | 325 | ../archive_x/s |
|
326 | 326 | ../archive_x/s/g |
|
327 | 327 | |
|
328 | $ hg -R ../tc archive -S ../archive.tgz 2>/dev/null | |
|
328 | $ hg -R ../tc archive -S ../archive.tgz --prefix '.' 2>/dev/null | |
|
329 | 329 | $ tar -tzf ../archive.tgz | sort |
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
|
333 | archive/a | |
|
334 | archive/s/g | |
|
330 | .hg_archival.txt | |
|
331 | .hgsub | |
|
332 | .hgsubstate | |
|
333 | a | |
|
334 | s/g | |
|
335 | 335 | |
|
336 | 336 | create nested repo |
|
337 | 337 | |
|
338 | 338 | $ cd .. |
|
339 | 339 | $ hg init outer |
|
340 | 340 | $ cd outer |
|
341 | 341 | $ echo b>b |
|
342 | 342 | $ hg add b |
|
343 | 343 | $ hg commit -m b |
|
344 | 344 | |
|
345 | 345 | $ hg clone ../t inner 2> /dev/null |
|
346 | 346 | updating to branch default |
|
347 | 347 | cloning subrepo s from $TESTTMP/gitroot |
|
348 | 348 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
349 | 349 | $ echo inner = inner > .hgsub |
|
350 | 350 | $ hg add .hgsub |
|
351 | 351 | $ hg commit -m 'nested sub' |
|
352 | 352 | |
|
353 | 353 | nested commit |
|
354 | 354 | |
|
355 | 355 | $ echo ffff >> inner/s/f |
|
356 | 356 | $ hg status --subrepos |
|
357 | 357 | M inner/s/f |
|
358 | 358 | $ hg commit --subrepos -m nested |
|
359 | 359 | committing subrepository inner |
|
360 | 360 | committing subrepository inner/s (glob) |
|
361 | 361 | |
|
362 | 362 | nested archive |
|
363 | 363 | |
|
364 | 364 | $ hg archive --subrepos ../narchive |
|
365 | 365 | $ ls ../narchive/inner/s | grep -v pax_global_header |
|
366 | 366 | f |
|
367 | 367 | g |
|
368 | 368 | |
|
369 | 369 | relative source expansion |
|
370 | 370 | |
|
371 | 371 | $ cd .. |
|
372 | 372 | $ mkdir d |
|
373 | 373 | $ hg clone t d/t 2> /dev/null |
|
374 | 374 | updating to branch default |
|
375 | 375 | cloning subrepo s from $TESTTMP/gitroot |
|
376 | 376 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
377 | 377 | |
|
378 | 378 | Don't crash if the subrepo is missing |
|
379 | 379 | |
|
380 | 380 | $ hg clone t missing -q |
|
381 | 381 | $ cd missing |
|
382 | 382 | $ rm -rf s |
|
383 | 383 | $ hg status -S |
|
384 | 384 | $ hg sum | grep commit |
|
385 | 385 | commit: 1 subrepos |
|
386 | 386 | $ hg push -q |
|
387 | 387 | abort: subrepo s is missing (in subrepo s) |
|
388 | 388 | [255] |
|
389 | 389 | $ hg commit --subrepos -qm missing |
|
390 | 390 | abort: subrepo s is missing (in subrepo s) |
|
391 | 391 | [255] |
|
392 | 392 | |
|
393 | 393 | #if symlink |
|
394 | 394 | Don't crash if subrepo is a broken symlink |
|
395 | 395 | $ ln -s broken s |
|
396 | 396 | $ hg status -S |
|
397 | 397 | $ hg push -q |
|
398 | 398 | abort: subrepo s is missing (in subrepo s) |
|
399 | 399 | [255] |
|
400 | 400 | $ hg commit --subrepos -qm missing |
|
401 | 401 | abort: subrepo s is missing (in subrepo s) |
|
402 | 402 | [255] |
|
403 | 403 | $ rm s |
|
404 | 404 | #endif |
|
405 | 405 | |
|
406 | 406 | $ hg update -C 2> /dev/null |
|
407 | 407 | cloning subrepo s from $TESTTMP/gitroot |
|
408 | 408 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
409 | 409 | $ hg sum | grep commit |
|
410 | 410 | commit: (clean) |
|
411 | 411 | |
|
412 | 412 | Don't crash if the .hgsubstate entry is missing |
|
413 | 413 | |
|
414 | 414 | $ hg update 1 -q |
|
415 | 415 | $ hg rm .hgsubstate |
|
416 | 416 | $ hg commit .hgsubstate -m 'no substate' |
|
417 | 417 | nothing changed |
|
418 | 418 | [1] |
|
419 | 419 | $ hg tag -l nosubstate |
|
420 | 420 | $ hg manifest |
|
421 | 421 | .hgsub |
|
422 | 422 | .hgsubstate |
|
423 | 423 | a |
|
424 | 424 | |
|
425 | 425 | $ hg status -S |
|
426 | 426 | R .hgsubstate |
|
427 | 427 | $ hg sum | grep commit |
|
428 | 428 | commit: 1 removed, 1 subrepos (new branch head) |
|
429 | 429 | |
|
430 | 430 | $ hg commit -m 'restore substate' |
|
431 | 431 | nothing changed |
|
432 | 432 | [1] |
|
433 | 433 | $ hg manifest |
|
434 | 434 | .hgsub |
|
435 | 435 | .hgsubstate |
|
436 | 436 | a |
|
437 | 437 | $ hg sum | grep commit |
|
438 | 438 | commit: 1 removed, 1 subrepos (new branch head) |
|
439 | 439 | |
|
440 | 440 | $ hg update -qC nosubstate |
|
441 | 441 | $ ls s |
|
442 | 442 | g |
|
443 | 443 | |
|
444 | 444 | issue3109: false positives in git diff-index |
|
445 | 445 | |
|
446 | 446 | $ hg update -q |
|
447 | 447 | $ touch -t 200001010000 s/g |
|
448 | 448 | $ hg status --subrepos |
|
449 | 449 | $ touch -t 200001010000 s/g |
|
450 | 450 | $ hg sum | grep commit |
|
451 | 451 | commit: (clean) |
|
452 | 452 | |
|
453 | 453 | Check hg update --clean |
|
454 | 454 | $ cd $TESTTMP/ta |
|
455 | 455 | $ echo > s/g |
|
456 | 456 | $ cd s |
|
457 | 457 | $ echo c1 > f1 |
|
458 | 458 | $ echo c1 > f2 |
|
459 | 459 | $ git add f1 |
|
460 | 460 | $ cd .. |
|
461 | 461 | $ hg status -S |
|
462 | 462 | M s/g |
|
463 | 463 | A s/f1 |
|
464 | 464 | ? s/f2 |
|
465 | 465 | $ ls s |
|
466 | 466 | f |
|
467 | 467 | f1 |
|
468 | 468 | f2 |
|
469 | 469 | g |
|
470 | 470 | $ hg update --clean |
|
471 | 471 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
472 | 472 | $ hg status -S |
|
473 | 473 | ? s/f1 |
|
474 | 474 | ? s/f2 |
|
475 | 475 | $ ls s |
|
476 | 476 | f |
|
477 | 477 | f1 |
|
478 | 478 | f2 |
|
479 | 479 | g |
|
480 | 480 | |
|
481 | 481 | Sticky subrepositories, no changes |
|
482 | 482 | $ cd $TESTTMP/ta |
|
483 | 483 | $ hg id -n |
|
484 | 484 | 7 |
|
485 | 485 | $ cd s |
|
486 | 486 | $ git rev-parse HEAD |
|
487 | 487 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
488 | 488 | $ cd .. |
|
489 | 489 | $ hg update 1 > /dev/null 2>&1 |
|
490 | 490 | $ hg id -n |
|
491 | 491 | 1 |
|
492 | 492 | $ cd s |
|
493 | 493 | $ git rev-parse HEAD |
|
494 | 494 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
495 | 495 | $ cd .. |
|
496 | 496 | |
|
497 | 497 | Sticky subrepositories, file changes |
|
498 | 498 | $ touch s/f1 |
|
499 | 499 | $ cd s |
|
500 | 500 | $ git add f1 |
|
501 | 501 | $ cd .. |
|
502 | 502 | $ hg id -n |
|
503 | 503 | 1+ |
|
504 | 504 | $ cd s |
|
505 | 505 | $ git rev-parse HEAD |
|
506 | 506 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
507 | 507 | $ cd .. |
|
508 | 508 | $ hg update 4 |
|
509 | 509 | subrepository s diverged (local revision: da5f5b1, remote revision: aa84837) |
|
510 | 510 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
511 | 511 | subrepository sources for s differ |
|
512 | 512 | use (l)ocal source (da5f5b1) or (r)emote source (aa84837)? l |
|
513 | 513 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
514 | 514 | $ hg id -n |
|
515 | 515 | 4+ |
|
516 | 516 | $ cd s |
|
517 | 517 | $ git rev-parse HEAD |
|
518 | 518 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
519 | 519 | $ cd .. |
|
520 | 520 | $ hg update --clean tip > /dev/null 2>&1 |
|
521 | 521 | |
|
522 | 522 | Sticky subrepository, revision updates |
|
523 | 523 | $ hg id -n |
|
524 | 524 | 7 |
|
525 | 525 | $ cd s |
|
526 | 526 | $ git rev-parse HEAD |
|
527 | 527 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
528 | 528 | $ cd .. |
|
529 | 529 | $ cd s |
|
530 | 530 | $ git checkout aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
531 | 531 | Previous HEAD position was 32a3438... fff |
|
532 | 532 | HEAD is now at aa84837... f |
|
533 | 533 | $ cd .. |
|
534 | 534 | $ hg update 1 |
|
535 | 535 | subrepository s diverged (local revision: 32a3438, remote revision: da5f5b1) |
|
536 | 536 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
537 | 537 | subrepository sources for s differ (in checked out version) |
|
538 | 538 | use (l)ocal source (32a3438) or (r)emote source (da5f5b1)? l |
|
539 | 539 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
540 | 540 | $ hg id -n |
|
541 | 541 | 1+ |
|
542 | 542 | $ cd s |
|
543 | 543 | $ git rev-parse HEAD |
|
544 | 544 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
545 | 545 | $ cd .. |
|
546 | 546 | |
|
547 | 547 | Sticky subrepository, file changes and revision updates |
|
548 | 548 | $ touch s/f1 |
|
549 | 549 | $ cd s |
|
550 | 550 | $ git add f1 |
|
551 | 551 | $ git rev-parse HEAD |
|
552 | 552 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
553 | 553 | $ cd .. |
|
554 | 554 | $ hg id -n |
|
555 | 555 | 1+ |
|
556 | 556 | $ hg update 7 |
|
557 | 557 | subrepository s diverged (local revision: 32a3438, remote revision: 32a3438) |
|
558 | 558 | (M)erge, keep (l)ocal or keep (r)emote? m |
|
559 | 559 | subrepository sources for s differ |
|
560 | 560 | use (l)ocal source (32a3438) or (r)emote source (32a3438)? l |
|
561 | 561 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
562 | 562 | $ hg id -n |
|
563 | 563 | 7+ |
|
564 | 564 | $ cd s |
|
565 | 565 | $ git rev-parse HEAD |
|
566 | 566 | aa84837ccfbdfedcdcdeeedc309d73e6eb069edc |
|
567 | 567 | $ cd .. |
|
568 | 568 | |
|
569 | 569 | Sticky repository, update --clean |
|
570 | 570 | $ hg update --clean tip 2>/dev/null |
|
571 | 571 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
572 | 572 | $ hg id -n |
|
573 | 573 | 7 |
|
574 | 574 | $ cd s |
|
575 | 575 | $ git rev-parse HEAD |
|
576 | 576 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
577 | 577 | $ cd .. |
|
578 | 578 | |
|
579 | 579 | Test subrepo already at intended revision: |
|
580 | 580 | $ cd s |
|
581 | 581 | $ git checkout 32a343883b74769118bb1d3b4b1fbf9156f4dddc |
|
582 | 582 | HEAD is now at 32a3438... fff |
|
583 | 583 | $ cd .. |
|
584 | 584 | $ hg update 1 |
|
585 | 585 | Previous HEAD position was 32a3438... fff |
|
586 | 586 | HEAD is now at da5f5b1... g |
|
587 | 587 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
588 | 588 | $ hg id -n |
|
589 | 589 | 1 |
|
590 | 590 | $ cd s |
|
591 | 591 | $ git rev-parse HEAD |
|
592 | 592 | da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
593 | 593 | $ cd .. |
|
594 | 594 | |
|
595 | 595 | Test forgetting files, not implemented in git subrepo, used to |
|
596 | 596 | traceback |
|
597 | 597 | #if no-windows |
|
598 | 598 | $ hg forget 'notafile*' |
|
599 | 599 | notafile*: No such file or directory |
|
600 | 600 | [1] |
|
601 | 601 | #else |
|
602 | 602 | $ hg forget 'notafile' |
|
603 | 603 | notafile: * (glob) |
|
604 | 604 | [1] |
|
605 | 605 | #endif |
|
606 | 606 | |
|
607 | 607 | $ cd .. |
|
608 | 608 | |
|
609 | 609 | Test sanitizing ".hg/hgrc" in subrepo |
|
610 | 610 | |
|
611 | 611 | $ cd t |
|
612 | 612 | $ hg tip -q |
|
613 | 613 | 7:af6d2edbb0d3 |
|
614 | 614 | $ hg update -q -C af6d2edbb0d3 |
|
615 | 615 | $ cd s |
|
616 | 616 | $ git checkout -q -b sanitize-test |
|
617 | 617 | $ mkdir .hg |
|
618 | 618 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
619 | 619 | $ mkdir -p sub/.hg |
|
620 | 620 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
621 | 621 | $ git add .hg sub |
|
622 | 622 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' |
|
623 | 623 | $ git push -q origin sanitize-test |
|
624 | 624 | $ cd .. |
|
625 | 625 | $ grep ' s$' .hgsubstate |
|
626 | 626 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
627 | 627 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
628 | 628 | $ hg parents -q |
|
629 | 629 | 8:3473d20bddcf |
|
630 | 630 | $ grep ' s$' .hgsubstate |
|
631 | 631 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
632 | 632 | $ cd .. |
|
633 | 633 | |
|
634 | 634 | $ hg -R tc pull -q |
|
635 | 635 | $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort |
|
636 | 636 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
637 | 637 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
638 | 638 | $ cd tc |
|
639 | 639 | $ hg parents -q |
|
640 | 640 | 8:3473d20bddcf |
|
641 | 641 | $ grep ' s$' .hgsubstate |
|
642 | 642 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s |
|
643 | 643 | $ test -f s/.hg/hgrc |
|
644 | 644 | [1] |
|
645 | 645 | $ test -f s/sub/.hg/hgrc |
|
646 | 646 | [1] |
|
647 | 647 | $ cd .. |
|
648 | 648 | |
|
649 | 649 | additional test for "git merge --ff" route: |
|
650 | 650 | |
|
651 | 651 | $ cd t |
|
652 | 652 | $ hg tip -q |
|
653 | 653 | 8:3473d20bddcf |
|
654 | 654 | $ hg update -q -C af6d2edbb0d3 |
|
655 | 655 | $ cd s |
|
656 | 656 | $ git checkout -q testing |
|
657 | 657 | $ mkdir .hg |
|
658 | 658 | $ echo '.hg/hgrc in git repo' > .hg/hgrc |
|
659 | 659 | $ mkdir -p sub/.hg |
|
660 | 660 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc |
|
661 | 661 | $ git add .hg sub |
|
662 | 662 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' |
|
663 | 663 | $ git push -q origin testing |
|
664 | 664 | $ cd .. |
|
665 | 665 | $ grep ' s$' .hgsubstate |
|
666 | 666 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
667 | 667 | $ hg commit -qm 'commit with git revision including .hg/hgrc' |
|
668 | 668 | $ hg parents -q |
|
669 | 669 | 9:ed23f7fe024e |
|
670 | 670 | $ grep ' s$' .hgsubstate |
|
671 | 671 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
672 | 672 | $ cd .. |
|
673 | 673 | |
|
674 | 674 | $ cd tc |
|
675 | 675 | $ hg update -q -C af6d2edbb0d3 |
|
676 | 676 | $ test -f s/.hg/hgrc |
|
677 | 677 | [1] |
|
678 | 678 | $ test -f s/sub/.hg/hgrc |
|
679 | 679 | [1] |
|
680 | 680 | $ cd .. |
|
681 | 681 | $ hg -R tc pull -q |
|
682 | 682 | $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort |
|
683 | 683 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) |
|
684 | 684 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) |
|
685 | 685 | $ cd tc |
|
686 | 686 | $ hg parents -q |
|
687 | 687 | 9:ed23f7fe024e |
|
688 | 688 | $ grep ' s$' .hgsubstate |
|
689 | 689 | f262643c1077219fbd3858d54e78ef050ef84fbf s |
|
690 | 690 | $ test -f s/.hg/hgrc |
|
691 | 691 | [1] |
|
692 | 692 | $ test -f s/sub/.hg/hgrc |
|
693 | 693 | [1] |
|
694 | 694 | |
|
695 | 695 | Test that sanitizing is omitted in meta data area: |
|
696 | 696 | |
|
697 | 697 | $ mkdir s/.git/.hg |
|
698 | 698 | $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc |
|
699 | 699 | $ hg update -q -C af6d2edbb0d3 |
|
700 | 700 | checking out detached HEAD in subrepo s |
|
701 | 701 | check out a git branch if you intend to make changes |
|
702 | 702 | |
|
703 | 703 | check differences made by most recent change |
|
704 | 704 | $ cd s |
|
705 | 705 | $ cat > foobar << EOF |
|
706 | 706 | > woopwoop |
|
707 | 707 | > |
|
708 | 708 | > foo |
|
709 | 709 | > bar |
|
710 | 710 | > EOF |
|
711 | 711 | $ git add foobar |
|
712 | 712 | $ cd .. |
|
713 | 713 | |
|
714 | 714 | $ hg diff --subrepos |
|
715 | 715 | diff --git a/s/foobar b/s/foobar |
|
716 | 716 | new file mode 100644 |
|
717 | 717 | index 0000000..8a5a5e2 |
|
718 | 718 | --- /dev/null |
|
719 | 719 | +++ b/s/foobar |
|
720 | 720 | @@ -0,0 +1,4 @@ |
|
721 | 721 | +woopwoop |
|
722 | 722 | + |
|
723 | 723 | +foo |
|
724 | 724 | +bar |
|
725 | 725 | |
|
726 | 726 | $ hg commit --subrepos -m "Added foobar" |
|
727 | 727 | committing subrepository s |
|
728 | 728 | created new head |
|
729 | 729 | |
|
730 | 730 | $ hg diff -c . --subrepos --nodates |
|
731 | 731 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
732 | 732 | --- a/.hgsubstate |
|
733 | 733 | +++ b/.hgsubstate |
|
734 | 734 | @@ -1,1 +1,1 @@ |
|
735 | 735 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
736 | 736 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
737 | 737 | diff --git a/s/foobar b/s/foobar |
|
738 | 738 | new file mode 100644 |
|
739 | 739 | index 0000000..8a5a5e2 |
|
740 | 740 | --- /dev/null |
|
741 | 741 | +++ b/s/foobar |
|
742 | 742 | @@ -0,0 +1,4 @@ |
|
743 | 743 | +woopwoop |
|
744 | 744 | + |
|
745 | 745 | +foo |
|
746 | 746 | +bar |
|
747 | 747 | |
|
748 | 748 | check output when only diffing the subrepository |
|
749 | 749 | $ hg diff -c . --subrepos s |
|
750 | 750 | diff --git a/s/foobar b/s/foobar |
|
751 | 751 | new file mode 100644 |
|
752 | 752 | index 0000000..8a5a5e2 |
|
753 | 753 | --- /dev/null |
|
754 | 754 | +++ b/s/foobar |
|
755 | 755 | @@ -0,0 +1,4 @@ |
|
756 | 756 | +woopwoop |
|
757 | 757 | + |
|
758 | 758 | +foo |
|
759 | 759 | +bar |
|
760 | 760 | |
|
761 | 761 | check output when diffing something else |
|
762 | 762 | $ hg diff -c . --subrepos .hgsubstate --nodates |
|
763 | 763 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate |
|
764 | 764 | --- a/.hgsubstate |
|
765 | 765 | +++ b/.hgsubstate |
|
766 | 766 | @@ -1,1 +1,1 @@ |
|
767 | 767 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s |
|
768 | 768 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s |
|
769 | 769 | |
|
770 | 770 | add new changes, including whitespace |
|
771 | 771 | $ cd s |
|
772 | 772 | $ cat > foobar << EOF |
|
773 | 773 | > woop woop |
|
774 | 774 | > |
|
775 | 775 | > foo |
|
776 | 776 | > bar |
|
777 | 777 | > EOF |
|
778 | 778 | $ echo foo > barfoo |
|
779 | 779 | $ git add barfoo |
|
780 | 780 | $ cd .. |
|
781 | 781 | |
|
782 | 782 | $ hg diff --subrepos --ignore-all-space |
|
783 | 783 | diff --git a/s/barfoo b/s/barfoo |
|
784 | 784 | new file mode 100644 |
|
785 | 785 | index 0000000..257cc56 |
|
786 | 786 | --- /dev/null |
|
787 | 787 | +++ b/s/barfoo |
|
788 | 788 | @@ -0,0 +1 @@ |
|
789 | 789 | +foo |
|
790 | 790 | $ hg diff --subrepos s/foobar |
|
791 | 791 | diff --git a/s/foobar b/s/foobar |
|
792 | 792 | index 8a5a5e2..bd5812a 100644 |
|
793 | 793 | --- a/s/foobar |
|
794 | 794 | +++ b/s/foobar |
|
795 | 795 | @@ -1,4 +1,4 @@ |
|
796 | 796 | -woopwoop |
|
797 | 797 | +woop woop |
|
798 | 798 | |
|
799 | 799 | foo |
|
800 | 800 | bar |
|
801 | 801 | |
|
802 | 802 | execute a diffstat |
|
803 | 803 | the output contains a regex, because git 1.7.10 and 1.7.11 |
|
804 | 804 | change the amount of whitespace |
|
805 | 805 | $ hg diff --subrepos --stat |
|
806 | 806 | \s*barfoo |\s*1 + (re) |
|
807 | 807 | \s*foobar |\s*2 +- (re) |
|
808 | 808 | 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re) |
|
809 | 809 | |
|
810 | 810 | adding an include should ignore the other elements |
|
811 | 811 | $ hg diff --subrepos -I s/foobar |
|
812 | 812 | diff --git a/s/foobar b/s/foobar |
|
813 | 813 | index 8a5a5e2..bd5812a 100644 |
|
814 | 814 | --- a/s/foobar |
|
815 | 815 | +++ b/s/foobar |
|
816 | 816 | @@ -1,4 +1,4 @@ |
|
817 | 817 | -woopwoop |
|
818 | 818 | +woop woop |
|
819 | 819 | |
|
820 | 820 | foo |
|
821 | 821 | bar |
|
822 | 822 | |
|
823 | 823 | adding an exclude should ignore this element |
|
824 | 824 | $ hg diff --subrepos -X s/foobar |
|
825 | 825 | diff --git a/s/barfoo b/s/barfoo |
|
826 | 826 | new file mode 100644 |
|
827 | 827 | index 0000000..257cc56 |
|
828 | 828 | --- /dev/null |
|
829 | 829 | +++ b/s/barfoo |
|
830 | 830 | @@ -0,0 +1 @@ |
|
831 | 831 | +foo |
|
832 | 832 | |
|
833 | 833 | moving a file should show a removal and an add |
|
834 | 834 | $ hg revert --all |
|
835 | 835 | reverting subrepo ../gitroot |
|
836 | 836 | $ cd s |
|
837 | 837 | $ git mv foobar woop |
|
838 | 838 | $ cd .. |
|
839 | 839 | $ hg diff --subrepos |
|
840 | 840 | diff --git a/s/foobar b/s/foobar |
|
841 | 841 | deleted file mode 100644 |
|
842 | 842 | index 8a5a5e2..0000000 |
|
843 | 843 | --- a/s/foobar |
|
844 | 844 | +++ /dev/null |
|
845 | 845 | @@ -1,4 +0,0 @@ |
|
846 | 846 | -woopwoop |
|
847 | 847 | - |
|
848 | 848 | -foo |
|
849 | 849 | -bar |
|
850 | 850 | diff --git a/s/woop b/s/woop |
|
851 | 851 | new file mode 100644 |
|
852 | 852 | index 0000000..8a5a5e2 |
|
853 | 853 | --- /dev/null |
|
854 | 854 | +++ b/s/woop |
|
855 | 855 | @@ -0,0 +1,4 @@ |
|
856 | 856 | +woopwoop |
|
857 | 857 | + |
|
858 | 858 | +foo |
|
859 | 859 | +bar |
|
860 | 860 | $ rm s/woop |
|
861 | 861 | |
|
862 | 862 | revert the subrepository |
|
863 | 863 | $ hg revert --all |
|
864 | 864 | reverting subrepo ../gitroot |
|
865 | 865 | |
|
866 | 866 | $ hg status --subrepos |
|
867 | 867 | ? s/barfoo |
|
868 | 868 | ? s/foobar.orig |
|
869 | 869 | |
|
870 | 870 | $ mv s/foobar.orig s/foobar |
|
871 | 871 | |
|
872 | 872 | $ hg revert --no-backup s |
|
873 | 873 | reverting subrepo ../gitroot |
|
874 | 874 | |
|
875 | 875 | $ hg status --subrepos |
|
876 | 876 | ? s/barfoo |
|
877 | 877 | |
|
878 | 878 | show file at specific revision |
|
879 | 879 | $ cat > s/foobar << EOF |
|
880 | 880 | > woop woop |
|
881 | 881 | > fooo bar |
|
882 | 882 | > EOF |
|
883 | 883 | $ hg commit --subrepos -m "updated foobar" |
|
884 | 884 | committing subrepository s |
|
885 | 885 | $ cat > s/foobar << EOF |
|
886 | 886 | > current foobar |
|
887 | 887 | > (should not be visible using hg cat) |
|
888 | 888 | > EOF |
|
889 | 889 | |
|
890 | 890 | $ hg cat -r . s/foobar |
|
891 | 891 | woop woop |
|
892 | 892 | fooo bar (no-eol) |
|
893 | 893 | $ hg cat -r "parents(.)" s/foobar > catparents |
|
894 | 894 | |
|
895 | 895 | $ mkdir -p tmp/s |
|
896 | 896 | |
|
897 | 897 | $ hg cat -r "parents(.)" --output tmp/%% s/foobar |
|
898 | 898 | $ diff tmp/% catparents |
|
899 | 899 | |
|
900 | 900 | $ hg cat -r "parents(.)" --output tmp/%s s/foobar |
|
901 | 901 | $ diff tmp/foobar catparents |
|
902 | 902 | |
|
903 | 903 | $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar |
|
904 | 904 | $ diff tmp/s/otherfoobar catparents |
|
905 | 905 | |
|
906 | 906 | $ hg cat -r "parents(.)" --output tmp/%p s/foobar |
|
907 | 907 | $ diff tmp/s/foobar catparents |
|
908 | 908 | |
|
909 | 909 | $ hg cat -r "parents(.)" --output tmp/%H s/foobar |
|
910 | 910 | $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents |
|
911 | 911 | |
|
912 | 912 | $ hg cat -r "parents(.)" --output tmp/%R s/foobar |
|
913 | 913 | $ diff tmp/10 catparents |
|
914 | 914 | |
|
915 | 915 | $ hg cat -r "parents(.)" --output tmp/%h s/foobar |
|
916 | 916 | $ diff tmp/255ee8cf690e catparents |
|
917 | 917 | |
|
918 | 918 | $ rm tmp/10 |
|
919 | 919 | $ hg cat -r "parents(.)" --output tmp/%r s/foobar |
|
920 | 920 | $ diff tmp/10 catparents |
|
921 | 921 | |
|
922 | 922 | $ mkdir tmp/tc |
|
923 | 923 | $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar |
|
924 | 924 | $ diff tmp/tc/foobar catparents |
|
925 | 925 | |
|
926 | 926 | cleanup |
|
927 | 927 | $ rm -r tmp |
|
928 | 928 | $ rm catparents |
|
929 | 929 | |
|
930 | 930 | add git files, using either files or patterns |
|
931 | 931 | $ echo "hsss! hsssssssh!" > s/snake.python |
|
932 | 932 | $ echo "ccc" > s/c.c |
|
933 | 933 | $ echo "cpp" > s/cpp.cpp |
|
934 | 934 | |
|
935 | 935 | $ hg add s/snake.python s/c.c s/cpp.cpp |
|
936 | 936 | $ hg st --subrepos s |
|
937 | 937 | M s/foobar |
|
938 | 938 | A s/c.c |
|
939 | 939 | A s/cpp.cpp |
|
940 | 940 | A s/snake.python |
|
941 | 941 | ? s/barfoo |
|
942 | 942 | $ hg revert s |
|
943 | 943 | reverting subrepo ../gitroot |
|
944 | 944 | |
|
945 | 945 | $ hg add --subrepos "glob:**.python" |
|
946 | 946 | adding s/snake.python (glob) |
|
947 | 947 | $ hg st --subrepos s |
|
948 | 948 | A s/snake.python |
|
949 | 949 | ? s/barfoo |
|
950 | 950 | ? s/c.c |
|
951 | 951 | ? s/cpp.cpp |
|
952 | 952 | ? s/foobar.orig |
|
953 | 953 | $ hg revert s |
|
954 | 954 | reverting subrepo ../gitroot |
|
955 | 955 | |
|
956 | 956 | $ hg add --subrepos s |
|
957 | 957 | adding s/barfoo (glob) |
|
958 | 958 | adding s/c.c (glob) |
|
959 | 959 | adding s/cpp.cpp (glob) |
|
960 | 960 | adding s/foobar.orig (glob) |
|
961 | 961 | adding s/snake.python (glob) |
|
962 | 962 | $ hg st --subrepos s |
|
963 | 963 | A s/barfoo |
|
964 | 964 | A s/c.c |
|
965 | 965 | A s/cpp.cpp |
|
966 | 966 | A s/foobar.orig |
|
967 | 967 | A s/snake.python |
|
968 | 968 | $ hg revert s |
|
969 | 969 | reverting subrepo ../gitroot |
|
970 | 970 | make sure everything is reverted correctly |
|
971 | 971 | $ hg st --subrepos s |
|
972 | 972 | ? s/barfoo |
|
973 | 973 | ? s/c.c |
|
974 | 974 | ? s/cpp.cpp |
|
975 | 975 | ? s/foobar.orig |
|
976 | 976 | ? s/snake.python |
|
977 | 977 | |
|
978 | 978 | $ hg add --subrepos --exclude "path:s/c.c" |
|
979 | 979 | adding s/barfoo (glob) |
|
980 | 980 | adding s/cpp.cpp (glob) |
|
981 | 981 | adding s/foobar.orig (glob) |
|
982 | 982 | adding s/snake.python (glob) |
|
983 | 983 | $ hg st --subrepos s |
|
984 | 984 | A s/barfoo |
|
985 | 985 | A s/cpp.cpp |
|
986 | 986 | A s/foobar.orig |
|
987 | 987 | A s/snake.python |
|
988 | 988 | ? s/c.c |
|
989 | 989 | $ hg revert --all -q |
|
990 | 990 | |
|
991 | 991 | .hgignore should not have influence in subrepos |
|
992 | 992 | $ cat > .hgignore << EOF |
|
993 | 993 | > syntax: glob |
|
994 | 994 | > *.python |
|
995 | 995 | > EOF |
|
996 | 996 | $ hg add .hgignore |
|
997 | 997 | $ hg add --subrepos "glob:**.python" s/barfoo |
|
998 | 998 | adding s/snake.python (glob) |
|
999 | 999 | $ hg st --subrepos s |
|
1000 | 1000 | A s/barfoo |
|
1001 | 1001 | A s/snake.python |
|
1002 | 1002 | ? s/c.c |
|
1003 | 1003 | ? s/cpp.cpp |
|
1004 | 1004 | ? s/foobar.orig |
|
1005 | 1005 | $ hg revert --all -q |
|
1006 | 1006 | |
|
1007 | 1007 | .gitignore should have influence, |
|
1008 | 1008 | except for explicitly added files (no patterns) |
|
1009 | 1009 | $ cat > s/.gitignore << EOF |
|
1010 | 1010 | > *.python |
|
1011 | 1011 | > EOF |
|
1012 | 1012 | $ hg add s/.gitignore |
|
1013 | 1013 | $ hg st --subrepos s |
|
1014 | 1014 | A s/.gitignore |
|
1015 | 1015 | ? s/barfoo |
|
1016 | 1016 | ? s/c.c |
|
1017 | 1017 | ? s/cpp.cpp |
|
1018 | 1018 | ? s/foobar.orig |
|
1019 | 1019 | $ hg st --subrepos s --all |
|
1020 | 1020 | A s/.gitignore |
|
1021 | 1021 | ? s/barfoo |
|
1022 | 1022 | ? s/c.c |
|
1023 | 1023 | ? s/cpp.cpp |
|
1024 | 1024 | ? s/foobar.orig |
|
1025 | 1025 | I s/snake.python |
|
1026 | 1026 | C s/f |
|
1027 | 1027 | C s/foobar |
|
1028 | 1028 | C s/g |
|
1029 | 1029 | $ hg add --subrepos "glob:**.python" |
|
1030 | 1030 | $ hg st --subrepos s |
|
1031 | 1031 | A s/.gitignore |
|
1032 | 1032 | ? s/barfoo |
|
1033 | 1033 | ? s/c.c |
|
1034 | 1034 | ? s/cpp.cpp |
|
1035 | 1035 | ? s/foobar.orig |
|
1036 | 1036 | $ hg add --subrepos s/snake.python |
|
1037 | 1037 | $ hg st --subrepos s |
|
1038 | 1038 | A s/.gitignore |
|
1039 | 1039 | A s/snake.python |
|
1040 | 1040 | ? s/barfoo |
|
1041 | 1041 | ? s/c.c |
|
1042 | 1042 | ? s/cpp.cpp |
|
1043 | 1043 | ? s/foobar.orig |
|
1044 | 1044 | |
|
1045 | 1045 | correctly do a dry run |
|
1046 | 1046 | $ hg add --subrepos s --dry-run |
|
1047 | 1047 | adding s/barfoo (glob) |
|
1048 | 1048 | adding s/c.c (glob) |
|
1049 | 1049 | adding s/cpp.cpp (glob) |
|
1050 | 1050 | adding s/foobar.orig (glob) |
|
1051 | 1051 | $ hg st --subrepos s |
|
1052 | 1052 | A s/.gitignore |
|
1053 | 1053 | A s/snake.python |
|
1054 | 1054 | ? s/barfoo |
|
1055 | 1055 | ? s/c.c |
|
1056 | 1056 | ? s/cpp.cpp |
|
1057 | 1057 | ? s/foobar.orig |
|
1058 | 1058 | |
|
1059 | 1059 | error given when adding an already tracked file |
|
1060 | 1060 | $ hg add s/.gitignore |
|
1061 | 1061 | s/.gitignore already tracked! |
|
1062 | 1062 | [1] |
|
1063 | 1063 | $ hg add s/g |
|
1064 | 1064 | s/g already tracked! |
|
1065 | 1065 | [1] |
|
1066 | 1066 | |
|
1067 | 1067 | removed files can be re-added |
|
1068 | 1068 | removing files using 'rm' or 'git rm' has the same effect, |
|
1069 | 1069 | since we ignore the staging area |
|
1070 | 1070 | $ hg ci --subrepos -m 'snake' |
|
1071 | 1071 | committing subrepository s |
|
1072 | 1072 | $ cd s |
|
1073 | 1073 | $ rm snake.python |
|
1074 | 1074 | (remove leftover .hg so Mercurial doesn't look for a root here) |
|
1075 | 1075 | $ rm -rf .hg |
|
1076 | 1076 | $ hg status --subrepos --all . |
|
1077 | 1077 | R snake.python |
|
1078 | 1078 | ? barfoo |
|
1079 | 1079 | ? c.c |
|
1080 | 1080 | ? cpp.cpp |
|
1081 | 1081 | ? foobar.orig |
|
1082 | 1082 | C .gitignore |
|
1083 | 1083 | C f |
|
1084 | 1084 | C foobar |
|
1085 | 1085 | C g |
|
1086 | 1086 | $ git rm snake.python |
|
1087 | 1087 | rm 'snake.python' |
|
1088 | 1088 | $ hg status --subrepos --all . |
|
1089 | 1089 | R snake.python |
|
1090 | 1090 | ? barfoo |
|
1091 | 1091 | ? c.c |
|
1092 | 1092 | ? cpp.cpp |
|
1093 | 1093 | ? foobar.orig |
|
1094 | 1094 | C .gitignore |
|
1095 | 1095 | C f |
|
1096 | 1096 | C foobar |
|
1097 | 1097 | C g |
|
1098 | 1098 | $ touch snake.python |
|
1099 | 1099 | $ cd .. |
|
1100 | 1100 | $ hg add s/snake.python |
|
1101 | 1101 | $ hg status -S |
|
1102 | 1102 | M s/snake.python |
|
1103 | 1103 | ? .hgignore |
|
1104 | 1104 | ? s/barfoo |
|
1105 | 1105 | ? s/c.c |
|
1106 | 1106 | ? s/cpp.cpp |
|
1107 | 1107 | ? s/foobar.orig |
|
1108 | 1108 | $ hg revert --all -q |
|
1109 | 1109 | |
|
1110 | 1110 | make sure we show changed files, rather than changed subtrees |
|
1111 | 1111 | $ mkdir s/foo |
|
1112 | 1112 | $ touch s/foo/bwuh |
|
1113 | 1113 | $ hg add s/foo/bwuh |
|
1114 | 1114 | $ hg commit -S -m "add bwuh" |
|
1115 | 1115 | committing subrepository s |
|
1116 | 1116 | $ hg status -S --change . |
|
1117 | 1117 | M .hgsubstate |
|
1118 | 1118 | A s/foo/bwuh |
|
1119 | 1119 | ? s/barfoo |
|
1120 | 1120 | ? s/c.c |
|
1121 | 1121 | ? s/cpp.cpp |
|
1122 | 1122 | ? s/foobar.orig |
|
1123 | 1123 | ? s/snake.python.orig |
|
1124 | 1124 | |
|
1125 | 1125 | $ cd .. |
@@ -1,591 +1,605 b'' | |||
|
1 | 1 | Create test repository: |
|
2 | 2 | |
|
3 | 3 | $ hg init repo |
|
4 | 4 | $ cd repo |
|
5 | 5 | $ echo x1 > x.txt |
|
6 | 6 | |
|
7 | 7 | $ hg init foo |
|
8 | 8 | $ cd foo |
|
9 | 9 | $ echo y1 > y.txt |
|
10 | 10 | |
|
11 | 11 | $ hg init bar |
|
12 | 12 | $ cd bar |
|
13 | 13 | $ echo z1 > z.txt |
|
14 | 14 | |
|
15 | 15 | $ cd .. |
|
16 | 16 | $ echo 'bar = bar' > .hgsub |
|
17 | 17 | |
|
18 | 18 | $ cd .. |
|
19 | 19 | $ echo 'foo = foo' > .hgsub |
|
20 | 20 | |
|
21 | 21 | Add files --- .hgsub files must go first to trigger subrepos: |
|
22 | 22 | |
|
23 | 23 | $ hg add -S .hgsub |
|
24 | 24 | $ hg add -S foo/.hgsub |
|
25 | 25 | $ hg add -S foo/bar |
|
26 | 26 | adding foo/bar/z.txt (glob) |
|
27 | 27 | $ hg add -S |
|
28 | 28 | adding x.txt |
|
29 | 29 | adding foo/y.txt (glob) |
|
30 | 30 | |
|
31 | 31 | Test recursive status without committing anything: |
|
32 | 32 | |
|
33 | 33 | $ hg status -S |
|
34 | 34 | A .hgsub |
|
35 | 35 | A foo/.hgsub |
|
36 | 36 | A foo/bar/z.txt |
|
37 | 37 | A foo/y.txt |
|
38 | 38 | A x.txt |
|
39 | 39 | |
|
40 | 40 | Test recursive diff without committing anything: |
|
41 | 41 | |
|
42 | 42 | $ hg diff --nodates -S foo |
|
43 | 43 | diff -r 000000000000 foo/.hgsub |
|
44 | 44 | --- /dev/null |
|
45 | 45 | +++ b/foo/.hgsub |
|
46 | 46 | @@ -0,0 +1,1 @@ |
|
47 | 47 | +bar = bar |
|
48 | 48 | diff -r 000000000000 foo/y.txt |
|
49 | 49 | --- /dev/null |
|
50 | 50 | +++ b/foo/y.txt |
|
51 | 51 | @@ -0,0 +1,1 @@ |
|
52 | 52 | +y1 |
|
53 | 53 | diff -r 000000000000 foo/bar/z.txt |
|
54 | 54 | --- /dev/null |
|
55 | 55 | +++ b/foo/bar/z.txt |
|
56 | 56 | @@ -0,0 +1,1 @@ |
|
57 | 57 | +z1 |
|
58 | 58 | |
|
59 | 59 | Commits: |
|
60 | 60 | |
|
61 | 61 | $ hg commit -m fails |
|
62 | 62 | abort: uncommitted changes in subrepository 'foo' |
|
63 | 63 | (use --subrepos for recursive commit) |
|
64 | 64 | [255] |
|
65 | 65 | |
|
66 | 66 | The --subrepos flag overwrite the config setting: |
|
67 | 67 | |
|
68 | 68 | $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos |
|
69 | 69 | committing subrepository foo |
|
70 | 70 | committing subrepository foo/bar (glob) |
|
71 | 71 | |
|
72 | 72 | $ cd foo |
|
73 | 73 | $ echo y2 >> y.txt |
|
74 | 74 | $ hg commit -m 0-1-0 |
|
75 | 75 | |
|
76 | 76 | $ cd bar |
|
77 | 77 | $ echo z2 >> z.txt |
|
78 | 78 | $ hg commit -m 0-1-1 |
|
79 | 79 | |
|
80 | 80 | $ cd .. |
|
81 | 81 | $ hg commit -m 0-2-1 |
|
82 | 82 | |
|
83 | 83 | $ cd .. |
|
84 | 84 | $ hg commit -m 1-2-1 |
|
85 | 85 | |
|
86 | 86 | Change working directory: |
|
87 | 87 | |
|
88 | 88 | $ echo y3 >> foo/y.txt |
|
89 | 89 | $ echo z3 >> foo/bar/z.txt |
|
90 | 90 | $ hg status -S |
|
91 | 91 | M foo/bar/z.txt |
|
92 | 92 | M foo/y.txt |
|
93 | 93 | $ hg diff --nodates -S |
|
94 | 94 | diff -r d254738c5f5e foo/y.txt |
|
95 | 95 | --- a/foo/y.txt |
|
96 | 96 | +++ b/foo/y.txt |
|
97 | 97 | @@ -1,2 +1,3 @@ |
|
98 | 98 | y1 |
|
99 | 99 | y2 |
|
100 | 100 | +y3 |
|
101 | 101 | diff -r 9647f22de499 foo/bar/z.txt |
|
102 | 102 | --- a/foo/bar/z.txt |
|
103 | 103 | +++ b/foo/bar/z.txt |
|
104 | 104 | @@ -1,2 +1,3 @@ |
|
105 | 105 | z1 |
|
106 | 106 | z2 |
|
107 | 107 | +z3 |
|
108 | 108 | |
|
109 | 109 | Status call crossing repository boundaries: |
|
110 | 110 | |
|
111 | 111 | $ hg status -S foo/bar/z.txt |
|
112 | 112 | M foo/bar/z.txt |
|
113 | 113 | $ hg status -S -I 'foo/?.txt' |
|
114 | 114 | M foo/y.txt |
|
115 | 115 | $ hg status -S -I '**/?.txt' |
|
116 | 116 | M foo/bar/z.txt |
|
117 | 117 | M foo/y.txt |
|
118 | 118 | $ hg diff --nodates -S -I '**/?.txt' |
|
119 | 119 | diff -r d254738c5f5e foo/y.txt |
|
120 | 120 | --- a/foo/y.txt |
|
121 | 121 | +++ b/foo/y.txt |
|
122 | 122 | @@ -1,2 +1,3 @@ |
|
123 | 123 | y1 |
|
124 | 124 | y2 |
|
125 | 125 | +y3 |
|
126 | 126 | diff -r 9647f22de499 foo/bar/z.txt |
|
127 | 127 | --- a/foo/bar/z.txt |
|
128 | 128 | +++ b/foo/bar/z.txt |
|
129 | 129 | @@ -1,2 +1,3 @@ |
|
130 | 130 | z1 |
|
131 | 131 | z2 |
|
132 | 132 | +z3 |
|
133 | 133 | |
|
134 | 134 | Status from within a subdirectory: |
|
135 | 135 | |
|
136 | 136 | $ mkdir dir |
|
137 | 137 | $ cd dir |
|
138 | 138 | $ echo a1 > a.txt |
|
139 | 139 | $ hg status -S |
|
140 | 140 | M foo/bar/z.txt |
|
141 | 141 | M foo/y.txt |
|
142 | 142 | ? dir/a.txt |
|
143 | 143 | $ hg diff --nodates -S |
|
144 | 144 | diff -r d254738c5f5e foo/y.txt |
|
145 | 145 | --- a/foo/y.txt |
|
146 | 146 | +++ b/foo/y.txt |
|
147 | 147 | @@ -1,2 +1,3 @@ |
|
148 | 148 | y1 |
|
149 | 149 | y2 |
|
150 | 150 | +y3 |
|
151 | 151 | diff -r 9647f22de499 foo/bar/z.txt |
|
152 | 152 | --- a/foo/bar/z.txt |
|
153 | 153 | +++ b/foo/bar/z.txt |
|
154 | 154 | @@ -1,2 +1,3 @@ |
|
155 | 155 | z1 |
|
156 | 156 | z2 |
|
157 | 157 | +z3 |
|
158 | 158 | |
|
159 | 159 | Status with relative path: |
|
160 | 160 | |
|
161 | 161 | $ hg status -S .. |
|
162 | 162 | M ../foo/bar/z.txt |
|
163 | 163 | M ../foo/y.txt |
|
164 | 164 | ? a.txt |
|
165 | 165 | |
|
166 | 166 | XXX: filtering lfilesrepo.status() in 3.3-rc causes these files to be listed as |
|
167 | 167 | added instead of modified. |
|
168 | 168 | $ hg status -S .. --config extensions.largefiles= |
|
169 | 169 | M ../foo/bar/z.txt |
|
170 | 170 | M ../foo/y.txt |
|
171 | 171 | ? a.txt |
|
172 | 172 | |
|
173 | 173 | $ hg diff --nodates -S .. |
|
174 | 174 | diff -r d254738c5f5e foo/y.txt |
|
175 | 175 | --- a/foo/y.txt |
|
176 | 176 | +++ b/foo/y.txt |
|
177 | 177 | @@ -1,2 +1,3 @@ |
|
178 | 178 | y1 |
|
179 | 179 | y2 |
|
180 | 180 | +y3 |
|
181 | 181 | diff -r 9647f22de499 foo/bar/z.txt |
|
182 | 182 | --- a/foo/bar/z.txt |
|
183 | 183 | +++ b/foo/bar/z.txt |
|
184 | 184 | @@ -1,2 +1,3 @@ |
|
185 | 185 | z1 |
|
186 | 186 | z2 |
|
187 | 187 | +z3 |
|
188 | 188 | $ cd .. |
|
189 | 189 | |
|
190 | 190 | Cleanup and final commit: |
|
191 | 191 | |
|
192 | 192 | $ rm -r dir |
|
193 | 193 | $ hg commit --subrepos -m 2-3-2 |
|
194 | 194 | committing subrepository foo |
|
195 | 195 | committing subrepository foo/bar (glob) |
|
196 | 196 | |
|
197 | 197 | Test explicit path commands within subrepos: add/forget |
|
198 | 198 | $ echo z1 > foo/bar/z2.txt |
|
199 | 199 | $ hg status -S |
|
200 | 200 | ? foo/bar/z2.txt |
|
201 | 201 | $ hg add foo/bar/z2.txt |
|
202 | 202 | $ hg status -S |
|
203 | 203 | A foo/bar/z2.txt |
|
204 | 204 | $ hg forget foo/bar/z2.txt |
|
205 | 205 | $ hg status -S |
|
206 | 206 | ? foo/bar/z2.txt |
|
207 | 207 | $ hg forget foo/bar/z2.txt |
|
208 | 208 | not removing foo/bar/z2.txt: file is already untracked (glob) |
|
209 | 209 | [1] |
|
210 | 210 | $ hg status -S |
|
211 | 211 | ? foo/bar/z2.txt |
|
212 | 212 | $ rm foo/bar/z2.txt |
|
213 | 213 | |
|
214 | 214 | Log with the relationships between repo and its subrepo: |
|
215 | 215 | |
|
216 | 216 | $ hg log --template '{rev}:{node|short} {desc}\n' |
|
217 | 217 | 2:1326fa26d0c0 2-3-2 |
|
218 | 218 | 1:4b3c9ff4f66b 1-2-1 |
|
219 | 219 | 0:23376cbba0d8 0-0-0 |
|
220 | 220 | |
|
221 | 221 | $ hg -R foo log --template '{rev}:{node|short} {desc}\n' |
|
222 | 222 | 3:65903cebad86 2-3-2 |
|
223 | 223 | 2:d254738c5f5e 0-2-1 |
|
224 | 224 | 1:8629ce7dcc39 0-1-0 |
|
225 | 225 | 0:af048e97ade2 0-0-0 |
|
226 | 226 | |
|
227 | 227 | $ hg -R foo/bar log --template '{rev}:{node|short} {desc}\n' |
|
228 | 228 | 2:31ecbdafd357 2-3-2 |
|
229 | 229 | 1:9647f22de499 0-1-1 |
|
230 | 230 | 0:4904098473f9 0-0-0 |
|
231 | 231 | |
|
232 | 232 | Status between revisions: |
|
233 | 233 | |
|
234 | 234 | $ hg status -S |
|
235 | 235 | $ hg status -S --rev 0:1 |
|
236 | 236 | M .hgsubstate |
|
237 | 237 | M foo/.hgsubstate |
|
238 | 238 | M foo/bar/z.txt |
|
239 | 239 | M foo/y.txt |
|
240 | 240 | $ hg diff --nodates -S -I '**/?.txt' --rev 0:1 |
|
241 | 241 | diff -r af048e97ade2 -r d254738c5f5e foo/y.txt |
|
242 | 242 | --- a/foo/y.txt |
|
243 | 243 | +++ b/foo/y.txt |
|
244 | 244 | @@ -1,1 +1,2 @@ |
|
245 | 245 | y1 |
|
246 | 246 | +y2 |
|
247 | 247 | diff -r 4904098473f9 -r 9647f22de499 foo/bar/z.txt |
|
248 | 248 | --- a/foo/bar/z.txt |
|
249 | 249 | +++ b/foo/bar/z.txt |
|
250 | 250 | @@ -1,1 +1,2 @@ |
|
251 | 251 | z1 |
|
252 | 252 | +z2 |
|
253 | 253 | |
|
254 | 254 | Enable progress extension for archive tests: |
|
255 | 255 | |
|
256 | 256 | $ cp $HGRCPATH $HGRCPATH.no-progress |
|
257 | 257 | $ cat >> $HGRCPATH <<EOF |
|
258 | 258 | > [extensions] |
|
259 | 259 | > progress = |
|
260 | 260 | > [progress] |
|
261 | 261 | > assume-tty = 1 |
|
262 | 262 | > delay = 0 |
|
263 | 263 | > # set changedelay really large so we don't see nested topics |
|
264 | 264 | > changedelay = 30000 |
|
265 | 265 | > format = topic bar number |
|
266 | 266 | > refresh = 0 |
|
267 | 267 | > width = 60 |
|
268 | 268 | > EOF |
|
269 | 269 | |
|
270 | 270 | Test archiving to a directory tree (the doubled lines in the output |
|
271 | 271 | only show up in the test output, not in real usage): |
|
272 | 272 | |
|
273 | 273 | $ hg archive --subrepos ../archive |
|
274 | 274 | \r (no-eol) (esc) |
|
275 | 275 | archiving [ ] 0/3\r (no-eol) (esc) |
|
276 | 276 | archiving [ ] 0/3\r (no-eol) (esc) |
|
277 | 277 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
278 | 278 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
279 | 279 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
280 | 280 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
281 | 281 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
282 | 282 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
283 | 283 | \r (no-eol) (esc) |
|
284 | 284 | \r (no-eol) (esc) |
|
285 | 285 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
286 | 286 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
287 | 287 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
288 | 288 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
289 | 289 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
290 | 290 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
291 | 291 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
292 | 292 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
293 | 293 | \r (no-eol) (esc) |
|
294 | 294 | \r (no-eol) (esc) |
|
295 | 295 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
296 | 296 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
297 | 297 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
298 | 298 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
299 | 299 | \r (no-eol) (esc) |
|
300 | 300 | $ find ../archive | sort |
|
301 | 301 | ../archive |
|
302 | 302 | ../archive/.hg_archival.txt |
|
303 | 303 | ../archive/.hgsub |
|
304 | 304 | ../archive/.hgsubstate |
|
305 | 305 | ../archive/foo |
|
306 | 306 | ../archive/foo/.hgsub |
|
307 | 307 | ../archive/foo/.hgsubstate |
|
308 | 308 | ../archive/foo/bar |
|
309 | 309 | ../archive/foo/bar/z.txt |
|
310 | 310 | ../archive/foo/y.txt |
|
311 | 311 | ../archive/x.txt |
|
312 | 312 | |
|
313 | 313 | Test archiving to zip file (unzip output is unstable): |
|
314 | 314 | |
|
315 | $ hg archive --subrepos ../archive.zip | |
|
315 | $ hg archive --subrepos --prefix '.' ../archive.zip | |
|
316 | 316 | \r (no-eol) (esc) |
|
317 | 317 | archiving [ ] 0/3\r (no-eol) (esc) |
|
318 | 318 | archiving [ ] 0/3\r (no-eol) (esc) |
|
319 | 319 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
320 | 320 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
321 | 321 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
322 | 322 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
323 | 323 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
324 | 324 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
325 | 325 | \r (no-eol) (esc) |
|
326 | 326 | \r (no-eol) (esc) |
|
327 | 327 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
328 | 328 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
329 | 329 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
330 | 330 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
331 | 331 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
332 | 332 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
333 | 333 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
334 | 334 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
335 | 335 | \r (no-eol) (esc) |
|
336 | 336 | \r (no-eol) (esc) |
|
337 | 337 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
338 | 338 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
339 | 339 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
340 | 340 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
341 | 341 | \r (no-eol) (esc) |
|
342 | $ unzip -l ../archive.zip | |
|
343 | Archive: ../archive.zip | |
|
344 | Length Date Time Name | |
|
345 | --------- ---------- ----- ---- | |
|
346 | 172 01-01-1980 00:00 .hg_archival.txt | |
|
347 | 10 01-01-1980 00:00 .hgsub | |
|
348 | 45 01-01-1980 00:00 .hgsubstate | |
|
349 | 3 01-01-1980 00:00 x.txt | |
|
350 | 10 01-01-1980 00:00 foo/.hgsub | |
|
351 | 45 01-01-1980 00:00 foo/.hgsubstate | |
|
352 | 9 01-01-1980 00:00 foo/y.txt | |
|
353 | 9 01-01-1980 00:00 foo/bar/z.txt | |
|
354 | --------- ------- | |
|
355 | 303 8 files | |
|
342 | 356 | |
|
343 | 357 | Test archiving a revision that references a subrepo that is not yet |
|
344 | 358 | cloned: |
|
345 | 359 | |
|
346 | 360 | #if hardlink |
|
347 | 361 | $ hg clone -U . ../empty |
|
348 | 362 | \r (no-eol) (esc) |
|
349 | 363 | linking [ <=> ] 1\r (no-eol) (esc) |
|
350 | 364 | linking [ <=> ] 2\r (no-eol) (esc) |
|
351 | 365 | linking [ <=> ] 3\r (no-eol) (esc) |
|
352 | 366 | linking [ <=> ] 4\r (no-eol) (esc) |
|
353 | 367 | linking [ <=> ] 5\r (no-eol) (esc) |
|
354 | 368 | linking [ <=> ] 6\r (no-eol) (esc) |
|
355 | 369 | linking [ <=> ] 7\r (no-eol) (esc) |
|
356 | 370 | linking [ <=> ] 8\r (no-eol) (esc) |
|
357 | 371 | \r (no-eol) (esc) |
|
358 | 372 | #else |
|
359 | 373 | $ hg clone -U . ../empty |
|
360 | 374 | \r (no-eol) (esc) |
|
361 | 375 | linking [ <=> ] 1 (no-eol) |
|
362 | 376 | #endif |
|
363 | 377 | |
|
364 | 378 | $ cd ../empty |
|
365 | 379 | #if hardlink |
|
366 | $ hg archive --subrepos -r tip ../archive.tar.gz | |
|
380 | $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz | |
|
367 | 381 | \r (no-eol) (esc) |
|
368 | 382 | archiving [ ] 0/3\r (no-eol) (esc) |
|
369 | 383 | archiving [ ] 0/3\r (no-eol) (esc) |
|
370 | 384 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
371 | 385 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
372 | 386 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
373 | 387 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
374 | 388 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
375 | 389 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
376 | 390 | \r (no-eol) (esc) |
|
377 | 391 | \r (no-eol) (esc) |
|
378 | 392 | linking [ <=> ] 1\r (no-eol) (esc) |
|
379 | 393 | linking [ <=> ] 2\r (no-eol) (esc) |
|
380 | 394 | linking [ <=> ] 3\r (no-eol) (esc) |
|
381 | 395 | linking [ <=> ] 4\r (no-eol) (esc) |
|
382 | 396 | linking [ <=> ] 5\r (no-eol) (esc) |
|
383 | 397 | linking [ <=> ] 6\r (no-eol) (esc) |
|
384 | 398 | linking [ <=> ] 7\r (no-eol) (esc) |
|
385 | 399 | linking [ <=> ] 8\r (no-eol) (esc) |
|
386 | 400 | \r (no-eol) (esc) |
|
387 | 401 | \r (no-eol) (esc) |
|
388 | 402 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
389 | 403 | archiving (foo) [ ] 0/3\r (no-eol) (esc) |
|
390 | 404 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
391 | 405 | archiving (foo) [===========> ] 1/3\r (no-eol) (esc) |
|
392 | 406 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
393 | 407 | archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) |
|
394 | 408 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
395 | 409 | archiving (foo) [====================================>] 3/3\r (no-eol) (esc) |
|
396 | 410 | \r (no-eol) (esc) |
|
397 | 411 | \r (no-eol) (esc) |
|
398 | 412 | linking [ <=> ] 1\r (no-eol) (esc) |
|
399 | 413 | linking [ <=> ] 2\r (no-eol) (esc) |
|
400 | 414 | linking [ <=> ] 3\r (no-eol) (esc) |
|
401 | 415 | linking [ <=> ] 4\r (no-eol) (esc) |
|
402 | 416 | linking [ <=> ] 5\r (no-eol) (esc) |
|
403 | 417 | linking [ <=> ] 6\r (no-eol) (esc) |
|
404 | 418 | \r (no-eol) (esc) |
|
405 | 419 | \r (no-eol) (esc) |
|
406 | 420 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
407 | 421 | archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) |
|
408 | 422 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
409 | 423 | archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) |
|
410 | 424 | \r (no-eol) (esc) |
|
411 | 425 | cloning subrepo foo from $TESTTMP/repo/foo |
|
412 | 426 | cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob) |
|
413 | 427 | #else |
|
414 | 428 | Note there's a slight output glitch on non-hardlink systems: the last |
|
415 | 429 | "linking" progress topic never gets closed, leading to slight output corruption on that platform. |
|
416 | $ hg archive --subrepos -r tip ../archive.tar.gz | |
|
430 | $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz | |
|
417 | 431 | \r (no-eol) (esc) |
|
418 | 432 | archiving [ ] 0/3\r (no-eol) (esc) |
|
419 | 433 | archiving [ ] 0/3\r (no-eol) (esc) |
|
420 | 434 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
421 | 435 | archiving [=============> ] 1/3\r (no-eol) (esc) |
|
422 | 436 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
423 | 437 | archiving [===========================> ] 2/3\r (no-eol) (esc) |
|
424 | 438 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
425 | 439 | archiving [==========================================>] 3/3\r (no-eol) (esc) |
|
426 | 440 | \r (no-eol) (esc) |
|
427 | 441 | \r (no-eol) (esc) |
|
428 | 442 | linking [ <=> ] 1\r (no-eol) (esc) |
|
429 | 443 | \r (no-eol) (esc) |
|
430 | 444 | \r (no-eol) (esc) |
|
431 | 445 | \r (no-eol) (esc) |
|
432 | 446 | \r (no-eol) (esc) |
|
433 | 447 | linking [ <=> ] 1cloning subrepo foo from $TESTTMP/repo/foo |
|
434 | 448 | cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob) |
|
435 | 449 | #endif |
|
436 | 450 | |
|
437 | 451 | Archive + subrepos uses '/' for all component separators |
|
438 | 452 | |
|
439 | 453 | $ tar -tzf ../archive.tar.gz | sort |
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
454 | .hg_archival.txt | |
|
455 | .hgsub | |
|
456 | .hgsubstate | |
|
457 | foo/.hgsub | |
|
458 | foo/.hgsubstate | |
|
459 | foo/bar/z.txt | |
|
460 | foo/y.txt | |
|
461 | x.txt | |
|
448 | 462 | |
|
449 | 463 | The newly cloned subrepos contain no working copy: |
|
450 | 464 | |
|
451 | 465 | $ hg -R foo summary |
|
452 | 466 | parent: -1:000000000000 (no revision checked out) |
|
453 | 467 | branch: default |
|
454 | 468 | commit: (clean) |
|
455 | 469 | update: 4 new changesets (update) |
|
456 | 470 | |
|
457 | 471 | Disable progress extension and cleanup: |
|
458 | 472 | |
|
459 | 473 | $ mv $HGRCPATH.no-progress $HGRCPATH |
|
460 | 474 | |
|
461 | 475 | Test archiving when there is a directory in the way for a subrepo |
|
462 | 476 | created by archive: |
|
463 | 477 | |
|
464 | 478 | $ hg clone -U . ../almost-empty |
|
465 | 479 | $ cd ../almost-empty |
|
466 | 480 | $ mkdir foo |
|
467 | 481 | $ echo f > foo/f |
|
468 | 482 | $ hg archive --subrepos -r tip archive |
|
469 | 483 | cloning subrepo foo from $TESTTMP/empty/foo |
|
470 | 484 | abort: destination '$TESTTMP/almost-empty/foo' is not empty (in subrepo foo) (glob) |
|
471 | 485 | [255] |
|
472 | 486 | |
|
473 | 487 | Clone and test outgoing: |
|
474 | 488 | |
|
475 | 489 | $ cd .. |
|
476 | 490 | $ hg clone repo repo2 |
|
477 | 491 | updating to branch default |
|
478 | 492 | cloning subrepo foo from $TESTTMP/repo/foo |
|
479 | 493 | cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob) |
|
480 | 494 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
481 | 495 | $ cd repo2 |
|
482 | 496 | $ hg outgoing -S |
|
483 | 497 | comparing with $TESTTMP/repo (glob) |
|
484 | 498 | searching for changes |
|
485 | 499 | no changes found |
|
486 | 500 | comparing with $TESTTMP/repo/foo |
|
487 | 501 | searching for changes |
|
488 | 502 | no changes found |
|
489 | 503 | comparing with $TESTTMP/repo/foo/bar |
|
490 | 504 | searching for changes |
|
491 | 505 | no changes found |
|
492 | 506 | [1] |
|
493 | 507 | |
|
494 | 508 | Make nested change: |
|
495 | 509 | |
|
496 | 510 | $ echo y4 >> foo/y.txt |
|
497 | 511 | $ hg diff --nodates -S |
|
498 | 512 | diff -r 65903cebad86 foo/y.txt |
|
499 | 513 | --- a/foo/y.txt |
|
500 | 514 | +++ b/foo/y.txt |
|
501 | 515 | @@ -1,3 +1,4 @@ |
|
502 | 516 | y1 |
|
503 | 517 | y2 |
|
504 | 518 | y3 |
|
505 | 519 | +y4 |
|
506 | 520 | $ hg commit --subrepos -m 3-4-2 |
|
507 | 521 | committing subrepository foo |
|
508 | 522 | $ hg outgoing -S |
|
509 | 523 | comparing with $TESTTMP/repo (glob) |
|
510 | 524 | searching for changes |
|
511 | 525 | changeset: 3:2655b8ecc4ee |
|
512 | 526 | tag: tip |
|
513 | 527 | user: test |
|
514 | 528 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
515 | 529 | summary: 3-4-2 |
|
516 | 530 | |
|
517 | 531 | comparing with $TESTTMP/repo/foo |
|
518 | 532 | searching for changes |
|
519 | 533 | changeset: 4:e96193d6cb36 |
|
520 | 534 | tag: tip |
|
521 | 535 | user: test |
|
522 | 536 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
523 | 537 | summary: 3-4-2 |
|
524 | 538 | |
|
525 | 539 | comparing with $TESTTMP/repo/foo/bar |
|
526 | 540 | searching for changes |
|
527 | 541 | no changes found |
|
528 | 542 | |
|
529 | 543 | |
|
530 | 544 | Switch to original repo and setup default path: |
|
531 | 545 | |
|
532 | 546 | $ cd ../repo |
|
533 | 547 | $ echo '[paths]' >> .hg/hgrc |
|
534 | 548 | $ echo 'default = ../repo2' >> .hg/hgrc |
|
535 | 549 | |
|
536 | 550 | Test incoming: |
|
537 | 551 | |
|
538 | 552 | $ hg incoming -S |
|
539 | 553 | comparing with $TESTTMP/repo2 (glob) |
|
540 | 554 | searching for changes |
|
541 | 555 | changeset: 3:2655b8ecc4ee |
|
542 | 556 | tag: tip |
|
543 | 557 | user: test |
|
544 | 558 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
545 | 559 | summary: 3-4-2 |
|
546 | 560 | |
|
547 | 561 | comparing with $TESTTMP/repo2/foo |
|
548 | 562 | searching for changes |
|
549 | 563 | changeset: 4:e96193d6cb36 |
|
550 | 564 | tag: tip |
|
551 | 565 | user: test |
|
552 | 566 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
553 | 567 | summary: 3-4-2 |
|
554 | 568 | |
|
555 | 569 | comparing with $TESTTMP/repo2/foo/bar |
|
556 | 570 | searching for changes |
|
557 | 571 | no changes found |
|
558 | 572 | |
|
559 | 573 | $ hg incoming -S --bundle incoming.hg |
|
560 | 574 | abort: cannot combine --bundle and --subrepos |
|
561 | 575 | [255] |
|
562 | 576 | |
|
563 | 577 | Test missing subrepo: |
|
564 | 578 | |
|
565 | 579 | $ rm -r foo |
|
566 | 580 | $ hg status -S |
|
567 | 581 | warning: error "unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98'" in subrepository "foo" |
|
568 | 582 | |
|
569 | 583 | Issue2619: IndexError: list index out of range on hg add with subrepos |
|
570 | 584 | The subrepo must sorts after the explicit filename. |
|
571 | 585 | |
|
572 | 586 | $ cd .. |
|
573 | 587 | $ hg init test |
|
574 | 588 | $ cd test |
|
575 | 589 | $ hg init x |
|
576 | 590 | $ echo abc > abc.txt |
|
577 | 591 | $ hg ci -Am "abc" |
|
578 | 592 | adding abc.txt |
|
579 | 593 | $ echo "x = x" >> .hgsub |
|
580 | 594 | $ hg add .hgsub |
|
581 | 595 | $ touch a x/a |
|
582 | 596 | $ hg add a x/a |
|
583 | 597 | |
|
584 | 598 | $ hg ci -Sm "added x" |
|
585 | 599 | committing subrepository x |
|
586 | 600 | $ echo abc > x/a |
|
587 | 601 | $ hg revert --rev '.^' "set:subrepo('glob:x*')" |
|
588 | 602 | abort: subrepository 'x' does not exist in 25ac2c9b3180! |
|
589 | 603 | [255] |
|
590 | 604 | |
|
591 | 605 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now