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