Show More
@@ -1,326 +1,332 | |||||
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 |
|
40 | # Drop the leading '.' path component if present, so Windows can read the | |
41 | # zip files (issue4634) |
|
41 | # zip files (issue4634) | |
42 | if prefix.startswith('./'): |
|
42 | if prefix.startswith('./'): | |
43 | prefix = prefix[2:] |
|
43 | prefix = prefix[2:] | |
44 | if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: |
|
44 | if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: | |
45 | raise util.Abort(_('archive prefix contains illegal components')) |
|
45 | raise util.Abort(_('archive prefix contains illegal components')) | |
46 | return prefix |
|
46 | return prefix | |
47 |
|
47 | |||
48 | exts = { |
|
48 | exts = { | |
49 | 'tar': ['.tar'], |
|
49 | 'tar': ['.tar'], | |
50 | 'tbz2': ['.tbz2', '.tar.bz2'], |
|
50 | 'tbz2': ['.tbz2', '.tar.bz2'], | |
51 | 'tgz': ['.tgz', '.tar.gz'], |
|
51 | 'tgz': ['.tgz', '.tar.gz'], | |
52 | 'zip': ['.zip'], |
|
52 | 'zip': ['.zip'], | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | def guesskind(dest): |
|
55 | def guesskind(dest): | |
56 | for kind, extensions in exts.iteritems(): |
|
56 | for kind, extensions in exts.iteritems(): | |
57 | if any(dest.endswith(ext) for ext in extensions): |
|
57 | if any(dest.endswith(ext) for ext in extensions): | |
58 | return kind |
|
58 | return kind | |
59 | return None |
|
59 | return None | |
60 |
|
60 | |||
61 | def _rootctx(repo): |
|
61 | def _rootctx(repo): | |
62 | # repo[0] may be hidden |
|
62 | # repo[0] may be hidden | |
63 | for rev in repo: |
|
63 | for rev in repo: | |
64 | return repo[rev] |
|
64 | return repo[rev] | |
65 | return repo['null'] |
|
65 | return repo['null'] | |
66 |
|
66 | |||
67 | def buildmetadata(ctx): |
|
67 | def buildmetadata(ctx): | |
68 | '''build content of .hg_archival.txt''' |
|
68 | '''build content of .hg_archival.txt''' | |
69 | repo = ctx.repo() |
|
69 | repo = ctx.repo() | |
|
70 | hex = ctx.hex() | |||
|
71 | if ctx.rev() is None: | |||
|
72 | hex = ctx.p1().hex() | |||
|
73 | if ctx.dirty(): | |||
|
74 | hex += '+' | |||
|
75 | ||||
70 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( |
|
76 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( | |
71 |
_rootctx(repo).hex(), |
|
77 | _rootctx(repo).hex(), hex, encoding.fromlocal(ctx.branch())) | |
72 |
|
78 | |||
73 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() |
|
79 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() | |
74 | if repo.tagtype(t) == 'global') |
|
80 | if repo.tagtype(t) == 'global') | |
75 | if not tags: |
|
81 | if not tags: | |
76 | repo.ui.pushbuffer() |
|
82 | repo.ui.pushbuffer() | |
77 | opts = {'template': '{latesttag}\n{latesttagdistance}', |
|
83 | opts = {'template': '{latesttag}\n{latesttagdistance}', | |
78 | 'style': '', 'patch': None, 'git': None} |
|
84 | 'style': '', 'patch': None, 'git': None} | |
79 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
|
85 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) | |
80 | ltags, dist = repo.ui.popbuffer().split('\n') |
|
86 | ltags, dist = repo.ui.popbuffer().split('\n') | |
81 | ltags = ltags.split(':') |
|
87 | ltags = ltags.split(':') | |
82 | changessince = len(repo.revs('only(.,%s)', ltags[0])) |
|
88 | changessince = len(repo.revs('only(.,%s)', ltags[0])) | |
83 | tags = ''.join('latesttag: %s\n' % t for t in ltags) |
|
89 | tags = ''.join('latesttag: %s\n' % t for t in ltags) | |
84 | tags += 'latesttagdistance: %s\n' % dist |
|
90 | tags += 'latesttagdistance: %s\n' % dist | |
85 | tags += 'changessincelatesttag: %s\n' % changessince |
|
91 | tags += 'changessincelatesttag: %s\n' % changessince | |
86 |
|
92 | |||
87 | return base + tags |
|
93 | return base + tags | |
88 |
|
94 | |||
89 | class tarit(object): |
|
95 | class tarit(object): | |
90 | '''write archive to tar file or stream. can write uncompressed, |
|
96 | '''write archive to tar file or stream. can write uncompressed, | |
91 | or compress with gzip or bzip2.''' |
|
97 | or compress with gzip or bzip2.''' | |
92 |
|
98 | |||
93 | class GzipFileWithTime(gzip.GzipFile): |
|
99 | class GzipFileWithTime(gzip.GzipFile): | |
94 |
|
100 | |||
95 | def __init__(self, *args, **kw): |
|
101 | def __init__(self, *args, **kw): | |
96 | timestamp = None |
|
102 | timestamp = None | |
97 | if 'timestamp' in kw: |
|
103 | if 'timestamp' in kw: | |
98 | timestamp = kw.pop('timestamp') |
|
104 | timestamp = kw.pop('timestamp') | |
99 | if timestamp is None: |
|
105 | if timestamp is None: | |
100 | self.timestamp = time.time() |
|
106 | self.timestamp = time.time() | |
101 | else: |
|
107 | else: | |
102 | self.timestamp = timestamp |
|
108 | self.timestamp = timestamp | |
103 | gzip.GzipFile.__init__(self, *args, **kw) |
|
109 | gzip.GzipFile.__init__(self, *args, **kw) | |
104 |
|
110 | |||
105 | def _write_gzip_header(self): |
|
111 | def _write_gzip_header(self): | |
106 | self.fileobj.write('\037\213') # magic header |
|
112 | self.fileobj.write('\037\213') # magic header | |
107 | self.fileobj.write('\010') # compression method |
|
113 | self.fileobj.write('\010') # compression method | |
108 | # Python 2.6 introduced self.name and deprecated self.filename |
|
114 | # Python 2.6 introduced self.name and deprecated self.filename | |
109 | try: |
|
115 | try: | |
110 | fname = self.name |
|
116 | fname = self.name | |
111 | except AttributeError: |
|
117 | except AttributeError: | |
112 | fname = self.filename |
|
118 | fname = self.filename | |
113 | if fname and fname.endswith('.gz'): |
|
119 | if fname and fname.endswith('.gz'): | |
114 | fname = fname[:-3] |
|
120 | fname = fname[:-3] | |
115 | flags = 0 |
|
121 | flags = 0 | |
116 | if fname: |
|
122 | if fname: | |
117 | flags = gzip.FNAME |
|
123 | flags = gzip.FNAME | |
118 | self.fileobj.write(chr(flags)) |
|
124 | self.fileobj.write(chr(flags)) | |
119 | gzip.write32u(self.fileobj, long(self.timestamp)) |
|
125 | gzip.write32u(self.fileobj, long(self.timestamp)) | |
120 | self.fileobj.write('\002') |
|
126 | self.fileobj.write('\002') | |
121 | self.fileobj.write('\377') |
|
127 | self.fileobj.write('\377') | |
122 | if fname: |
|
128 | if fname: | |
123 | self.fileobj.write(fname + '\000') |
|
129 | self.fileobj.write(fname + '\000') | |
124 |
|
130 | |||
125 | def __init__(self, dest, mtime, kind=''): |
|
131 | def __init__(self, dest, mtime, kind=''): | |
126 | self.mtime = mtime |
|
132 | self.mtime = mtime | |
127 | self.fileobj = None |
|
133 | self.fileobj = None | |
128 |
|
134 | |||
129 | def taropen(name, mode, fileobj=None): |
|
135 | def taropen(name, mode, fileobj=None): | |
130 | if kind == 'gz': |
|
136 | if kind == 'gz': | |
131 | mode = mode[0] |
|
137 | mode = mode[0] | |
132 | if not fileobj: |
|
138 | if not fileobj: | |
133 | fileobj = open(name, mode + 'b') |
|
139 | fileobj = open(name, mode + 'b') | |
134 | gzfileobj = self.GzipFileWithTime(name, mode + 'b', |
|
140 | gzfileobj = self.GzipFileWithTime(name, mode + 'b', | |
135 | zlib.Z_BEST_COMPRESSION, |
|
141 | zlib.Z_BEST_COMPRESSION, | |
136 | fileobj, timestamp=mtime) |
|
142 | fileobj, timestamp=mtime) | |
137 | self.fileobj = gzfileobj |
|
143 | self.fileobj = gzfileobj | |
138 | return tarfile.TarFile.taropen(name, mode, gzfileobj) |
|
144 | return tarfile.TarFile.taropen(name, mode, gzfileobj) | |
139 | else: |
|
145 | else: | |
140 | return tarfile.open(name, mode + kind, fileobj) |
|
146 | return tarfile.open(name, mode + kind, fileobj) | |
141 |
|
147 | |||
142 | if isinstance(dest, str): |
|
148 | if isinstance(dest, str): | |
143 | self.z = taropen(dest, mode='w:') |
|
149 | self.z = taropen(dest, mode='w:') | |
144 | else: |
|
150 | else: | |
145 | # Python 2.5-2.5.1 have a regression that requires a name arg |
|
151 | # Python 2.5-2.5.1 have a regression that requires a name arg | |
146 | self.z = taropen(name='', mode='w|', fileobj=dest) |
|
152 | self.z = taropen(name='', mode='w|', fileobj=dest) | |
147 |
|
153 | |||
148 | def addfile(self, name, mode, islink, data): |
|
154 | def addfile(self, name, mode, islink, data): | |
149 | i = tarfile.TarInfo(name) |
|
155 | i = tarfile.TarInfo(name) | |
150 | i.mtime = self.mtime |
|
156 | i.mtime = self.mtime | |
151 | i.size = len(data) |
|
157 | i.size = len(data) | |
152 | if islink: |
|
158 | if islink: | |
153 | i.type = tarfile.SYMTYPE |
|
159 | i.type = tarfile.SYMTYPE | |
154 | i.mode = 0777 |
|
160 | i.mode = 0777 | |
155 | i.linkname = data |
|
161 | i.linkname = data | |
156 | data = None |
|
162 | data = None | |
157 | i.size = 0 |
|
163 | i.size = 0 | |
158 | else: |
|
164 | else: | |
159 | i.mode = mode |
|
165 | i.mode = mode | |
160 | data = cStringIO.StringIO(data) |
|
166 | data = cStringIO.StringIO(data) | |
161 | self.z.addfile(i, data) |
|
167 | self.z.addfile(i, data) | |
162 |
|
168 | |||
163 | def done(self): |
|
169 | def done(self): | |
164 | self.z.close() |
|
170 | self.z.close() | |
165 | if self.fileobj: |
|
171 | if self.fileobj: | |
166 | self.fileobj.close() |
|
172 | self.fileobj.close() | |
167 |
|
173 | |||
168 | class tellable(object): |
|
174 | class tellable(object): | |
169 | '''provide tell method for zipfile.ZipFile when writing to http |
|
175 | '''provide tell method for zipfile.ZipFile when writing to http | |
170 | response file object.''' |
|
176 | response file object.''' | |
171 |
|
177 | |||
172 | def __init__(self, fp): |
|
178 | def __init__(self, fp): | |
173 | self.fp = fp |
|
179 | self.fp = fp | |
174 | self.offset = 0 |
|
180 | self.offset = 0 | |
175 |
|
181 | |||
176 | def __getattr__(self, key): |
|
182 | def __getattr__(self, key): | |
177 | return getattr(self.fp, key) |
|
183 | return getattr(self.fp, key) | |
178 |
|
184 | |||
179 | def write(self, s): |
|
185 | def write(self, s): | |
180 | self.fp.write(s) |
|
186 | self.fp.write(s) | |
181 | self.offset += len(s) |
|
187 | self.offset += len(s) | |
182 |
|
188 | |||
183 | def tell(self): |
|
189 | def tell(self): | |
184 | return self.offset |
|
190 | return self.offset | |
185 |
|
191 | |||
186 | class zipit(object): |
|
192 | class zipit(object): | |
187 | '''write archive to zip file or stream. can write uncompressed, |
|
193 | '''write archive to zip file or stream. can write uncompressed, | |
188 | or compressed with deflate.''' |
|
194 | or compressed with deflate.''' | |
189 |
|
195 | |||
190 | def __init__(self, dest, mtime, compress=True): |
|
196 | def __init__(self, dest, mtime, compress=True): | |
191 | if not isinstance(dest, str): |
|
197 | if not isinstance(dest, str): | |
192 | try: |
|
198 | try: | |
193 | dest.tell() |
|
199 | dest.tell() | |
194 | except (AttributeError, IOError): |
|
200 | except (AttributeError, IOError): | |
195 | dest = tellable(dest) |
|
201 | dest = tellable(dest) | |
196 | self.z = zipfile.ZipFile(dest, 'w', |
|
202 | self.z = zipfile.ZipFile(dest, 'w', | |
197 | compress and zipfile.ZIP_DEFLATED or |
|
203 | compress and zipfile.ZIP_DEFLATED or | |
198 | zipfile.ZIP_STORED) |
|
204 | zipfile.ZIP_STORED) | |
199 |
|
205 | |||
200 | # Python's zipfile module emits deprecation warnings if we try |
|
206 | # Python's zipfile module emits deprecation warnings if we try | |
201 | # to store files with a date before 1980. |
|
207 | # to store files with a date before 1980. | |
202 | epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0)) |
|
208 | epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0)) | |
203 | if mtime < epoch: |
|
209 | if mtime < epoch: | |
204 | mtime = epoch |
|
210 | mtime = epoch | |
205 |
|
211 | |||
206 | self.mtime = mtime |
|
212 | self.mtime = mtime | |
207 | self.date_time = time.gmtime(mtime)[:6] |
|
213 | self.date_time = time.gmtime(mtime)[:6] | |
208 |
|
214 | |||
209 | def addfile(self, name, mode, islink, data): |
|
215 | def addfile(self, name, mode, islink, data): | |
210 | i = zipfile.ZipInfo(name, self.date_time) |
|
216 | i = zipfile.ZipInfo(name, self.date_time) | |
211 | i.compress_type = self.z.compression |
|
217 | i.compress_type = self.z.compression | |
212 | # unzip will not honor unix file modes unless file creator is |
|
218 | # unzip will not honor unix file modes unless file creator is | |
213 | # set to unix (id 3). |
|
219 | # set to unix (id 3). | |
214 | i.create_system = 3 |
|
220 | i.create_system = 3 | |
215 | ftype = _UNX_IFREG |
|
221 | ftype = _UNX_IFREG | |
216 | if islink: |
|
222 | if islink: | |
217 | mode = 0777 |
|
223 | mode = 0777 | |
218 | ftype = _UNX_IFLNK |
|
224 | ftype = _UNX_IFLNK | |
219 | i.external_attr = (mode | ftype) << 16L |
|
225 | i.external_attr = (mode | ftype) << 16L | |
220 | # add "extended-timestamp" extra block, because zip archives |
|
226 | # add "extended-timestamp" extra block, because zip archives | |
221 | # without this will be extracted with unexpected timestamp, |
|
227 | # without this will be extracted with unexpected timestamp, | |
222 | # if TZ is not configured as GMT |
|
228 | # if TZ is not configured as GMT | |
223 | i.extra += struct.pack('<hhBl', |
|
229 | i.extra += struct.pack('<hhBl', | |
224 | 0x5455, # block type: "extended-timestamp" |
|
230 | 0x5455, # block type: "extended-timestamp" | |
225 | 1 + 4, # size of this block |
|
231 | 1 + 4, # size of this block | |
226 | 1, # "modification time is present" |
|
232 | 1, # "modification time is present" | |
227 | int(self.mtime)) # last modification (UTC) |
|
233 | int(self.mtime)) # last modification (UTC) | |
228 | self.z.writestr(i, data) |
|
234 | self.z.writestr(i, data) | |
229 |
|
235 | |||
230 | def done(self): |
|
236 | def done(self): | |
231 | self.z.close() |
|
237 | self.z.close() | |
232 |
|
238 | |||
233 | class fileit(object): |
|
239 | class fileit(object): | |
234 | '''write archive as files in directory.''' |
|
240 | '''write archive as files in directory.''' | |
235 |
|
241 | |||
236 | def __init__(self, name, mtime): |
|
242 | def __init__(self, name, mtime): | |
237 | self.basedir = name |
|
243 | self.basedir = name | |
238 | self.opener = scmutil.opener(self.basedir) |
|
244 | self.opener = scmutil.opener(self.basedir) | |
239 |
|
245 | |||
240 | def addfile(self, name, mode, islink, data): |
|
246 | def addfile(self, name, mode, islink, data): | |
241 | if islink: |
|
247 | if islink: | |
242 | self.opener.symlink(data, name) |
|
248 | self.opener.symlink(data, name) | |
243 | return |
|
249 | return | |
244 | f = self.opener(name, "w", atomictemp=True) |
|
250 | f = self.opener(name, "w", atomictemp=True) | |
245 | f.write(data) |
|
251 | f.write(data) | |
246 | f.close() |
|
252 | f.close() | |
247 | destfile = os.path.join(self.basedir, name) |
|
253 | destfile = os.path.join(self.basedir, name) | |
248 | os.chmod(destfile, mode) |
|
254 | os.chmod(destfile, mode) | |
249 |
|
255 | |||
250 | def done(self): |
|
256 | def done(self): | |
251 | pass |
|
257 | pass | |
252 |
|
258 | |||
253 | archivers = { |
|
259 | archivers = { | |
254 | 'files': fileit, |
|
260 | 'files': fileit, | |
255 | 'tar': tarit, |
|
261 | 'tar': tarit, | |
256 | 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'), |
|
262 | 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'), | |
257 | 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'), |
|
263 | 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'), | |
258 | 'uzip': lambda name, mtime: zipit(name, mtime, False), |
|
264 | 'uzip': lambda name, mtime: zipit(name, mtime, False), | |
259 | 'zip': zipit, |
|
265 | 'zip': zipit, | |
260 | } |
|
266 | } | |
261 |
|
267 | |||
262 | def archive(repo, dest, node, kind, decode=True, matchfn=None, |
|
268 | def archive(repo, dest, node, kind, decode=True, matchfn=None, | |
263 | prefix='', mtime=None, subrepos=False): |
|
269 | prefix='', mtime=None, subrepos=False): | |
264 | '''create archive of repo as it was at node. |
|
270 | '''create archive of repo as it was at node. | |
265 |
|
271 | |||
266 | dest can be name of directory, name of archive file, or file |
|
272 | dest can be name of directory, name of archive file, or file | |
267 | object to write archive to. |
|
273 | object to write archive to. | |
268 |
|
274 | |||
269 | kind is type of archive to create. |
|
275 | kind is type of archive to create. | |
270 |
|
276 | |||
271 | decode tells whether to put files through decode filters from |
|
277 | decode tells whether to put files through decode filters from | |
272 | hgrc. |
|
278 | hgrc. | |
273 |
|
279 | |||
274 | matchfn is function to filter names of files to write to archive. |
|
280 | matchfn is function to filter names of files to write to archive. | |
275 |
|
281 | |||
276 | prefix is name of path to put before every archive member.''' |
|
282 | prefix is name of path to put before every archive member.''' | |
277 |
|
283 | |||
278 | if kind == 'files': |
|
284 | if kind == 'files': | |
279 | if prefix: |
|
285 | if prefix: | |
280 | raise util.Abort(_('cannot give prefix when archiving to files')) |
|
286 | raise util.Abort(_('cannot give prefix when archiving to files')) | |
281 | else: |
|
287 | else: | |
282 | prefix = tidyprefix(dest, kind, prefix) |
|
288 | prefix = tidyprefix(dest, kind, prefix) | |
283 |
|
289 | |||
284 | def write(name, mode, islink, getdata): |
|
290 | def write(name, mode, islink, getdata): | |
285 | data = getdata() |
|
291 | data = getdata() | |
286 | if decode: |
|
292 | if decode: | |
287 | data = repo.wwritedata(name, data) |
|
293 | data = repo.wwritedata(name, data) | |
288 | archiver.addfile(prefix + name, mode, islink, data) |
|
294 | archiver.addfile(prefix + name, mode, islink, data) | |
289 |
|
295 | |||
290 | if kind not in archivers: |
|
296 | if kind not in archivers: | |
291 | raise util.Abort(_("unknown archive type '%s'") % kind) |
|
297 | raise util.Abort(_("unknown archive type '%s'") % kind) | |
292 |
|
298 | |||
293 | ctx = repo[node] |
|
299 | ctx = repo[node] | |
294 | archiver = archivers[kind](dest, mtime or ctx.date()[0]) |
|
300 | archiver = archivers[kind](dest, mtime or ctx.date()[0]) | |
295 |
|
301 | |||
296 | if repo.ui.configbool("ui", "archivemeta", True): |
|
302 | if repo.ui.configbool("ui", "archivemeta", True): | |
297 | name = '.hg_archival.txt' |
|
303 | name = '.hg_archival.txt' | |
298 | if not matchfn or matchfn(name): |
|
304 | if not matchfn or matchfn(name): | |
299 | write(name, 0644, False, lambda: buildmetadata(ctx)) |
|
305 | write(name, 0644, False, lambda: buildmetadata(ctx)) | |
300 |
|
306 | |||
301 | if matchfn: |
|
307 | if matchfn: | |
302 | files = [f for f in ctx.manifest().keys() if matchfn(f)] |
|
308 | files = [f for f in ctx.manifest().keys() if matchfn(f)] | |
303 | else: |
|
309 | else: | |
304 | files = ctx.manifest().keys() |
|
310 | files = ctx.manifest().keys() | |
305 | total = len(files) |
|
311 | total = len(files) | |
306 | if total: |
|
312 | if total: | |
307 | files.sort() |
|
313 | files.sort() | |
308 | repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) |
|
314 | repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) | |
309 | for i, f in enumerate(files): |
|
315 | for i, f in enumerate(files): | |
310 | ff = ctx.flags(f) |
|
316 | ff = ctx.flags(f) | |
311 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
|
317 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) | |
312 | repo.ui.progress(_('archiving'), i + 1, item=f, |
|
318 | repo.ui.progress(_('archiving'), i + 1, item=f, | |
313 | unit=_('files'), total=total) |
|
319 | unit=_('files'), total=total) | |
314 | repo.ui.progress(_('archiving'), None) |
|
320 | repo.ui.progress(_('archiving'), None) | |
315 |
|
321 | |||
316 | if subrepos: |
|
322 | if subrepos: | |
317 | for subpath in sorted(ctx.substate): |
|
323 | for subpath in sorted(ctx.substate): | |
318 | sub = ctx.workingsub(subpath) |
|
324 | sub = ctx.workingsub(subpath) | |
319 | submatch = matchmod.narrowmatcher(subpath, matchfn) |
|
325 | submatch = matchmod.narrowmatcher(subpath, matchfn) | |
320 | total += sub.archive(archiver, prefix, submatch) |
|
326 | total += sub.archive(archiver, prefix, submatch) | |
321 |
|
327 | |||
322 | if total == 0: |
|
328 | if total == 0: | |
323 | raise error.Abort(_('no files match the archive pattern')) |
|
329 | raise error.Abort(_('no files match the archive pattern')) | |
324 |
|
330 | |||
325 | archiver.done() |
|
331 | archiver.done() | |
326 | return total |
|
332 | return total |
@@ -1,694 +1,712 | |||||
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 |
|
171 | |||
172 | Archive wdir() with subrepos |
|
172 | Archive wdir() with subrepos | |
173 | $ hg rm main |
|
173 | $ hg rm main | |
174 | $ hg archive -S -r 'wdir()' ../wdir |
|
174 | $ hg archive -S -r 'wdir()' ../wdir | |
175 | $ diff -r . ../wdir | grep -v '\.hg$' |
|
175 | $ diff -r . ../wdir | grep -v '\.hg$' | |
176 | Only in ../wdir: .hg_archival.txt |
|
176 | Only in ../wdir: .hg_archival.txt | |
177 |
|
177 | |||
178 | $ find ../wdir -type f | sort |
|
178 | $ find ../wdir -type f | sort | |
179 | ../wdir/.hg_archival.txt |
|
179 | ../wdir/.hg_archival.txt | |
180 | ../wdir/.hgsub |
|
180 | ../wdir/.hgsub | |
181 | ../wdir/.hgsubstate |
|
181 | ../wdir/.hgsubstate | |
182 | ../wdir/foo/bar/abc |
|
182 | ../wdir/foo/bar/abc | |
183 | ../wdir/sub1/.hgsub |
|
183 | ../wdir/sub1/.hgsub | |
184 | ../wdir/sub1/.hgsubstate |
|
184 | ../wdir/sub1/.hgsubstate | |
185 | ../wdir/sub1/foo |
|
185 | ../wdir/sub1/foo | |
186 | ../wdir/sub1/sub1 |
|
186 | ../wdir/sub1/sub1 | |
187 | ../wdir/sub1/sub2/folder/test.txt |
|
187 | ../wdir/sub1/sub2/folder/test.txt | |
188 | ../wdir/sub1/sub2/sub2 |
|
188 | ../wdir/sub1/sub2/sub2 | |
189 |
|
189 | |||
|
190 | $ cat ../wdir/.hg_archival.txt | |||
|
191 | repo: 7f491f53a367861f47ee64a80eb997d1f341b77a | |||
|
192 | node: 9bb10eebee29dc0f1201dcf5977b811a540255fd+ | |||
|
193 | branch: default | |||
|
194 | latesttag: null | |||
|
195 | latesttagdistance: 4 | |||
|
196 | changessincelatesttag: 3 | |||
|
197 | ||||
190 | Attempting to archive 'wdir()' with a missing file is handled gracefully |
|
198 | Attempting to archive 'wdir()' with a missing file is handled gracefully | |
191 | $ rm sub1/sub1 |
|
199 | $ rm sub1/sub1 | |
192 | $ rm -r ../wdir |
|
200 | $ rm -r ../wdir | |
193 | $ hg archive -v -S -r 'wdir()' ../wdir |
|
201 | $ hg archive -v -S -r 'wdir()' ../wdir | |
194 | $ find ../wdir -type f | sort |
|
202 | $ find ../wdir -type f | sort | |
195 | ../wdir/.hg_archival.txt |
|
203 | ../wdir/.hg_archival.txt | |
196 | ../wdir/.hgsub |
|
204 | ../wdir/.hgsub | |
197 | ../wdir/.hgsubstate |
|
205 | ../wdir/.hgsubstate | |
198 | ../wdir/foo/bar/abc |
|
206 | ../wdir/foo/bar/abc | |
199 | ../wdir/sub1/.hgsub |
|
207 | ../wdir/sub1/.hgsub | |
200 | ../wdir/sub1/.hgsubstate |
|
208 | ../wdir/sub1/.hgsubstate | |
201 | ../wdir/sub1/foo |
|
209 | ../wdir/sub1/foo | |
202 | ../wdir/sub1/sub2/folder/test.txt |
|
210 | ../wdir/sub1/sub2/folder/test.txt | |
203 | ../wdir/sub1/sub2/sub2 |
|
211 | ../wdir/sub1/sub2/sub2 | |
204 |
|
212 | |||
205 | Continue relative path printing + subrepos |
|
213 | Continue relative path printing + subrepos | |
206 | $ hg update -Cq |
|
214 | $ hg update -Cq | |
|
215 | $ rm -r ../wdir | |||
|
216 | $ hg archive -S -r 'wdir()' ../wdir | |||
|
217 | $ cat ../wdir/.hg_archival.txt | |||
|
218 | repo: 7f491f53a367861f47ee64a80eb997d1f341b77a | |||
|
219 | node: 9bb10eebee29dc0f1201dcf5977b811a540255fd | |||
|
220 | branch: default | |||
|
221 | latesttag: null | |||
|
222 | latesttagdistance: 4 | |||
|
223 | changessincelatesttag: 3 | |||
|
224 | ||||
207 | $ touch sub1/sub2/folder/bar |
|
225 | $ touch sub1/sub2/folder/bar | |
208 | $ hg addremove sub1/sub2 |
|
226 | $ hg addremove sub1/sub2 | |
209 | adding sub1/sub2/folder/bar (glob) |
|
227 | adding sub1/sub2/folder/bar (glob) | |
210 | $ hg status -S |
|
228 | $ hg status -S | |
211 | A sub1/sub2/folder/bar |
|
229 | A sub1/sub2/folder/bar | |
212 | ? foo/bar/abc |
|
230 | ? foo/bar/abc | |
213 | ? sub1/foo |
|
231 | ? sub1/foo | |
214 | $ hg update -Cq |
|
232 | $ hg update -Cq | |
215 | $ hg addremove sub1 |
|
233 | $ hg addremove sub1 | |
216 | adding sub1/sub2/folder/bar (glob) |
|
234 | adding sub1/sub2/folder/bar (glob) | |
217 | adding sub1/foo (glob) |
|
235 | adding sub1/foo (glob) | |
218 | $ hg update -Cq |
|
236 | $ hg update -Cq | |
219 | $ rm sub1/sub2/folder/test.txt |
|
237 | $ rm sub1/sub2/folder/test.txt | |
220 | $ rm sub1/sub2/test.txt |
|
238 | $ rm sub1/sub2/test.txt | |
221 | $ hg ci -ASm "remove test.txt" |
|
239 | $ hg ci -ASm "remove test.txt" | |
222 | adding sub1/sub2/folder/bar |
|
240 | adding sub1/sub2/folder/bar | |
223 | removing sub1/sub2/folder/test.txt |
|
241 | removing sub1/sub2/folder/test.txt | |
224 | removing sub1/sub2/test.txt |
|
242 | removing sub1/sub2/test.txt | |
225 | adding sub1/foo |
|
243 | adding sub1/foo | |
226 | adding foo/bar/abc |
|
244 | adding foo/bar/abc | |
227 | committing subrepository sub1 |
|
245 | committing subrepository sub1 | |
228 | committing subrepository sub1/sub2 (glob) |
|
246 | committing subrepository sub1/sub2 (glob) | |
229 |
|
247 | |||
230 | $ hg forget sub1/sub2/sub2 |
|
248 | $ hg forget sub1/sub2/sub2 | |
231 | $ echo x > sub1/sub2/x.txt |
|
249 | $ echo x > sub1/sub2/x.txt | |
232 | $ hg add sub1/sub2/x.txt |
|
250 | $ hg add sub1/sub2/x.txt | |
233 |
|
251 | |||
234 | Files sees uncommitted adds and removes in subrepos |
|
252 | Files sees uncommitted adds and removes in subrepos | |
235 | $ hg files -S |
|
253 | $ hg files -S | |
236 | .hgsub |
|
254 | .hgsub | |
237 | .hgsubstate |
|
255 | .hgsubstate | |
238 | foo/bar/abc (glob) |
|
256 | foo/bar/abc (glob) | |
239 | main |
|
257 | main | |
240 | sub1/.hgsub (glob) |
|
258 | sub1/.hgsub (glob) | |
241 | sub1/.hgsubstate (glob) |
|
259 | sub1/.hgsubstate (glob) | |
242 | sub1/foo (glob) |
|
260 | sub1/foo (glob) | |
243 | sub1/sub1 (glob) |
|
261 | sub1/sub1 (glob) | |
244 | sub1/sub2/folder/bar (glob) |
|
262 | sub1/sub2/folder/bar (glob) | |
245 | sub1/sub2/x.txt (glob) |
|
263 | sub1/sub2/x.txt (glob) | |
246 |
|
264 | |||
247 | $ hg files -S "set:eol('dos') or eol('unix') or size('<= 0')" |
|
265 | $ hg files -S "set:eol('dos') or eol('unix') or size('<= 0')" | |
248 | .hgsub |
|
266 | .hgsub | |
249 | .hgsubstate |
|
267 | .hgsubstate | |
250 | foo/bar/abc (glob) |
|
268 | foo/bar/abc (glob) | |
251 | main |
|
269 | main | |
252 | sub1/.hgsub (glob) |
|
270 | sub1/.hgsub (glob) | |
253 | sub1/.hgsubstate (glob) |
|
271 | sub1/.hgsubstate (glob) | |
254 | sub1/foo (glob) |
|
272 | sub1/foo (glob) | |
255 | sub1/sub1 (glob) |
|
273 | sub1/sub1 (glob) | |
256 | sub1/sub2/folder/bar (glob) |
|
274 | sub1/sub2/folder/bar (glob) | |
257 | sub1/sub2/x.txt (glob) |
|
275 | sub1/sub2/x.txt (glob) | |
258 |
|
276 | |||
259 | $ hg files -r '.^' -S "set:eol('dos') or eol('unix')" |
|
277 | $ hg files -r '.^' -S "set:eol('dos') or eol('unix')" | |
260 | .hgsub |
|
278 | .hgsub | |
261 | .hgsubstate |
|
279 | .hgsubstate | |
262 | main |
|
280 | main | |
263 | sub1/.hgsub (glob) |
|
281 | sub1/.hgsub (glob) | |
264 | sub1/.hgsubstate (glob) |
|
282 | sub1/.hgsubstate (glob) | |
265 | sub1/sub1 (glob) |
|
283 | sub1/sub1 (glob) | |
266 | sub1/sub2/folder/test.txt (glob) |
|
284 | sub1/sub2/folder/test.txt (glob) | |
267 | sub1/sub2/sub2 (glob) |
|
285 | sub1/sub2/sub2 (glob) | |
268 | sub1/sub2/test.txt (glob) |
|
286 | sub1/sub2/test.txt (glob) | |
269 |
|
287 | |||
270 | $ hg files sub1 |
|
288 | $ hg files sub1 | |
271 | sub1/.hgsub (glob) |
|
289 | sub1/.hgsub (glob) | |
272 | sub1/.hgsubstate (glob) |
|
290 | sub1/.hgsubstate (glob) | |
273 | sub1/foo (glob) |
|
291 | sub1/foo (glob) | |
274 | sub1/sub1 (glob) |
|
292 | sub1/sub1 (glob) | |
275 | sub1/sub2/folder/bar (glob) |
|
293 | sub1/sub2/folder/bar (glob) | |
276 | sub1/sub2/x.txt (glob) |
|
294 | sub1/sub2/x.txt (glob) | |
277 |
|
295 | |||
278 | $ hg files sub1/sub2 |
|
296 | $ hg files sub1/sub2 | |
279 | sub1/sub2/folder/bar (glob) |
|
297 | sub1/sub2/folder/bar (glob) | |
280 | sub1/sub2/x.txt (glob) |
|
298 | sub1/sub2/x.txt (glob) | |
281 |
|
299 | |||
282 | $ hg files -S -r '.^' sub1/sub2/folder |
|
300 | $ hg files -S -r '.^' sub1/sub2/folder | |
283 | sub1/sub2/folder/test.txt (glob) |
|
301 | sub1/sub2/folder/test.txt (glob) | |
284 |
|
302 | |||
285 | $ hg files -S -r '.^' sub1/sub2/missing |
|
303 | $ hg files -S -r '.^' sub1/sub2/missing | |
286 | sub1/sub2/missing: no such file in rev 78026e779ea6 (glob) |
|
304 | sub1/sub2/missing: no such file in rev 78026e779ea6 (glob) | |
287 | [1] |
|
305 | [1] | |
288 |
|
306 | |||
289 | $ hg files -r '.^' sub1/ |
|
307 | $ hg files -r '.^' sub1/ | |
290 | sub1/.hgsub (glob) |
|
308 | sub1/.hgsub (glob) | |
291 | sub1/.hgsubstate (glob) |
|
309 | sub1/.hgsubstate (glob) | |
292 | sub1/sub1 (glob) |
|
310 | sub1/sub1 (glob) | |
293 | sub1/sub2/folder/test.txt (glob) |
|
311 | sub1/sub2/folder/test.txt (glob) | |
294 | sub1/sub2/sub2 (glob) |
|
312 | sub1/sub2/sub2 (glob) | |
295 | sub1/sub2/test.txt (glob) |
|
313 | sub1/sub2/test.txt (glob) | |
296 |
|
314 | |||
297 | $ hg files -r '.^' sub1/sub2 |
|
315 | $ hg files -r '.^' sub1/sub2 | |
298 | sub1/sub2/folder/test.txt (glob) |
|
316 | sub1/sub2/folder/test.txt (glob) | |
299 | sub1/sub2/sub2 (glob) |
|
317 | sub1/sub2/sub2 (glob) | |
300 | sub1/sub2/test.txt (glob) |
|
318 | sub1/sub2/test.txt (glob) | |
301 |
|
319 | |||
302 | $ hg rollback -q |
|
320 | $ hg rollback -q | |
303 | $ hg up -Cq |
|
321 | $ hg up -Cq | |
304 |
|
322 | |||
305 | $ hg --config extensions.largefiles=! archive -S ../archive_all |
|
323 | $ hg --config extensions.largefiles=! archive -S ../archive_all | |
306 | $ find ../archive_all | sort |
|
324 | $ find ../archive_all | sort | |
307 | ../archive_all |
|
325 | ../archive_all | |
308 | ../archive_all/.hg_archival.txt |
|
326 | ../archive_all/.hg_archival.txt | |
309 | ../archive_all/.hgsub |
|
327 | ../archive_all/.hgsub | |
310 | ../archive_all/.hgsubstate |
|
328 | ../archive_all/.hgsubstate | |
311 | ../archive_all/main |
|
329 | ../archive_all/main | |
312 | ../archive_all/sub1 |
|
330 | ../archive_all/sub1 | |
313 | ../archive_all/sub1/.hgsub |
|
331 | ../archive_all/sub1/.hgsub | |
314 | ../archive_all/sub1/.hgsubstate |
|
332 | ../archive_all/sub1/.hgsubstate | |
315 | ../archive_all/sub1/sub1 |
|
333 | ../archive_all/sub1/sub1 | |
316 | ../archive_all/sub1/sub2 |
|
334 | ../archive_all/sub1/sub2 | |
317 | ../archive_all/sub1/sub2/folder |
|
335 | ../archive_all/sub1/sub2/folder | |
318 | ../archive_all/sub1/sub2/folder/test.txt |
|
336 | ../archive_all/sub1/sub2/folder/test.txt | |
319 | ../archive_all/sub1/sub2/sub2 |
|
337 | ../archive_all/sub1/sub2/sub2 | |
320 | ../archive_all/sub1/sub2/test.txt |
|
338 | ../archive_all/sub1/sub2/test.txt | |
321 |
|
339 | |||
322 | Check that archive -X works in deep subrepos |
|
340 | Check that archive -X works in deep subrepos | |
323 |
|
341 | |||
324 | $ hg --config extensions.largefiles=! archive -S -X '**test*' ../archive_exclude |
|
342 | $ hg --config extensions.largefiles=! archive -S -X '**test*' ../archive_exclude | |
325 | $ find ../archive_exclude | sort |
|
343 | $ find ../archive_exclude | sort | |
326 | ../archive_exclude |
|
344 | ../archive_exclude | |
327 | ../archive_exclude/.hg_archival.txt |
|
345 | ../archive_exclude/.hg_archival.txt | |
328 | ../archive_exclude/.hgsub |
|
346 | ../archive_exclude/.hgsub | |
329 | ../archive_exclude/.hgsubstate |
|
347 | ../archive_exclude/.hgsubstate | |
330 | ../archive_exclude/main |
|
348 | ../archive_exclude/main | |
331 | ../archive_exclude/sub1 |
|
349 | ../archive_exclude/sub1 | |
332 | ../archive_exclude/sub1/.hgsub |
|
350 | ../archive_exclude/sub1/.hgsub | |
333 | ../archive_exclude/sub1/.hgsubstate |
|
351 | ../archive_exclude/sub1/.hgsubstate | |
334 | ../archive_exclude/sub1/sub1 |
|
352 | ../archive_exclude/sub1/sub1 | |
335 | ../archive_exclude/sub1/sub2 |
|
353 | ../archive_exclude/sub1/sub2 | |
336 | ../archive_exclude/sub1/sub2/sub2 |
|
354 | ../archive_exclude/sub1/sub2/sub2 | |
337 |
|
355 | |||
338 | $ hg --config extensions.largefiles=! archive -S -I '**test*' ../archive_include |
|
356 | $ hg --config extensions.largefiles=! archive -S -I '**test*' ../archive_include | |
339 | $ find ../archive_include | sort |
|
357 | $ find ../archive_include | sort | |
340 | ../archive_include |
|
358 | ../archive_include | |
341 | ../archive_include/sub1 |
|
359 | ../archive_include/sub1 | |
342 | ../archive_include/sub1/sub2 |
|
360 | ../archive_include/sub1/sub2 | |
343 | ../archive_include/sub1/sub2/folder |
|
361 | ../archive_include/sub1/sub2/folder | |
344 | ../archive_include/sub1/sub2/folder/test.txt |
|
362 | ../archive_include/sub1/sub2/folder/test.txt | |
345 | ../archive_include/sub1/sub2/test.txt |
|
363 | ../archive_include/sub1/sub2/test.txt | |
346 |
|
364 | |||
347 | Check that deep archive works with largefiles (which overrides hgsubrepo impl) |
|
365 | Check that deep archive works with largefiles (which overrides hgsubrepo impl) | |
348 | This also tests the repo.ui regression in 43fb170a23bd, and that lf subrepo |
|
366 | This also tests the repo.ui regression in 43fb170a23bd, and that lf subrepo | |
349 | subrepos are archived properly. |
|
367 | subrepos are archived properly. | |
350 | Note that add --large through a subrepo currently adds the file as a normal file |
|
368 | Note that add --large through a subrepo currently adds the file as a normal file | |
351 |
|
369 | |||
352 | $ echo "large" > sub1/sub2/large.bin |
|
370 | $ echo "large" > sub1/sub2/large.bin | |
353 | $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin |
|
371 | $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin | |
354 | $ echo "large" > large.bin |
|
372 | $ echo "large" > large.bin | |
355 | $ hg --config extensions.largefiles= add --large large.bin |
|
373 | $ hg --config extensions.largefiles= add --large large.bin | |
356 | $ hg --config extensions.largefiles= ci -S -m "add large files" |
|
374 | $ hg --config extensions.largefiles= ci -S -m "add large files" | |
357 | committing subrepository sub1 |
|
375 | committing subrepository sub1 | |
358 | committing subrepository sub1/sub2 (glob) |
|
376 | committing subrepository sub1/sub2 (glob) | |
359 |
|
377 | |||
360 | $ hg --config extensions.largefiles= archive -S ../archive_lf |
|
378 | $ hg --config extensions.largefiles= archive -S ../archive_lf | |
361 | $ find ../archive_lf | sort |
|
379 | $ find ../archive_lf | sort | |
362 | ../archive_lf |
|
380 | ../archive_lf | |
363 | ../archive_lf/.hg_archival.txt |
|
381 | ../archive_lf/.hg_archival.txt | |
364 | ../archive_lf/.hgsub |
|
382 | ../archive_lf/.hgsub | |
365 | ../archive_lf/.hgsubstate |
|
383 | ../archive_lf/.hgsubstate | |
366 | ../archive_lf/large.bin |
|
384 | ../archive_lf/large.bin | |
367 | ../archive_lf/main |
|
385 | ../archive_lf/main | |
368 | ../archive_lf/sub1 |
|
386 | ../archive_lf/sub1 | |
369 | ../archive_lf/sub1/.hgsub |
|
387 | ../archive_lf/sub1/.hgsub | |
370 | ../archive_lf/sub1/.hgsubstate |
|
388 | ../archive_lf/sub1/.hgsubstate | |
371 | ../archive_lf/sub1/sub1 |
|
389 | ../archive_lf/sub1/sub1 | |
372 | ../archive_lf/sub1/sub2 |
|
390 | ../archive_lf/sub1/sub2 | |
373 | ../archive_lf/sub1/sub2/folder |
|
391 | ../archive_lf/sub1/sub2/folder | |
374 | ../archive_lf/sub1/sub2/folder/test.txt |
|
392 | ../archive_lf/sub1/sub2/folder/test.txt | |
375 | ../archive_lf/sub1/sub2/large.bin |
|
393 | ../archive_lf/sub1/sub2/large.bin | |
376 | ../archive_lf/sub1/sub2/sub2 |
|
394 | ../archive_lf/sub1/sub2/sub2 | |
377 | ../archive_lf/sub1/sub2/test.txt |
|
395 | ../archive_lf/sub1/sub2/test.txt | |
378 | $ rm -rf ../archive_lf |
|
396 | $ rm -rf ../archive_lf | |
379 |
|
397 | |||
380 | Exclude large files from main and sub-sub repo |
|
398 | Exclude large files from main and sub-sub repo | |
381 |
|
399 | |||
382 | $ hg --config extensions.largefiles= archive -S -X '**.bin' ../archive_lf |
|
400 | $ hg --config extensions.largefiles= archive -S -X '**.bin' ../archive_lf | |
383 | $ find ../archive_lf | sort |
|
401 | $ find ../archive_lf | sort | |
384 | ../archive_lf |
|
402 | ../archive_lf | |
385 | ../archive_lf/.hg_archival.txt |
|
403 | ../archive_lf/.hg_archival.txt | |
386 | ../archive_lf/.hgsub |
|
404 | ../archive_lf/.hgsub | |
387 | ../archive_lf/.hgsubstate |
|
405 | ../archive_lf/.hgsubstate | |
388 | ../archive_lf/main |
|
406 | ../archive_lf/main | |
389 | ../archive_lf/sub1 |
|
407 | ../archive_lf/sub1 | |
390 | ../archive_lf/sub1/.hgsub |
|
408 | ../archive_lf/sub1/.hgsub | |
391 | ../archive_lf/sub1/.hgsubstate |
|
409 | ../archive_lf/sub1/.hgsubstate | |
392 | ../archive_lf/sub1/sub1 |
|
410 | ../archive_lf/sub1/sub1 | |
393 | ../archive_lf/sub1/sub2 |
|
411 | ../archive_lf/sub1/sub2 | |
394 | ../archive_lf/sub1/sub2/folder |
|
412 | ../archive_lf/sub1/sub2/folder | |
395 | ../archive_lf/sub1/sub2/folder/test.txt |
|
413 | ../archive_lf/sub1/sub2/folder/test.txt | |
396 | ../archive_lf/sub1/sub2/sub2 |
|
414 | ../archive_lf/sub1/sub2/sub2 | |
397 | ../archive_lf/sub1/sub2/test.txt |
|
415 | ../archive_lf/sub1/sub2/test.txt | |
398 | $ rm -rf ../archive_lf |
|
416 | $ rm -rf ../archive_lf | |
399 |
|
417 | |||
400 | Exclude normal files from main and sub-sub repo |
|
418 | Exclude normal files from main and sub-sub repo | |
401 |
|
419 | |||
402 | $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz |
|
420 | $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz | |
403 | $ tar -tzf ../archive_lf.tgz | sort |
|
421 | $ tar -tzf ../archive_lf.tgz | sort | |
404 | .hgsub |
|
422 | .hgsub | |
405 | .hgsubstate |
|
423 | .hgsubstate | |
406 | large.bin |
|
424 | large.bin | |
407 | main |
|
425 | main | |
408 | sub1/.hgsub |
|
426 | sub1/.hgsub | |
409 | sub1/.hgsubstate |
|
427 | sub1/.hgsubstate | |
410 | sub1/sub1 |
|
428 | sub1/sub1 | |
411 | sub1/sub2/large.bin |
|
429 | sub1/sub2/large.bin | |
412 | sub1/sub2/sub2 |
|
430 | sub1/sub2/sub2 | |
413 |
|
431 | |||
414 | Include normal files from within a largefiles subrepo |
|
432 | Include normal files from within a largefiles subrepo | |
415 |
|
433 | |||
416 | $ hg --config extensions.largefiles= archive -S -I '**.txt' ../archive_lf |
|
434 | $ hg --config extensions.largefiles= archive -S -I '**.txt' ../archive_lf | |
417 | $ find ../archive_lf | sort |
|
435 | $ find ../archive_lf | sort | |
418 | ../archive_lf |
|
436 | ../archive_lf | |
419 | ../archive_lf/.hg_archival.txt |
|
437 | ../archive_lf/.hg_archival.txt | |
420 | ../archive_lf/sub1 |
|
438 | ../archive_lf/sub1 | |
421 | ../archive_lf/sub1/sub2 |
|
439 | ../archive_lf/sub1/sub2 | |
422 | ../archive_lf/sub1/sub2/folder |
|
440 | ../archive_lf/sub1/sub2/folder | |
423 | ../archive_lf/sub1/sub2/folder/test.txt |
|
441 | ../archive_lf/sub1/sub2/folder/test.txt | |
424 | ../archive_lf/sub1/sub2/test.txt |
|
442 | ../archive_lf/sub1/sub2/test.txt | |
425 | $ rm -rf ../archive_lf |
|
443 | $ rm -rf ../archive_lf | |
426 |
|
444 | |||
427 | Include large files from within a largefiles subrepo |
|
445 | Include large files from within a largefiles subrepo | |
428 |
|
446 | |||
429 | $ hg --config extensions.largefiles= archive -S -I '**.bin' ../archive_lf |
|
447 | $ hg --config extensions.largefiles= archive -S -I '**.bin' ../archive_lf | |
430 | $ find ../archive_lf | sort |
|
448 | $ find ../archive_lf | sort | |
431 | ../archive_lf |
|
449 | ../archive_lf | |
432 | ../archive_lf/large.bin |
|
450 | ../archive_lf/large.bin | |
433 | ../archive_lf/sub1 |
|
451 | ../archive_lf/sub1 | |
434 | ../archive_lf/sub1/sub2 |
|
452 | ../archive_lf/sub1/sub2 | |
435 | ../archive_lf/sub1/sub2/large.bin |
|
453 | ../archive_lf/sub1/sub2/large.bin | |
436 | $ rm -rf ../archive_lf |
|
454 | $ rm -rf ../archive_lf | |
437 |
|
455 | |||
438 | Find an exact largefile match in a largefiles subrepo |
|
456 | Find an exact largefile match in a largefiles subrepo | |
439 |
|
457 | |||
440 | $ hg --config extensions.largefiles= archive -S -I 'sub1/sub2/large.bin' ../archive_lf |
|
458 | $ hg --config extensions.largefiles= archive -S -I 'sub1/sub2/large.bin' ../archive_lf | |
441 | $ find ../archive_lf | sort |
|
459 | $ find ../archive_lf | sort | |
442 | ../archive_lf |
|
460 | ../archive_lf | |
443 | ../archive_lf/sub1 |
|
461 | ../archive_lf/sub1 | |
444 | ../archive_lf/sub1/sub2 |
|
462 | ../archive_lf/sub1/sub2 | |
445 | ../archive_lf/sub1/sub2/large.bin |
|
463 | ../archive_lf/sub1/sub2/large.bin | |
446 | $ rm -rf ../archive_lf |
|
464 | $ rm -rf ../archive_lf | |
447 |
|
465 | |||
448 | The local repo enables largefiles if a largefiles repo is cloned |
|
466 | The local repo enables largefiles if a largefiles repo is cloned | |
449 | $ hg showconfig extensions |
|
467 | $ hg showconfig extensions | |
450 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
468 | abort: repository requires features unknown to this Mercurial: largefiles! | |
451 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
469 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) | |
452 | [255] |
|
470 | [255] | |
453 | $ hg --config extensions.largefiles= clone -qU . ../lfclone |
|
471 | $ hg --config extensions.largefiles= clone -qU . ../lfclone | |
454 | $ cat ../lfclone/.hg/hgrc |
|
472 | $ cat ../lfclone/.hg/hgrc | |
455 | # example repository config (see "hg help config" for more info) |
|
473 | # example repository config (see "hg help config" for more info) | |
456 | [paths] |
|
474 | [paths] | |
457 | default = $TESTTMP/cloned (glob) |
|
475 | default = $TESTTMP/cloned (glob) | |
458 |
|
476 | |||
459 | # path aliases to other clones of this repo in URLs or filesystem paths |
|
477 | # path aliases to other clones of this repo in URLs or filesystem paths | |
460 | # (see "hg help config.paths" for more info) |
|
478 | # (see "hg help config.paths" for more info) | |
461 | # |
|
479 | # | |
462 | # default-push = ssh://jdoe@example.net/hg/jdoes-fork |
|
480 | # default-push = ssh://jdoe@example.net/hg/jdoes-fork | |
463 | # my-fork = ssh://jdoe@example.net/hg/jdoes-fork |
|
481 | # my-fork = ssh://jdoe@example.net/hg/jdoes-fork | |
464 | # my-clone = /home/jdoe/jdoes-clone |
|
482 | # my-clone = /home/jdoe/jdoes-clone | |
465 |
|
483 | |||
466 | [ui] |
|
484 | [ui] | |
467 | # name and email (local to this repository, optional), e.g. |
|
485 | # name and email (local to this repository, optional), e.g. | |
468 | # username = Jane Doe <jdoe@example.com> |
|
486 | # username = Jane Doe <jdoe@example.com> | |
469 |
|
487 | |||
470 | [extensions] |
|
488 | [extensions] | |
471 | largefiles= |
|
489 | largefiles= | |
472 |
|
490 | |||
473 | Find an exact match to a standin (should archive nothing) |
|
491 | Find an exact match to a standin (should archive nothing) | |
474 | $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf |
|
492 | $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf | |
475 | $ find ../archive_lf 2> /dev/null | sort |
|
493 | $ find ../archive_lf 2> /dev/null | sort | |
476 |
|
494 | |||
477 | $ cat >> $HGRCPATH <<EOF |
|
495 | $ cat >> $HGRCPATH <<EOF | |
478 | > [extensions] |
|
496 | > [extensions] | |
479 | > largefiles= |
|
497 | > largefiles= | |
480 | > [largefiles] |
|
498 | > [largefiles] | |
481 | > patterns=glob:**.dat |
|
499 | > patterns=glob:**.dat | |
482 | > EOF |
|
500 | > EOF | |
483 |
|
501 | |||
484 | Test forget through a deep subrepo with the largefiles extension, both a |
|
502 | Test forget through a deep subrepo with the largefiles extension, both a | |
485 | largefile and a normal file. Then a largefile that hasn't been committed yet. |
|
503 | largefile and a normal file. Then a largefile that hasn't been committed yet. | |
486 | $ touch sub1/sub2/untracked.txt |
|
504 | $ touch sub1/sub2/untracked.txt | |
487 | $ touch sub1/sub2/large.dat |
|
505 | $ touch sub1/sub2/large.dat | |
488 | $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt |
|
506 | $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt | |
489 | not removing sub1/sub2/untracked.txt: file is already untracked (glob) |
|
507 | not removing sub1/sub2/untracked.txt: file is already untracked (glob) | |
490 | [1] |
|
508 | [1] | |
491 | $ hg add --large --dry-run -v sub1/sub2/untracked.txt |
|
509 | $ hg add --large --dry-run -v sub1/sub2/untracked.txt | |
492 | adding sub1/sub2/untracked.txt as a largefile (glob) |
|
510 | adding sub1/sub2/untracked.txt as a largefile (glob) | |
493 | $ hg add --large -v sub1/sub2/untracked.txt |
|
511 | $ hg add --large -v sub1/sub2/untracked.txt | |
494 | adding sub1/sub2/untracked.txt as a largefile (glob) |
|
512 | adding sub1/sub2/untracked.txt as a largefile (glob) | |
495 | $ hg add --normal -v sub1/sub2/large.dat |
|
513 | $ hg add --normal -v sub1/sub2/large.dat | |
496 | adding sub1/sub2/large.dat (glob) |
|
514 | adding sub1/sub2/large.dat (glob) | |
497 | $ hg forget -v sub1/sub2/untracked.txt |
|
515 | $ hg forget -v sub1/sub2/untracked.txt | |
498 | removing sub1/sub2/untracked.txt (glob) |
|
516 | removing sub1/sub2/untracked.txt (glob) | |
499 | $ hg status -S |
|
517 | $ hg status -S | |
500 | A sub1/sub2/large.dat |
|
518 | A sub1/sub2/large.dat | |
501 | R sub1/sub2/large.bin |
|
519 | R sub1/sub2/large.bin | |
502 | R sub1/sub2/test.txt |
|
520 | R sub1/sub2/test.txt | |
503 | ? foo/bar/abc |
|
521 | ? foo/bar/abc | |
504 | ? sub1/sub2/untracked.txt |
|
522 | ? sub1/sub2/untracked.txt | |
505 | ? sub1/sub2/x.txt |
|
523 | ? sub1/sub2/x.txt | |
506 | $ hg add sub1/sub2 |
|
524 | $ hg add sub1/sub2 | |
507 |
|
525 | |||
508 | $ hg archive -S -r 'wdir()' ../wdir2 |
|
526 | $ hg archive -S -r 'wdir()' ../wdir2 | |
509 | $ diff -r . ../wdir2 | grep -v '\.hg$' |
|
527 | $ diff -r . ../wdir2 | grep -v '\.hg$' | |
510 | Only in ../wdir2: .hg_archival.txt |
|
528 | Only in ../wdir2: .hg_archival.txt | |
511 | Only in .: .hglf |
|
529 | Only in .: .hglf | |
512 | Only in .: foo |
|
530 | Only in .: foo | |
513 | Only in ./sub1/sub2: large.bin |
|
531 | Only in ./sub1/sub2: large.bin | |
514 | Only in ./sub1/sub2: test.txt |
|
532 | Only in ./sub1/sub2: test.txt | |
515 | Only in ./sub1/sub2: untracked.txt |
|
533 | Only in ./sub1/sub2: untracked.txt | |
516 | Only in ./sub1/sub2: x.txt |
|
534 | Only in ./sub1/sub2: x.txt | |
517 | $ find ../wdir2 -type f | sort |
|
535 | $ find ../wdir2 -type f | sort | |
518 | ../wdir2/.hg_archival.txt |
|
536 | ../wdir2/.hg_archival.txt | |
519 | ../wdir2/.hgsub |
|
537 | ../wdir2/.hgsub | |
520 | ../wdir2/.hgsubstate |
|
538 | ../wdir2/.hgsubstate | |
521 | ../wdir2/large.bin |
|
539 | ../wdir2/large.bin | |
522 | ../wdir2/main |
|
540 | ../wdir2/main | |
523 | ../wdir2/sub1/.hgsub |
|
541 | ../wdir2/sub1/.hgsub | |
524 | ../wdir2/sub1/.hgsubstate |
|
542 | ../wdir2/sub1/.hgsubstate | |
525 | ../wdir2/sub1/sub1 |
|
543 | ../wdir2/sub1/sub1 | |
526 | ../wdir2/sub1/sub2/folder/test.txt |
|
544 | ../wdir2/sub1/sub2/folder/test.txt | |
527 | ../wdir2/sub1/sub2/large.dat |
|
545 | ../wdir2/sub1/sub2/large.dat | |
528 | ../wdir2/sub1/sub2/sub2 |
|
546 | ../wdir2/sub1/sub2/sub2 | |
529 | $ hg status -S -mac -n | sort |
|
547 | $ hg status -S -mac -n | sort | |
530 | .hgsub |
|
548 | .hgsub | |
531 | .hgsubstate |
|
549 | .hgsubstate | |
532 | large.bin |
|
550 | large.bin | |
533 | main |
|
551 | main | |
534 | sub1/.hgsub |
|
552 | sub1/.hgsub | |
535 | sub1/.hgsubstate |
|
553 | sub1/.hgsubstate | |
536 | sub1/sub1 |
|
554 | sub1/sub1 | |
537 | sub1/sub2/folder/test.txt |
|
555 | sub1/sub2/folder/test.txt | |
538 | sub1/sub2/large.dat |
|
556 | sub1/sub2/large.dat | |
539 | sub1/sub2/sub2 |
|
557 | sub1/sub2/sub2 | |
540 |
|
558 | |||
541 | $ hg ci -Sqm 'forget testing' |
|
559 | $ hg ci -Sqm 'forget testing' | |
542 |
|
560 | |||
543 | Test 'wdir()' modified file archiving with largefiles |
|
561 | Test 'wdir()' modified file archiving with largefiles | |
544 | $ echo 'mod' > main |
|
562 | $ echo 'mod' > main | |
545 | $ echo 'mod' > large.bin |
|
563 | $ echo 'mod' > large.bin | |
546 | $ echo 'mod' > sub1/sub2/large.dat |
|
564 | $ echo 'mod' > sub1/sub2/large.dat | |
547 | $ hg archive -S -r 'wdir()' ../wdir3 |
|
565 | $ hg archive -S -r 'wdir()' ../wdir3 | |
548 | $ diff -r . ../wdir3 | grep -v '\.hg$' |
|
566 | $ diff -r . ../wdir3 | grep -v '\.hg$' | |
549 | Only in ../wdir3: .hg_archival.txt |
|
567 | Only in ../wdir3: .hg_archival.txt | |
550 | Only in .: .hglf |
|
568 | Only in .: .hglf | |
551 | Only in .: foo |
|
569 | Only in .: foo | |
552 | Only in ./sub1/sub2: large.bin |
|
570 | Only in ./sub1/sub2: large.bin | |
553 | Only in ./sub1/sub2: test.txt |
|
571 | Only in ./sub1/sub2: test.txt | |
554 | Only in ./sub1/sub2: untracked.txt |
|
572 | Only in ./sub1/sub2: untracked.txt | |
555 | Only in ./sub1/sub2: x.txt |
|
573 | Only in ./sub1/sub2: x.txt | |
556 | $ find ../wdir3 -type f | sort |
|
574 | $ find ../wdir3 -type f | sort | |
557 | ../wdir3/.hg_archival.txt |
|
575 | ../wdir3/.hg_archival.txt | |
558 | ../wdir3/.hgsub |
|
576 | ../wdir3/.hgsub | |
559 | ../wdir3/.hgsubstate |
|
577 | ../wdir3/.hgsubstate | |
560 | ../wdir3/large.bin |
|
578 | ../wdir3/large.bin | |
561 | ../wdir3/main |
|
579 | ../wdir3/main | |
562 | ../wdir3/sub1/.hgsub |
|
580 | ../wdir3/sub1/.hgsub | |
563 | ../wdir3/sub1/.hgsubstate |
|
581 | ../wdir3/sub1/.hgsubstate | |
564 | ../wdir3/sub1/sub1 |
|
582 | ../wdir3/sub1/sub1 | |
565 | ../wdir3/sub1/sub2/folder/test.txt |
|
583 | ../wdir3/sub1/sub2/folder/test.txt | |
566 | ../wdir3/sub1/sub2/large.dat |
|
584 | ../wdir3/sub1/sub2/large.dat | |
567 | ../wdir3/sub1/sub2/sub2 |
|
585 | ../wdir3/sub1/sub2/sub2 | |
568 | $ hg up -Cq |
|
586 | $ hg up -Cq | |
569 |
|
587 | |||
570 | Test issue4330: commit a directory where only normal files have changed |
|
588 | Test issue4330: commit a directory where only normal files have changed | |
571 | $ touch foo/bar/large.dat |
|
589 | $ touch foo/bar/large.dat | |
572 | $ hg add --large foo/bar/large.dat |
|
590 | $ hg add --large foo/bar/large.dat | |
573 | $ hg ci -m 'add foo/bar/large.dat' |
|
591 | $ hg ci -m 'add foo/bar/large.dat' | |
574 | $ touch a.txt |
|
592 | $ touch a.txt | |
575 | $ touch a.dat |
|
593 | $ touch a.dat | |
576 | $ hg add -v foo/bar/abc a.txt a.dat |
|
594 | $ hg add -v foo/bar/abc a.txt a.dat | |
577 | adding a.dat as a largefile |
|
595 | adding a.dat as a largefile | |
578 | adding a.txt |
|
596 | adding a.txt | |
579 | adding foo/bar/abc (glob) |
|
597 | adding foo/bar/abc (glob) | |
580 | $ hg ci -m 'dir commit with only normal file deltas' foo/bar |
|
598 | $ hg ci -m 'dir commit with only normal file deltas' foo/bar | |
581 | $ hg status |
|
599 | $ hg status | |
582 | A a.dat |
|
600 | A a.dat | |
583 | A a.txt |
|
601 | A a.txt | |
584 |
|
602 | |||
585 | Test a directory commit with a changed largefile and a changed normal file |
|
603 | Test a directory commit with a changed largefile and a changed normal file | |
586 | $ echo changed > foo/bar/large.dat |
|
604 | $ echo changed > foo/bar/large.dat | |
587 | $ echo changed > foo/bar/abc |
|
605 | $ echo changed > foo/bar/abc | |
588 | $ hg ci -m 'dir commit with normal and lf file deltas' foo |
|
606 | $ hg ci -m 'dir commit with normal and lf file deltas' foo | |
589 | $ hg status |
|
607 | $ hg status | |
590 | A a.dat |
|
608 | A a.dat | |
591 | A a.txt |
|
609 | A a.txt | |
592 |
|
610 | |||
593 | $ hg ci -m "add a.*" |
|
611 | $ hg ci -m "add a.*" | |
594 | $ hg mv a.dat b.dat |
|
612 | $ hg mv a.dat b.dat | |
595 | $ hg mv foo/bar/abc foo/bar/def |
|
613 | $ hg mv foo/bar/abc foo/bar/def | |
596 | $ hg status -C |
|
614 | $ hg status -C | |
597 | A b.dat |
|
615 | A b.dat | |
598 | a.dat |
|
616 | a.dat | |
599 | A foo/bar/def |
|
617 | A foo/bar/def | |
600 | foo/bar/abc |
|
618 | foo/bar/abc | |
601 | R a.dat |
|
619 | R a.dat | |
602 | R foo/bar/abc |
|
620 | R foo/bar/abc | |
603 |
|
621 | |||
604 | $ hg ci -m "move large and normal" |
|
622 | $ hg ci -m "move large and normal" | |
605 | $ hg status -C --rev '.^' --rev . |
|
623 | $ hg status -C --rev '.^' --rev . | |
606 | A b.dat |
|
624 | A b.dat | |
607 | a.dat |
|
625 | a.dat | |
608 | A foo/bar/def |
|
626 | A foo/bar/def | |
609 | foo/bar/abc |
|
627 | foo/bar/abc | |
610 | R a.dat |
|
628 | R a.dat | |
611 | R foo/bar/abc |
|
629 | R foo/bar/abc | |
612 |
|
630 | |||
613 |
|
631 | |||
614 | $ echo foo > main |
|
632 | $ echo foo > main | |
615 | $ hg ci -m "mod parent only" |
|
633 | $ hg ci -m "mod parent only" | |
616 | $ hg init sub3 |
|
634 | $ hg init sub3 | |
617 | $ echo "sub3 = sub3" >> .hgsub |
|
635 | $ echo "sub3 = sub3" >> .hgsub | |
618 | $ echo xyz > sub3/a.txt |
|
636 | $ echo xyz > sub3/a.txt | |
619 | $ hg add sub3/a.txt |
|
637 | $ hg add sub3/a.txt | |
620 | $ hg ci -Sm "add sub3" |
|
638 | $ hg ci -Sm "add sub3" | |
621 | committing subrepository sub3 |
|
639 | committing subrepository sub3 | |
622 | $ cat .hgsub | grep -v sub3 > .hgsub1 |
|
640 | $ cat .hgsub | grep -v sub3 > .hgsub1 | |
623 | $ mv .hgsub1 .hgsub |
|
641 | $ mv .hgsub1 .hgsub | |
624 | $ hg ci -m "remove sub3" |
|
642 | $ hg ci -m "remove sub3" | |
625 |
|
643 | |||
626 | $ hg log -r "subrepo()" --style compact |
|
644 | $ hg log -r "subrepo()" --style compact | |
627 | 0 7f491f53a367 1970-01-01 00:00 +0000 test |
|
645 | 0 7f491f53a367 1970-01-01 00:00 +0000 test | |
628 | main import |
|
646 | main import | |
629 |
|
647 | |||
630 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test |
|
648 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test | |
631 | deep nested modif should trigger a commit |
|
649 | deep nested modif should trigger a commit | |
632 |
|
650 | |||
633 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test |
|
651 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test | |
634 | add test.txt |
|
652 | add test.txt | |
635 |
|
653 | |||
636 | 3 7c64f035294f 1970-01-01 00:00 +0000 test |
|
654 | 3 7c64f035294f 1970-01-01 00:00 +0000 test | |
637 | add large files |
|
655 | add large files | |
638 |
|
656 | |||
639 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test |
|
657 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test | |
640 | forget testing |
|
658 | forget testing | |
641 |
|
659 | |||
642 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
660 | 11 9685a22af5db 1970-01-01 00:00 +0000 test | |
643 | add sub3 |
|
661 | add sub3 | |
644 |
|
662 | |||
645 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
663 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test | |
646 | remove sub3 |
|
664 | remove sub3 | |
647 |
|
665 | |||
648 | $ hg log -r "subrepo('sub3')" --style compact |
|
666 | $ hg log -r "subrepo('sub3')" --style compact | |
649 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
667 | 11 9685a22af5db 1970-01-01 00:00 +0000 test | |
650 | add sub3 |
|
668 | add sub3 | |
651 |
|
669 | |||
652 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
670 | 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test | |
653 | remove sub3 |
|
671 | remove sub3 | |
654 |
|
672 | |||
655 | $ hg log -r "subrepo('bogus')" --style compact |
|
673 | $ hg log -r "subrepo('bogus')" --style compact | |
656 |
|
674 | |||
657 |
|
675 | |||
658 | Test .hgsubstate in the R state |
|
676 | Test .hgsubstate in the R state | |
659 |
|
677 | |||
660 | $ hg rm .hgsub .hgsubstate |
|
678 | $ hg rm .hgsub .hgsubstate | |
661 | $ hg ci -m 'trash subrepo tracking' |
|
679 | $ hg ci -m 'trash subrepo tracking' | |
662 |
|
680 | |||
663 | $ hg log -r "subrepo('re:sub\d+')" --style compact |
|
681 | $ hg log -r "subrepo('re:sub\d+')" --style compact | |
664 | 0 7f491f53a367 1970-01-01 00:00 +0000 test |
|
682 | 0 7f491f53a367 1970-01-01 00:00 +0000 test | |
665 | main import |
|
683 | main import | |
666 |
|
684 | |||
667 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test |
|
685 | 1 ffe6649062fe 1970-01-01 00:00 +0000 test | |
668 | deep nested modif should trigger a commit |
|
686 | deep nested modif should trigger a commit | |
669 |
|
687 | |||
670 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test |
|
688 | 2 9bb10eebee29 1970-01-01 00:00 +0000 test | |
671 | add test.txt |
|
689 | add test.txt | |
672 |
|
690 | |||
673 | 3 7c64f035294f 1970-01-01 00:00 +0000 test |
|
691 | 3 7c64f035294f 1970-01-01 00:00 +0000 test | |
674 | add large files |
|
692 | add large files | |
675 |
|
693 | |||
676 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test |
|
694 | 4 f734a59e2e35 1970-01-01 00:00 +0000 test | |
677 | forget testing |
|
695 | forget testing | |
678 |
|
696 | |||
679 | 11 9685a22af5db 1970-01-01 00:00 +0000 test |
|
697 | 11 9685a22af5db 1970-01-01 00:00 +0000 test | |
680 | add sub3 |
|
698 | add sub3 | |
681 |
|
699 | |||
682 | 12 2e0485b475b9 1970-01-01 00:00 +0000 test |
|
700 | 12 2e0485b475b9 1970-01-01 00:00 +0000 test | |
683 | remove sub3 |
|
701 | remove sub3 | |
684 |
|
702 | |||
685 | 13[tip] a68b2c361653 1970-01-01 00:00 +0000 test |
|
703 | 13[tip] a68b2c361653 1970-01-01 00:00 +0000 test | |
686 | trash subrepo tracking |
|
704 | trash subrepo tracking | |
687 |
|
705 | |||
688 |
|
706 | |||
689 | Restore the trashed subrepo tracking |
|
707 | Restore the trashed subrepo tracking | |
690 |
|
708 | |||
691 | $ hg rollback -q |
|
709 | $ hg rollback -q | |
692 | $ hg update -Cq . |
|
710 | $ hg update -Cq . | |
693 |
|
711 | |||
694 | $ cd .. |
|
712 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now