Show More
@@ -1,618 +1,621 b'' | |||
|
1 | 1 | # Copyright 2009-2010 Gregory P. Ward |
|
2 | 2 | # Copyright 2009-2010 Intelerad Medical Systems Incorporated |
|
3 | 3 | # Copyright 2010-2011 Fog Creek Software |
|
4 | 4 | # Copyright 2010-2011 Unity Technologies |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | '''largefiles utility code: must not import other modules in this package.''' |
|
10 | 10 | |
|
11 | 11 | import os |
|
12 | 12 | import platform |
|
13 | 13 | import shutil |
|
14 | 14 | import stat |
|
15 | 15 | import copy |
|
16 | 16 | |
|
17 | 17 | from mercurial import dirstate, httpconnection, match as match_, util, scmutil |
|
18 | 18 | from mercurial.i18n import _ |
|
19 | 19 | from mercurial import node, error |
|
20 | 20 | |
|
21 | 21 | shortname = '.hglf' |
|
22 | 22 | shortnameslash = shortname + '/' |
|
23 | 23 | longname = 'largefiles' |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | # -- Private worker functions ------------------------------------------ |
|
27 | 27 | |
|
28 | 28 | def getminsize(ui, assumelfiles, opt, default=10): |
|
29 | 29 | lfsize = opt |
|
30 | 30 | if not lfsize and assumelfiles: |
|
31 | 31 | lfsize = ui.config(longname, 'minsize', default=default) |
|
32 | 32 | if lfsize: |
|
33 | 33 | try: |
|
34 | 34 | lfsize = float(lfsize) |
|
35 | 35 | except ValueError: |
|
36 | 36 | raise error.Abort(_('largefiles: size must be number (not %s)\n') |
|
37 | 37 | % lfsize) |
|
38 | 38 | if lfsize is None: |
|
39 | 39 | raise error.Abort(_('minimum size for largefiles must be specified')) |
|
40 | 40 | return lfsize |
|
41 | 41 | |
|
42 | 42 | def link(src, dest): |
|
43 | 43 | util.makedirs(os.path.dirname(dest)) |
|
44 | 44 | try: |
|
45 | 45 | util.oslink(src, dest) |
|
46 | 46 | except OSError: |
|
47 | 47 | # if hardlinks fail, fallback on atomic copy |
|
48 | 48 | dst = util.atomictempfile(dest) |
|
49 | 49 | for chunk in util.filechunkiter(open(src, 'rb')): |
|
50 | 50 | dst.write(chunk) |
|
51 | 51 | dst.close() |
|
52 | 52 | os.chmod(dest, os.stat(src).st_mode) |
|
53 | 53 | |
|
54 | 54 | def usercachepath(ui, hash): |
|
55 | 55 | path = ui.configpath(longname, 'usercache', None) |
|
56 | 56 | if path: |
|
57 | 57 | path = os.path.join(path, hash) |
|
58 | 58 | else: |
|
59 | 59 | if os.name == 'nt': |
|
60 | 60 | appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) |
|
61 | 61 | if appdata: |
|
62 | 62 | path = os.path.join(appdata, longname, hash) |
|
63 | 63 | elif platform.system() == 'Darwin': |
|
64 | 64 | home = os.getenv('HOME') |
|
65 | 65 | if home: |
|
66 | 66 | path = os.path.join(home, 'Library', 'Caches', |
|
67 | 67 | longname, hash) |
|
68 | 68 | elif os.name == 'posix': |
|
69 | 69 | path = os.getenv('XDG_CACHE_HOME') |
|
70 | 70 | if path: |
|
71 | 71 | path = os.path.join(path, longname, hash) |
|
72 | 72 | else: |
|
73 | 73 | home = os.getenv('HOME') |
|
74 | 74 | if home: |
|
75 | 75 | path = os.path.join(home, '.cache', longname, hash) |
|
76 | 76 | else: |
|
77 | 77 | raise error.Abort(_('unknown operating system: %s\n') % os.name) |
|
78 | 78 | return path |
|
79 | 79 | |
|
80 | 80 | def inusercache(ui, hash): |
|
81 | 81 | path = usercachepath(ui, hash) |
|
82 | 82 | return path and os.path.exists(path) |
|
83 | 83 | |
|
84 | 84 | def findfile(repo, hash): |
|
85 | 85 | path, exists = findstorepath(repo, hash) |
|
86 | 86 | if exists: |
|
87 | 87 | repo.ui.note(_('found %s in store\n') % hash) |
|
88 | 88 | return path |
|
89 | 89 | elif inusercache(repo.ui, hash): |
|
90 | 90 | repo.ui.note(_('found %s in system cache\n') % hash) |
|
91 | 91 | path = storepath(repo, hash) |
|
92 | 92 | link(usercachepath(repo.ui, hash), path) |
|
93 | 93 | return path |
|
94 | 94 | return None |
|
95 | 95 | |
|
96 | 96 | class largefilesdirstate(dirstate.dirstate): |
|
97 | 97 | def __getitem__(self, key): |
|
98 | 98 | return super(largefilesdirstate, self).__getitem__(unixpath(key)) |
|
99 | 99 | def normal(self, f): |
|
100 | 100 | return super(largefilesdirstate, self).normal(unixpath(f)) |
|
101 | 101 | def remove(self, f): |
|
102 | 102 | return super(largefilesdirstate, self).remove(unixpath(f)) |
|
103 | 103 | def add(self, f): |
|
104 | 104 | return super(largefilesdirstate, self).add(unixpath(f)) |
|
105 | 105 | def drop(self, f): |
|
106 | 106 | return super(largefilesdirstate, self).drop(unixpath(f)) |
|
107 | 107 | def forget(self, f): |
|
108 | 108 | return super(largefilesdirstate, self).forget(unixpath(f)) |
|
109 | 109 | def normallookup(self, f): |
|
110 | 110 | return super(largefilesdirstate, self).normallookup(unixpath(f)) |
|
111 | 111 | def _ignore(self, f): |
|
112 | 112 | return False |
|
113 | 113 | def write(self, tr=False): |
|
114 | 114 | # (1) disable PENDING mode always |
|
115 | 115 | # (lfdirstate isn't yet managed as a part of the transaction) |
|
116 | 116 | # (2) avoid develwarn 'use dirstate.write with ....' |
|
117 | 117 | super(largefilesdirstate, self).write(None) |
|
118 | 118 | |
|
119 | 119 | def openlfdirstate(ui, repo, create=True): |
|
120 | 120 | ''' |
|
121 | 121 | Return a dirstate object that tracks largefiles: i.e. its root is |
|
122 | 122 | the repo root, but it is saved in .hg/largefiles/dirstate. |
|
123 | 123 | ''' |
|
124 | 124 | lfstoredir = repo.join(longname) |
|
125 | 125 | opener = scmutil.opener(lfstoredir) |
|
126 | 126 | lfdirstate = largefilesdirstate(opener, ui, repo.root, |
|
127 | 127 | repo.dirstate._validate) |
|
128 | 128 | |
|
129 | 129 | # If the largefiles dirstate does not exist, populate and create |
|
130 | 130 | # it. This ensures that we create it on the first meaningful |
|
131 | 131 | # largefiles operation in a new clone. |
|
132 | 132 | if create and not os.path.exists(os.path.join(lfstoredir, 'dirstate')): |
|
133 | 133 | matcher = getstandinmatcher(repo) |
|
134 | 134 | standins = repo.dirstate.walk(matcher, [], False, False) |
|
135 | 135 | |
|
136 | 136 | if len(standins) > 0: |
|
137 | 137 | util.makedirs(lfstoredir) |
|
138 | 138 | |
|
139 | 139 | for standin in standins: |
|
140 | 140 | lfile = splitstandin(standin) |
|
141 | 141 | lfdirstate.normallookup(lfile) |
|
142 | 142 | return lfdirstate |
|
143 | 143 | |
|
144 | 144 | def lfdirstatestatus(lfdirstate, repo): |
|
145 | 145 | wctx = repo['.'] |
|
146 | 146 | match = match_.always(repo.root, repo.getcwd()) |
|
147 | 147 | unsure, s = lfdirstate.status(match, [], False, False, False) |
|
148 | 148 | modified, clean = s.modified, s.clean |
|
149 | 149 | for lfile in unsure: |
|
150 | 150 | try: |
|
151 | 151 | fctx = wctx[standin(lfile)] |
|
152 | 152 | except LookupError: |
|
153 | 153 | fctx = None |
|
154 | 154 | if not fctx or fctx.data().strip() != hashfile(repo.wjoin(lfile)): |
|
155 | 155 | modified.append(lfile) |
|
156 | 156 | else: |
|
157 | 157 | clean.append(lfile) |
|
158 | 158 | lfdirstate.normal(lfile) |
|
159 | 159 | return s |
|
160 | 160 | |
|
161 | 161 | def listlfiles(repo, rev=None, matcher=None): |
|
162 | 162 | '''return a list of largefiles in the working copy or the |
|
163 | 163 | specified changeset''' |
|
164 | 164 | |
|
165 | 165 | if matcher is None: |
|
166 | 166 | matcher = getstandinmatcher(repo) |
|
167 | 167 | |
|
168 | 168 | # ignore unknown files in working directory |
|
169 | 169 | return [splitstandin(f) |
|
170 | 170 | for f in repo[rev].walk(matcher) |
|
171 | 171 | if rev is not None or repo.dirstate[f] != '?'] |
|
172 | 172 | |
|
173 | 173 | def instore(repo, hash, forcelocal=False): |
|
174 | 174 | return os.path.exists(storepath(repo, hash, forcelocal)) |
|
175 | 175 | |
|
176 | 176 | def storepath(repo, hash, forcelocal=False): |
|
177 | 177 | if not forcelocal and repo.shared(): |
|
178 | 178 | return repo.vfs.reljoin(repo.sharedpath, longname, hash) |
|
179 | 179 | return repo.join(longname, hash) |
|
180 | 180 | |
|
181 | 181 | def findstorepath(repo, hash): |
|
182 | 182 | '''Search through the local store path(s) to find the file for the given |
|
183 | 183 | hash. If the file is not found, its path in the primary store is returned. |
|
184 | 184 | The return value is a tuple of (path, exists(path)). |
|
185 | 185 | ''' |
|
186 | 186 | # For shared repos, the primary store is in the share source. But for |
|
187 | 187 | # backward compatibility, force a lookup in the local store if it wasn't |
|
188 | 188 | # found in the share source. |
|
189 | 189 | path = storepath(repo, hash, False) |
|
190 | 190 | |
|
191 | 191 | if instore(repo, hash): |
|
192 | 192 | return (path, True) |
|
193 | 193 | elif repo.shared() and instore(repo, hash, True): |
|
194 | 194 | return storepath(repo, hash, True) |
|
195 | 195 | |
|
196 | 196 | return (path, False) |
|
197 | 197 | |
|
198 | 198 | def copyfromcache(repo, hash, filename): |
|
199 | 199 | '''Copy the specified largefile from the repo or system cache to |
|
200 | 200 | filename in the repository. Return true on success or false if the |
|
201 | 201 | file was not found in either cache (which should not happened: |
|
202 | 202 | this is meant to be called only after ensuring that the needed |
|
203 | 203 | largefile exists in the cache).''' |
|
204 | 204 | path = findfile(repo, hash) |
|
205 | 205 | if path is None: |
|
206 | 206 | return False |
|
207 | 207 | util.makedirs(os.path.dirname(repo.wjoin(filename))) |
|
208 | 208 | # The write may fail before the file is fully written, but we |
|
209 | 209 | # don't use atomic writes in the working copy. |
|
210 | 210 | shutil.copy(path, repo.wjoin(filename)) |
|
211 | 211 | return True |
|
212 | 212 | |
|
213 | 213 | def copytostore(repo, rev, file, uploaded=False): |
|
214 | 214 | hash = readstandin(repo, file, rev) |
|
215 | 215 | if instore(repo, hash): |
|
216 | 216 | return |
|
217 | 217 | copytostoreabsolute(repo, repo.wjoin(file), hash) |
|
218 | 218 | |
|
219 | 219 | def copyalltostore(repo, node): |
|
220 | 220 | '''Copy all largefiles in a given revision to the store''' |
|
221 | 221 | |
|
222 | 222 | ctx = repo[node] |
|
223 | 223 | for filename in ctx.files(): |
|
224 | 224 | if isstandin(filename) and filename in ctx.manifest(): |
|
225 | 225 | realfile = splitstandin(filename) |
|
226 | 226 | copytostore(repo, ctx.node(), realfile) |
|
227 | 227 | |
|
228 | 228 | |
|
229 | 229 | def copytostoreabsolute(repo, file, hash): |
|
230 | 230 | if inusercache(repo.ui, hash): |
|
231 | 231 | link(usercachepath(repo.ui, hash), storepath(repo, hash)) |
|
232 | 232 | else: |
|
233 | 233 | util.makedirs(os.path.dirname(storepath(repo, hash))) |
|
234 | 234 | dst = util.atomictempfile(storepath(repo, hash), |
|
235 | 235 | createmode=repo.store.createmode) |
|
236 | 236 | for chunk in util.filechunkiter(open(file, 'rb')): |
|
237 | 237 | dst.write(chunk) |
|
238 | 238 | dst.close() |
|
239 | 239 | linktousercache(repo, hash) |
|
240 | 240 | |
|
241 | 241 | def linktousercache(repo, hash): |
|
242 | 242 | path = usercachepath(repo.ui, hash) |
|
243 | 243 | if path: |
|
244 | 244 | link(storepath(repo, hash), path) |
|
245 | 245 | |
|
246 | 246 | def getstandinmatcher(repo, rmatcher=None): |
|
247 | 247 | '''Return a match object that applies rmatcher to the standin directory''' |
|
248 | 248 | standindir = repo.wjoin(shortname) |
|
249 | 249 | |
|
250 | 250 | # no warnings about missing files or directories |
|
251 | 251 | badfn = lambda f, msg: None |
|
252 | 252 | |
|
253 | 253 | if rmatcher and not rmatcher.always(): |
|
254 | 254 | pats = [os.path.join(standindir, pat) for pat in rmatcher.files()] |
|
255 | 255 | if not pats: |
|
256 | 256 | pats = [standindir] |
|
257 | 257 | match = scmutil.match(repo[None], pats, badfn=badfn) |
|
258 | 258 | # if pats is empty, it would incorrectly always match, so clear _always |
|
259 | 259 | match._always = False |
|
260 | 260 | else: |
|
261 | 261 | # no patterns: relative to repo root |
|
262 | 262 | match = scmutil.match(repo[None], [standindir], badfn=badfn) |
|
263 | 263 | return match |
|
264 | 264 | |
|
265 | 265 | def composestandinmatcher(repo, rmatcher): |
|
266 | 266 | '''Return a matcher that accepts standins corresponding to the |
|
267 | 267 | files accepted by rmatcher. Pass the list of files in the matcher |
|
268 | 268 | as the paths specified by the user.''' |
|
269 | 269 | smatcher = getstandinmatcher(repo, rmatcher) |
|
270 | 270 | isstandin = smatcher.matchfn |
|
271 | 271 | def composedmatchfn(f): |
|
272 | 272 | return isstandin(f) and rmatcher.matchfn(splitstandin(f)) |
|
273 | 273 | smatcher.matchfn = composedmatchfn |
|
274 | 274 | |
|
275 | 275 | return smatcher |
|
276 | 276 | |
|
277 | 277 | def standin(filename): |
|
278 | 278 | '''Return the repo-relative path to the standin for the specified big |
|
279 | 279 | file.''' |
|
280 | 280 | # Notes: |
|
281 | 281 | # 1) Some callers want an absolute path, but for instance addlargefiles |
|
282 | 282 | # needs it repo-relative so it can be passed to repo[None].add(). So |
|
283 | 283 | # leave it up to the caller to use repo.wjoin() to get an absolute path. |
|
284 | 284 | # 2) Join with '/' because that's what dirstate always uses, even on |
|
285 | 285 | # Windows. Change existing separator to '/' first in case we are |
|
286 | 286 | # passed filenames from an external source (like the command line). |
|
287 | 287 | return shortnameslash + util.pconvert(filename) |
|
288 | 288 | |
|
289 | 289 | def isstandin(filename): |
|
290 | 290 | '''Return true if filename is a big file standin. filename must be |
|
291 | 291 | in Mercurial's internal form (slash-separated).''' |
|
292 | 292 | return filename.startswith(shortnameslash) |
|
293 | 293 | |
|
294 | 294 | def splitstandin(filename): |
|
295 | 295 | # Split on / because that's what dirstate always uses, even on Windows. |
|
296 | 296 | # Change local separator to / first just in case we are passed filenames |
|
297 | 297 | # from an external source (like the command line). |
|
298 | 298 | bits = util.pconvert(filename).split('/', 1) |
|
299 | 299 | if len(bits) == 2 and bits[0] == shortname: |
|
300 | 300 | return bits[1] |
|
301 | 301 | else: |
|
302 | 302 | return None |
|
303 | 303 | |
|
304 | 304 | def updatestandin(repo, standin): |
|
305 | 305 | file = repo.wjoin(splitstandin(standin)) |
|
306 | 306 | if os.path.exists(file): |
|
307 | 307 | hash = hashfile(file) |
|
308 | 308 | executable = getexecutable(file) |
|
309 | 309 | writestandin(repo, standin, hash, executable) |
|
310 | 310 | |
|
311 | 311 | def readstandin(repo, filename, node=None): |
|
312 | 312 | '''read hex hash from standin for filename at given node, or working |
|
313 | 313 | directory if no node is given''' |
|
314 | 314 | return repo[node][standin(filename)].data().strip() |
|
315 | 315 | |
|
316 | 316 | def writestandin(repo, standin, hash, executable): |
|
317 | 317 | '''write hash to <repo.root>/<standin>''' |
|
318 | 318 | repo.wwrite(standin, hash + '\n', executable and 'x' or '') |
|
319 | 319 | |
|
320 | 320 | def copyandhash(instream, outfile): |
|
321 | 321 | '''Read bytes from instream (iterable) and write them to outfile, |
|
322 | 322 | computing the SHA-1 hash of the data along the way. Return the hash.''' |
|
323 | 323 | hasher = util.sha1('') |
|
324 | 324 | for data in instream: |
|
325 | 325 | hasher.update(data) |
|
326 | 326 | outfile.write(data) |
|
327 | 327 | return hasher.hexdigest() |
|
328 | 328 | |
|
329 | 329 | def hashrepofile(repo, file): |
|
330 | 330 | return hashfile(repo.wjoin(file)) |
|
331 | 331 | |
|
332 | 332 | def hashfile(file): |
|
333 | 333 | if not os.path.exists(file): |
|
334 | 334 | return '' |
|
335 | 335 | hasher = util.sha1('') |
|
336 | 336 | fd = open(file, 'rb') |
|
337 | 337 | for data in util.filechunkiter(fd, 128 * 1024): |
|
338 | 338 | hasher.update(data) |
|
339 | 339 | fd.close() |
|
340 | 340 | return hasher.hexdigest() |
|
341 | 341 | |
|
342 | 342 | def getexecutable(filename): |
|
343 | 343 | mode = os.stat(filename).st_mode |
|
344 | 344 | return ((mode & stat.S_IXUSR) and |
|
345 | 345 | (mode & stat.S_IXGRP) and |
|
346 | 346 | (mode & stat.S_IXOTH)) |
|
347 | 347 | |
|
348 | 348 | def urljoin(first, second, *arg): |
|
349 | 349 | def join(left, right): |
|
350 | 350 | if not left.endswith('/'): |
|
351 | 351 | left += '/' |
|
352 | 352 | if right.startswith('/'): |
|
353 | 353 | right = right[1:] |
|
354 | 354 | return left + right |
|
355 | 355 | |
|
356 | 356 | url = join(first, second) |
|
357 | 357 | for a in arg: |
|
358 | 358 | url = join(url, a) |
|
359 | 359 | return url |
|
360 | 360 | |
|
361 | 361 | def hexsha1(data): |
|
362 | 362 | """hexsha1 returns the hex-encoded sha1 sum of the data in the file-like |
|
363 | 363 | object data""" |
|
364 | 364 | h = util.sha1() |
|
365 | 365 | for chunk in util.filechunkiter(data): |
|
366 | 366 | h.update(chunk) |
|
367 | 367 | return h.hexdigest() |
|
368 | 368 | |
|
369 | 369 | def httpsendfile(ui, filename): |
|
370 | 370 | return httpconnection.httpsendfile(ui, filename, 'rb') |
|
371 | 371 | |
|
372 | 372 | def unixpath(path): |
|
373 | 373 | '''Return a version of path normalized for use with the lfdirstate.''' |
|
374 | 374 | return util.pconvert(os.path.normpath(path)) |
|
375 | 375 | |
|
376 | 376 | def islfilesrepo(repo): |
|
377 | 377 | if ('largefiles' in repo.requirements and |
|
378 | 378 | any(shortnameslash in f[0] for f in repo.store.datafiles())): |
|
379 | 379 | return True |
|
380 | 380 | |
|
381 | 381 | return any(openlfdirstate(repo.ui, repo, False)) |
|
382 | 382 | |
|
383 | 383 | class storeprotonotcapable(Exception): |
|
384 | 384 | def __init__(self, storetypes): |
|
385 | 385 | self.storetypes = storetypes |
|
386 | 386 | |
|
387 | 387 | def getstandinsstate(repo): |
|
388 | 388 | standins = [] |
|
389 | 389 | matcher = getstandinmatcher(repo) |
|
390 | 390 | for standin in repo.dirstate.walk(matcher, [], False, False): |
|
391 | 391 | lfile = splitstandin(standin) |
|
392 | 392 | try: |
|
393 | 393 | hash = readstandin(repo, lfile) |
|
394 | 394 | except IOError: |
|
395 | 395 | hash = None |
|
396 | 396 | standins.append((lfile, hash)) |
|
397 | 397 | return standins |
|
398 | 398 | |
|
399 | 399 | def synclfdirstate(repo, lfdirstate, lfile, normallookup): |
|
400 | 400 | lfstandin = standin(lfile) |
|
401 | 401 | if lfstandin in repo.dirstate: |
|
402 | 402 | stat = repo.dirstate._map[lfstandin] |
|
403 | 403 | state, mtime = stat[0], stat[3] |
|
404 | 404 | else: |
|
405 | 405 | state, mtime = '?', -1 |
|
406 | 406 | if state == 'n': |
|
407 | 407 | if (normallookup or mtime < 0 or |
|
408 | 408 | not os.path.exists(repo.wjoin(lfile))): |
|
409 | 409 | # state 'n' doesn't ensure 'clean' in this case |
|
410 | 410 | lfdirstate.normallookup(lfile) |
|
411 | 411 | else: |
|
412 | 412 | lfdirstate.normal(lfile) |
|
413 | 413 | elif state == 'm': |
|
414 | 414 | lfdirstate.normallookup(lfile) |
|
415 | 415 | elif state == 'r': |
|
416 | 416 | lfdirstate.remove(lfile) |
|
417 | 417 | elif state == 'a': |
|
418 | 418 | lfdirstate.add(lfile) |
|
419 | 419 | elif state == '?': |
|
420 | 420 | lfdirstate.drop(lfile) |
|
421 | 421 | |
|
422 | 422 | def markcommitted(orig, ctx, node): |
|
423 | 423 | repo = ctx.repo() |
|
424 | 424 | |
|
425 | 425 | orig(node) |
|
426 | 426 | |
|
427 | 427 | # ATTENTION: "ctx.files()" may differ from "repo[node].files()" |
|
428 | 428 | # because files coming from the 2nd parent are omitted in the latter. |
|
429 | 429 | # |
|
430 | 430 | # The former should be used to get targets of "synclfdirstate", |
|
431 | 431 | # because such files: |
|
432 | 432 | # - are marked as "a" by "patch.patch()" (e.g. via transplant), and |
|
433 | 433 | # - have to be marked as "n" after commit, but |
|
434 | 434 | # - aren't listed in "repo[node].files()" |
|
435 | 435 | |
|
436 | 436 | lfdirstate = openlfdirstate(repo.ui, repo) |
|
437 | 437 | for f in ctx.files(): |
|
438 | 438 | if isstandin(f): |
|
439 | 439 | lfile = splitstandin(f) |
|
440 | 440 | synclfdirstate(repo, lfdirstate, lfile, False) |
|
441 | 441 | lfdirstate.write() |
|
442 | 442 | |
|
443 | 443 | # As part of committing, copy all of the largefiles into the cache. |
|
444 | 444 | copyalltostore(repo, node) |
|
445 | 445 | |
|
446 | 446 | def getlfilestoupdate(oldstandins, newstandins): |
|
447 | 447 | changedstandins = set(oldstandins).symmetric_difference(set(newstandins)) |
|
448 | 448 | filelist = [] |
|
449 | 449 | for f in changedstandins: |
|
450 | 450 | if f[0] not in filelist: |
|
451 | 451 | filelist.append(f[0]) |
|
452 | 452 | return filelist |
|
453 | 453 | |
|
454 | 454 | def getlfilestoupload(repo, missing, addfunc): |
|
455 | 455 | for i, n in enumerate(missing): |
|
456 | 456 | repo.ui.progress(_('finding outgoing largefiles'), i, |
|
457 | 457 | unit=_('revision'), total=len(missing)) |
|
458 | 458 | parents = [p for p in repo.changelog.parents(n) if p != node.nullid] |
|
459 | 459 | |
|
460 | 460 | oldlfstatus = repo.lfstatus |
|
461 | 461 | repo.lfstatus = False |
|
462 | 462 | try: |
|
463 | 463 | ctx = repo[n] |
|
464 | 464 | finally: |
|
465 | 465 | repo.lfstatus = oldlfstatus |
|
466 | 466 | |
|
467 | 467 | files = set(ctx.files()) |
|
468 | 468 | if len(parents) == 2: |
|
469 | 469 | mc = ctx.manifest() |
|
470 | 470 | mp1 = ctx.parents()[0].manifest() |
|
471 | 471 | mp2 = ctx.parents()[1].manifest() |
|
472 | 472 | for f in mp1: |
|
473 | 473 | if f not in mc: |
|
474 | 474 | files.add(f) |
|
475 | 475 | for f in mp2: |
|
476 | 476 | if f not in mc: |
|
477 | 477 | files.add(f) |
|
478 | 478 | for f in mc: |
|
479 | 479 | if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None): |
|
480 | 480 | files.add(f) |
|
481 | 481 | for fn in files: |
|
482 | 482 | if isstandin(fn) and fn in ctx: |
|
483 | 483 | addfunc(fn, ctx[fn].data().strip()) |
|
484 | 484 | repo.ui.progress(_('finding outgoing largefiles'), None) |
|
485 | 485 | |
|
486 | 486 | def updatestandinsbymatch(repo, match): |
|
487 | 487 | '''Update standins in the working directory according to specified match |
|
488 | 488 | |
|
489 | 489 | This returns (possibly modified) ``match`` object to be used for |
|
490 | 490 | subsequent commit process. |
|
491 | 491 | ''' |
|
492 | 492 | |
|
493 | 493 | ui = repo.ui |
|
494 | 494 | |
|
495 | 495 | # Case 1: user calls commit with no specific files or |
|
496 | 496 | # include/exclude patterns: refresh and commit all files that |
|
497 | 497 | # are "dirty". |
|
498 | 498 | if match is None or match.always(): |
|
499 | 499 | # Spend a bit of time here to get a list of files we know |
|
500 | 500 | # are modified so we can compare only against those. |
|
501 | 501 | # It can cost a lot of time (several seconds) |
|
502 | 502 | # otherwise to update all standins if the largefiles are |
|
503 | 503 | # large. |
|
504 | 504 | lfdirstate = openlfdirstate(ui, repo) |
|
505 | 505 | dirtymatch = match_.always(repo.root, repo.getcwd()) |
|
506 | 506 | unsure, s = lfdirstate.status(dirtymatch, [], False, False, |
|
507 | 507 | False) |
|
508 | 508 | modifiedfiles = unsure + s.modified + s.added + s.removed |
|
509 | 509 | lfiles = listlfiles(repo) |
|
510 | 510 | # this only loops through largefiles that exist (not |
|
511 | 511 | # removed/renamed) |
|
512 | 512 | for lfile in lfiles: |
|
513 | 513 | if lfile in modifiedfiles: |
|
514 | 514 | if os.path.exists( |
|
515 | 515 | repo.wjoin(standin(lfile))): |
|
516 | 516 | # this handles the case where a rebase is being |
|
517 | 517 | # performed and the working copy is not updated |
|
518 | 518 | # yet. |
|
519 | 519 | if os.path.exists(repo.wjoin(lfile)): |
|
520 | 520 | updatestandin(repo, |
|
521 | 521 | standin(lfile)) |
|
522 | 522 | |
|
523 | 523 | return match |
|
524 | 524 | |
|
525 | 525 | lfiles = listlfiles(repo) |
|
526 | 526 | match._files = repo._subdirlfs(match.files(), lfiles) |
|
527 | 527 | |
|
528 | 528 | # Case 2: user calls commit with specified patterns: refresh |
|
529 | 529 | # any matching big files. |
|
530 | 530 | smatcher = composestandinmatcher(repo, match) |
|
531 | 531 | standins = repo.dirstate.walk(smatcher, [], False, False) |
|
532 | 532 | |
|
533 | 533 | # No matching big files: get out of the way and pass control to |
|
534 | 534 | # the usual commit() method. |
|
535 | 535 | if not standins: |
|
536 | 536 | return match |
|
537 | 537 | |
|
538 | 538 | # Refresh all matching big files. It's possible that the |
|
539 | 539 | # commit will end up failing, in which case the big files will |
|
540 | 540 | # stay refreshed. No harm done: the user modified them and |
|
541 | 541 | # asked to commit them, so sooner or later we're going to |
|
542 | 542 | # refresh the standins. Might as well leave them refreshed. |
|
543 | 543 | lfdirstate = openlfdirstate(ui, repo) |
|
544 | 544 | for fstandin in standins: |
|
545 | 545 | lfile = splitstandin(fstandin) |
|
546 | 546 | if lfdirstate[lfile] != 'r': |
|
547 | 547 | updatestandin(repo, fstandin) |
|
548 | 548 | |
|
549 | 549 | # Cook up a new matcher that only matches regular files or |
|
550 | 550 | # standins corresponding to the big files requested by the |
|
551 | 551 | # user. Have to modify _files to prevent commit() from |
|
552 | 552 | # complaining "not tracked" for big files. |
|
553 | 553 | match = copy.copy(match) |
|
554 | 554 | origmatchfn = match.matchfn |
|
555 | 555 | |
|
556 | 556 | # Check both the list of largefiles and the list of |
|
557 | 557 | # standins because if a largefile was removed, it |
|
558 | 558 | # won't be in the list of largefiles at this point |
|
559 | 559 | match._files += sorted(standins) |
|
560 | 560 | |
|
561 | 561 | actualfiles = [] |
|
562 | 562 | for f in match._files: |
|
563 | 563 | fstandin = standin(f) |
|
564 | 564 | |
|
565 |
# |
|
|
566 | if f in lfiles or fstandin in standins: | |
|
565 | # For largefiles, only one of the normal and standin should be | |
|
566 | # committed (except if one of them is a remove). | |
|
567 | # Thus, skip plain largefile names but keep the standin. | |
|
568 | if (f in lfiles or fstandin in standins) and \ | |
|
569 | repo.dirstate[f] != 'r' and repo.dirstate[fstandin] != 'r': | |
|
567 | 570 | continue |
|
568 | 571 | |
|
569 | 572 | actualfiles.append(f) |
|
570 | 573 | match._files = actualfiles |
|
571 | 574 | |
|
572 | 575 | def matchfn(f): |
|
573 | 576 | if origmatchfn(f): |
|
574 | 577 | return f not in lfiles |
|
575 | 578 | else: |
|
576 | 579 | return f in standins |
|
577 | 580 | |
|
578 | 581 | match.matchfn = matchfn |
|
579 | 582 | |
|
580 | 583 | return match |
|
581 | 584 | |
|
582 | 585 | class automatedcommithook(object): |
|
583 | 586 | '''Stateful hook to update standins at the 1st commit of resuming |
|
584 | 587 | |
|
585 | 588 | For efficiency, updating standins in the working directory should |
|
586 | 589 | be avoided while automated committing (like rebase, transplant and |
|
587 | 590 | so on), because they should be updated before committing. |
|
588 | 591 | |
|
589 | 592 | But the 1st commit of resuming automated committing (e.g. ``rebase |
|
590 | 593 | --continue``) should update them, because largefiles may be |
|
591 | 594 | modified manually. |
|
592 | 595 | ''' |
|
593 | 596 | def __init__(self, resuming): |
|
594 | 597 | self.resuming = resuming |
|
595 | 598 | |
|
596 | 599 | def __call__(self, repo, match): |
|
597 | 600 | if self.resuming: |
|
598 | 601 | self.resuming = False # avoids updating at subsequent commits |
|
599 | 602 | return updatestandinsbymatch(repo, match) |
|
600 | 603 | else: |
|
601 | 604 | return match |
|
602 | 605 | |
|
603 | 606 | def getstatuswriter(ui, repo, forcibly=None): |
|
604 | 607 | '''Return the function to write largefiles specific status out |
|
605 | 608 | |
|
606 | 609 | If ``forcibly`` is ``None``, this returns the last element of |
|
607 | 610 | ``repo._lfstatuswriters`` as "default" writer function. |
|
608 | 611 | |
|
609 | 612 | Otherwise, this returns the function to always write out (or |
|
610 | 613 | ignore if ``not forcibly``) status. |
|
611 | 614 | ''' |
|
612 | 615 | if forcibly is None and util.safehasattr(repo, '_largefilesenabled'): |
|
613 | 616 | return repo._lfstatuswriters[-1] |
|
614 | 617 | else: |
|
615 | 618 | if forcibly: |
|
616 | 619 | return ui.status # forcibly WRITE OUT |
|
617 | 620 | else: |
|
618 | 621 | return lambda *msg, **opts: None # forcibly IGNORE |
@@ -1,1859 +1,1859 b'' | |||
|
1 | 1 | This file used to contains all largefile tests. |
|
2 | 2 | Do not add any new tests in this file as it his already far too long to run. |
|
3 | 3 | |
|
4 | 4 | It contains all the testing of the basic concepts of large file in a single block. |
|
5 | 5 | |
|
6 | 6 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
7 | 7 | $ mkdir "${USERCACHE}" |
|
8 | 8 | $ cat >> $HGRCPATH <<EOF |
|
9 | 9 | > [extensions] |
|
10 | 10 | > largefiles= |
|
11 | 11 | > purge= |
|
12 | 12 | > rebase= |
|
13 | 13 | > transplant= |
|
14 | 14 | > [phases] |
|
15 | 15 | > publish=False |
|
16 | 16 | > [largefiles] |
|
17 | 17 | > minsize=2 |
|
18 | 18 | > patterns=glob:**.dat |
|
19 | 19 | > usercache=${USERCACHE} |
|
20 | 20 | > [hooks] |
|
21 | 21 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
22 | 22 | > [experimental] |
|
23 | 23 | > # drop me once bundle2 is the default, |
|
24 | 24 | > # added to get test change early. |
|
25 | 25 | > bundle2-exp = True |
|
26 | 26 | > EOF |
|
27 | 27 | |
|
28 | 28 | Create the repo with a couple of revisions of both large and normal |
|
29 | 29 | files. |
|
30 | 30 | Test status and dirstate of largefiles and that summary output is correct. |
|
31 | 31 | |
|
32 | 32 | $ hg init a |
|
33 | 33 | $ cd a |
|
34 | 34 | $ mkdir sub |
|
35 | 35 | $ echo normal1 > normal1 |
|
36 | 36 | $ echo normal2 > sub/normal2 |
|
37 | 37 | $ echo large1 > large1 |
|
38 | 38 | $ echo large2 > sub/large2 |
|
39 | 39 | $ hg add normal1 sub/normal2 |
|
40 | 40 | $ hg add --large large1 sub/large2 |
|
41 | 41 | $ hg commit -m "add files" |
|
42 | 42 | Invoking status precommit hook |
|
43 | 43 | A large1 |
|
44 | 44 | A normal1 |
|
45 | 45 | A sub/large2 |
|
46 | 46 | A sub/normal2 |
|
47 | 47 | $ touch large1 sub/large2 |
|
48 | 48 | $ sleep 1 |
|
49 | 49 | $ hg st |
|
50 | 50 | $ hg debugstate --nodates |
|
51 | 51 | n 644 41 set .hglf/large1 |
|
52 | 52 | n 644 41 set .hglf/sub/large2 |
|
53 | 53 | n 644 8 set normal1 |
|
54 | 54 | n 644 8 set sub/normal2 |
|
55 | 55 | $ hg debugstate --large --nodates |
|
56 | 56 | n 644 7 set large1 |
|
57 | 57 | n 644 7 set sub/large2 |
|
58 | 58 | $ echo normal11 > normal1 |
|
59 | 59 | $ echo normal22 > sub/normal2 |
|
60 | 60 | $ echo large11 > large1 |
|
61 | 61 | $ echo large22 > sub/large2 |
|
62 | 62 | $ hg commit -m "edit files" |
|
63 | 63 | Invoking status precommit hook |
|
64 | 64 | M large1 |
|
65 | 65 | M normal1 |
|
66 | 66 | M sub/large2 |
|
67 | 67 | M sub/normal2 |
|
68 | 68 | $ hg sum --large |
|
69 | 69 | parent: 1:ce8896473775 tip |
|
70 | 70 | edit files |
|
71 | 71 | branch: default |
|
72 | 72 | commit: (clean) |
|
73 | 73 | update: (current) |
|
74 | 74 | phases: 2 draft |
|
75 | 75 | largefiles: (no remote repo) |
|
76 | 76 | |
|
77 | 77 | Commit preserved largefile contents. |
|
78 | 78 | |
|
79 | 79 | $ cat normal1 |
|
80 | 80 | normal11 |
|
81 | 81 | $ cat large1 |
|
82 | 82 | large11 |
|
83 | 83 | $ cat sub/normal2 |
|
84 | 84 | normal22 |
|
85 | 85 | $ cat sub/large2 |
|
86 | 86 | large22 |
|
87 | 87 | |
|
88 | 88 | Test status, subdir and unknown files |
|
89 | 89 | |
|
90 | 90 | $ echo unknown > sub/unknown |
|
91 | 91 | $ hg st --all |
|
92 | 92 | ? sub/unknown |
|
93 | 93 | C large1 |
|
94 | 94 | C normal1 |
|
95 | 95 | C sub/large2 |
|
96 | 96 | C sub/normal2 |
|
97 | 97 | $ hg st --all sub |
|
98 | 98 | ? sub/unknown |
|
99 | 99 | C sub/large2 |
|
100 | 100 | C sub/normal2 |
|
101 | 101 | $ rm sub/unknown |
|
102 | 102 | |
|
103 | 103 | Test messages and exit codes for remove warning cases |
|
104 | 104 | |
|
105 | 105 | $ hg remove -A large1 |
|
106 | 106 | not removing large1: file still exists |
|
107 | 107 | [1] |
|
108 | 108 | $ echo 'modified' > large1 |
|
109 | 109 | $ hg remove large1 |
|
110 | 110 | not removing large1: file is modified (use -f to force removal) |
|
111 | 111 | [1] |
|
112 | 112 | $ echo 'new' > normalnew |
|
113 | 113 | $ hg add normalnew |
|
114 | 114 | $ echo 'new' > largenew |
|
115 | 115 | $ hg add --large normalnew |
|
116 | 116 | normalnew already tracked! |
|
117 | 117 | $ hg remove normalnew largenew |
|
118 | 118 | not removing largenew: file is untracked |
|
119 | 119 | not removing normalnew: file has been marked for add (use forget to undo) |
|
120 | 120 | [1] |
|
121 | 121 | $ rm normalnew largenew |
|
122 | 122 | $ hg up -Cq |
|
123 | 123 | |
|
124 | 124 | Remove both largefiles and normal files. |
|
125 | 125 | |
|
126 | 126 | $ hg remove normal1 large1 |
|
127 | 127 | $ hg status large1 |
|
128 | 128 | R large1 |
|
129 | 129 | $ hg commit -m "remove files" |
|
130 | 130 | Invoking status precommit hook |
|
131 | 131 | R large1 |
|
132 | 132 | R normal1 |
|
133 | 133 | $ ls |
|
134 | 134 | sub |
|
135 | 135 | $ echo "testlargefile" > large1-test |
|
136 | 136 | $ hg add --large large1-test |
|
137 | 137 | $ hg st |
|
138 | 138 | A large1-test |
|
139 | 139 | $ hg rm large1-test |
|
140 | 140 | not removing large1-test: file has been marked for add (use forget to undo) |
|
141 | 141 | [1] |
|
142 | 142 | $ hg st |
|
143 | 143 | A large1-test |
|
144 | 144 | $ hg forget large1-test |
|
145 | 145 | $ hg st |
|
146 | 146 | ? large1-test |
|
147 | 147 | $ hg remove large1-test |
|
148 | 148 | not removing large1-test: file is untracked |
|
149 | 149 | [1] |
|
150 | 150 | $ hg forget large1-test |
|
151 | 151 | not removing large1-test: file is already untracked |
|
152 | 152 | [1] |
|
153 | 153 | $ rm large1-test |
|
154 | 154 | |
|
155 | 155 | Copy both largefiles and normal files (testing that status output is correct). |
|
156 | 156 | |
|
157 | 157 | $ hg cp sub/normal2 normal1 |
|
158 | 158 | $ hg cp sub/large2 large1 |
|
159 | 159 | $ hg commit -m "copy files" |
|
160 | 160 | Invoking status precommit hook |
|
161 | 161 | A large1 |
|
162 | 162 | A normal1 |
|
163 | 163 | $ cat normal1 |
|
164 | 164 | normal22 |
|
165 | 165 | $ cat large1 |
|
166 | 166 | large22 |
|
167 | 167 | |
|
168 | 168 | Test moving largefiles and verify that normal files are also unaffected. |
|
169 | 169 | |
|
170 | 170 | $ hg mv normal1 normal3 |
|
171 | 171 | $ hg mv large1 large3 |
|
172 | 172 | $ hg mv sub/normal2 sub/normal4 |
|
173 | 173 | $ hg mv sub/large2 sub/large4 |
|
174 | 174 | $ hg commit -m "move files" |
|
175 | 175 | Invoking status precommit hook |
|
176 | 176 | A large3 |
|
177 | 177 | A normal3 |
|
178 | 178 | A sub/large4 |
|
179 | 179 | A sub/normal4 |
|
180 | 180 | R large1 |
|
181 | 181 | R normal1 |
|
182 | 182 | R sub/large2 |
|
183 | 183 | R sub/normal2 |
|
184 | 184 | $ cat normal3 |
|
185 | 185 | normal22 |
|
186 | 186 | $ cat large3 |
|
187 | 187 | large22 |
|
188 | 188 | $ cat sub/normal4 |
|
189 | 189 | normal22 |
|
190 | 190 | $ cat sub/large4 |
|
191 | 191 | large22 |
|
192 | 192 | |
|
193 | 193 | |
|
194 | 194 | #if serve |
|
195 | 195 | Test display of largefiles in hgweb |
|
196 | 196 | |
|
197 | 197 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid |
|
198 | 198 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
199 | 199 | $ get-with-headers.py 127.0.0.1:$HGPORT 'file/tip/?style=raw' |
|
200 | 200 | 200 Script output follows |
|
201 | 201 | |
|
202 | 202 | |
|
203 | 203 | drwxr-xr-x sub |
|
204 | 204 | -rw-r--r-- 41 large3 |
|
205 | 205 | -rw-r--r-- 9 normal3 |
|
206 | 206 | |
|
207 | 207 | |
|
208 | 208 | $ get-with-headers.py 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw' |
|
209 | 209 | 200 Script output follows |
|
210 | 210 | |
|
211 | 211 | |
|
212 | 212 | -rw-r--r-- 41 large4 |
|
213 | 213 | -rw-r--r-- 9 normal4 |
|
214 | 214 | |
|
215 | 215 | |
|
216 | 216 | $ killdaemons.py |
|
217 | 217 | #endif |
|
218 | 218 | |
|
219 | 219 | Test archiving the various revisions. These hit corner cases known with |
|
220 | 220 | archiving. |
|
221 | 221 | |
|
222 | 222 | $ hg archive -r 0 ../archive0 |
|
223 | 223 | $ hg archive -r 1 ../archive1 |
|
224 | 224 | $ hg archive -r 2 ../archive2 |
|
225 | 225 | $ hg archive -r 3 ../archive3 |
|
226 | 226 | $ hg archive -r 4 ../archive4 |
|
227 | 227 | $ cd ../archive0 |
|
228 | 228 | $ cat normal1 |
|
229 | 229 | normal1 |
|
230 | 230 | $ cat large1 |
|
231 | 231 | large1 |
|
232 | 232 | $ cat sub/normal2 |
|
233 | 233 | normal2 |
|
234 | 234 | $ cat sub/large2 |
|
235 | 235 | large2 |
|
236 | 236 | $ cd ../archive1 |
|
237 | 237 | $ cat normal1 |
|
238 | 238 | normal11 |
|
239 | 239 | $ cat large1 |
|
240 | 240 | large11 |
|
241 | 241 | $ cat sub/normal2 |
|
242 | 242 | normal22 |
|
243 | 243 | $ cat sub/large2 |
|
244 | 244 | large22 |
|
245 | 245 | $ cd ../archive2 |
|
246 | 246 | $ ls |
|
247 | 247 | sub |
|
248 | 248 | $ cat sub/normal2 |
|
249 | 249 | normal22 |
|
250 | 250 | $ cat sub/large2 |
|
251 | 251 | large22 |
|
252 | 252 | $ cd ../archive3 |
|
253 | 253 | $ cat normal1 |
|
254 | 254 | normal22 |
|
255 | 255 | $ cat large1 |
|
256 | 256 | large22 |
|
257 | 257 | $ cat sub/normal2 |
|
258 | 258 | normal22 |
|
259 | 259 | $ cat sub/large2 |
|
260 | 260 | large22 |
|
261 | 261 | $ cd ../archive4 |
|
262 | 262 | $ cat normal3 |
|
263 | 263 | normal22 |
|
264 | 264 | $ cat large3 |
|
265 | 265 | large22 |
|
266 | 266 | $ cat sub/normal4 |
|
267 | 267 | normal22 |
|
268 | 268 | $ cat sub/large4 |
|
269 | 269 | large22 |
|
270 | 270 | |
|
271 | 271 | Commit corner case: specify files to commit. |
|
272 | 272 | |
|
273 | 273 | $ cd ../a |
|
274 | 274 | $ echo normal3 > normal3 |
|
275 | 275 | $ echo large3 > large3 |
|
276 | 276 | $ echo normal4 > sub/normal4 |
|
277 | 277 | $ echo large4 > sub/large4 |
|
278 | 278 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" |
|
279 | 279 | Invoking status precommit hook |
|
280 | 280 | M large3 |
|
281 | 281 | M normal3 |
|
282 | 282 | M sub/large4 |
|
283 | 283 | M sub/normal4 |
|
284 | 284 | $ cat normal3 |
|
285 | 285 | normal3 |
|
286 | 286 | $ cat large3 |
|
287 | 287 | large3 |
|
288 | 288 | $ cat sub/normal4 |
|
289 | 289 | normal4 |
|
290 | 290 | $ cat sub/large4 |
|
291 | 291 | large4 |
|
292 | 292 | |
|
293 | 293 | One more commit corner case: commit from a subdirectory. |
|
294 | 294 | |
|
295 | 295 | $ cd ../a |
|
296 | 296 | $ echo normal33 > normal3 |
|
297 | 297 | $ echo large33 > large3 |
|
298 | 298 | $ echo normal44 > sub/normal4 |
|
299 | 299 | $ echo large44 > sub/large4 |
|
300 | 300 | $ cd sub |
|
301 | 301 | $ hg commit -m "edit files yet again" |
|
302 | 302 | Invoking status precommit hook |
|
303 | 303 | M large3 |
|
304 | 304 | M normal3 |
|
305 | 305 | M sub/large4 |
|
306 | 306 | M sub/normal4 |
|
307 | 307 | $ cat ../normal3 |
|
308 | 308 | normal33 |
|
309 | 309 | $ cat ../large3 |
|
310 | 310 | large33 |
|
311 | 311 | $ cat normal4 |
|
312 | 312 | normal44 |
|
313 | 313 | $ cat large4 |
|
314 | 314 | large44 |
|
315 | 315 | |
|
316 | 316 | Committing standins is not allowed. |
|
317 | 317 | |
|
318 | 318 | $ cd .. |
|
319 | 319 | $ echo large3 > large3 |
|
320 | 320 | $ hg commit .hglf/large3 -m "try to commit standin" |
|
321 | 321 | abort: file ".hglf/large3" is a largefile standin |
|
322 | 322 | (commit the largefile itself instead) |
|
323 | 323 | [255] |
|
324 | 324 | |
|
325 | 325 | Corner cases for adding largefiles. |
|
326 | 326 | |
|
327 | 327 | $ echo large5 > large5 |
|
328 | 328 | $ hg add --large large5 |
|
329 | 329 | $ hg add --large large5 |
|
330 | 330 | large5 already a largefile |
|
331 | 331 | $ mkdir sub2 |
|
332 | 332 | $ echo large6 > sub2/large6 |
|
333 | 333 | $ echo large7 > sub2/large7 |
|
334 | 334 | $ hg add --large sub2 |
|
335 | 335 | adding sub2/large6 as a largefile (glob) |
|
336 | 336 | adding sub2/large7 as a largefile (glob) |
|
337 | 337 | $ hg st |
|
338 | 338 | M large3 |
|
339 | 339 | A large5 |
|
340 | 340 | A sub2/large6 |
|
341 | 341 | A sub2/large7 |
|
342 | 342 | |
|
343 | 343 | Committing directories containing only largefiles. |
|
344 | 344 | |
|
345 | 345 | $ mkdir -p z/y/x/m |
|
346 | 346 | $ touch z/y/x/m/large1 |
|
347 | 347 | $ touch z/y/x/large2 |
|
348 | 348 | $ hg add --large z/y/x/m/large1 z/y/x/large2 |
|
349 | 349 | $ hg commit -m "Subdir with directory only containing largefiles" z |
|
350 | 350 | Invoking status precommit hook |
|
351 | 351 | M large3 |
|
352 | 352 | A large5 |
|
353 | 353 | A sub2/large6 |
|
354 | 354 | A sub2/large7 |
|
355 | 355 | A z/y/x/large2 |
|
356 | 356 | A z/y/x/m/large1 |
|
357 | 357 | |
|
358 | 358 | (and a bit of log testing) |
|
359 | 359 | |
|
360 | 360 | $ hg log -T '{rev}\n' z/y/x/m/large1 |
|
361 | 361 | 7 |
|
362 | 362 | $ hg log -T '{rev}\n' z/y/x/m # with only a largefile |
|
363 | 363 | 7 |
|
364 | 364 | |
|
365 | 365 | $ hg rollback --quiet |
|
366 | 366 | $ touch z/y/x/m/normal |
|
367 | 367 | $ hg add z/y/x/m/normal |
|
368 | 368 | $ hg commit -m "Subdir with mixed contents" z |
|
369 | 369 | Invoking status precommit hook |
|
370 | 370 | M large3 |
|
371 | 371 | A large5 |
|
372 | 372 | A sub2/large6 |
|
373 | 373 | A sub2/large7 |
|
374 | 374 | A z/y/x/large2 |
|
375 | 375 | A z/y/x/m/large1 |
|
376 | 376 | A z/y/x/m/normal |
|
377 | 377 | $ hg st |
|
378 | 378 | M large3 |
|
379 | 379 | A large5 |
|
380 | 380 | A sub2/large6 |
|
381 | 381 | A sub2/large7 |
|
382 | 382 | $ hg rollback --quiet |
|
383 | 383 | $ hg revert z/y/x/large2 z/y/x/m/large1 |
|
384 | 384 | $ rm z/y/x/large2 z/y/x/m/large1 |
|
385 | 385 | $ hg commit -m "Subdir with normal contents" z |
|
386 | 386 | Invoking status precommit hook |
|
387 | 387 | M large3 |
|
388 | 388 | A large5 |
|
389 | 389 | A sub2/large6 |
|
390 | 390 | A sub2/large7 |
|
391 | 391 | A z/y/x/m/normal |
|
392 | 392 | $ hg st |
|
393 | 393 | M large3 |
|
394 | 394 | A large5 |
|
395 | 395 | A sub2/large6 |
|
396 | 396 | A sub2/large7 |
|
397 | 397 | $ hg rollback --quiet |
|
398 | 398 | $ hg revert --quiet z |
|
399 | 399 | $ hg commit -m "Empty subdir" z |
|
400 | 400 | abort: z: no match under directory! |
|
401 | 401 | [255] |
|
402 | 402 | $ rm -rf z |
|
403 | 403 | $ hg ci -m "standin" .hglf |
|
404 | 404 | abort: file ".hglf" is a largefile standin |
|
405 | 405 | (commit the largefile itself instead) |
|
406 | 406 | [255] |
|
407 | 407 | |
|
408 | 408 | Test "hg status" with combination of 'file pattern' and 'directory |
|
409 | 409 | pattern' for largefiles: |
|
410 | 410 | |
|
411 | 411 | $ hg status sub2/large6 sub2 |
|
412 | 412 | A sub2/large6 |
|
413 | 413 | A sub2/large7 |
|
414 | 414 | |
|
415 | 415 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
416 | 416 | |
|
417 | 417 | $ echo testdata > test.dat |
|
418 | 418 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null |
|
419 | 419 | $ hg add |
|
420 | 420 | adding reallylarge as a largefile |
|
421 | 421 | adding test.dat as a largefile |
|
422 | 422 | |
|
423 | 423 | Test that minsize and --lfsize handle float values; |
|
424 | 424 | also tests that --lfsize overrides largefiles.minsize. |
|
425 | 425 | (0.250 MB = 256 kB = 262144 B) |
|
426 | 426 | |
|
427 | 427 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null |
|
428 | 428 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null |
|
429 | 429 | $ hg --config largefiles.minsize=.25 add |
|
430 | 430 | adding ratherlarge as a largefile |
|
431 | 431 | adding medium |
|
432 | 432 | $ hg forget medium |
|
433 | 433 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
434 | 434 | adding medium as a largefile |
|
435 | 435 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null |
|
436 | 436 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
437 | 437 | adding notlarge |
|
438 | 438 | $ hg forget notlarge |
|
439 | 439 | |
|
440 | 440 | Test forget on largefiles. |
|
441 | 441 | |
|
442 | 442 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium |
|
443 | 443 | $ hg commit -m "add/edit more largefiles" |
|
444 | 444 | Invoking status precommit hook |
|
445 | 445 | A sub2/large6 |
|
446 | 446 | A sub2/large7 |
|
447 | 447 | R large3 |
|
448 | 448 | ? large5 |
|
449 | 449 | ? medium |
|
450 | 450 | ? notlarge |
|
451 | 451 | ? ratherlarge |
|
452 | 452 | ? reallylarge |
|
453 | 453 | ? test.dat |
|
454 | 454 | $ hg st |
|
455 | 455 | ? large3 |
|
456 | 456 | ? large5 |
|
457 | 457 | ? medium |
|
458 | 458 | ? notlarge |
|
459 | 459 | ? ratherlarge |
|
460 | 460 | ? reallylarge |
|
461 | 461 | ? test.dat |
|
462 | 462 | |
|
463 | 463 | Purge with largefiles: verify that largefiles are still in the working |
|
464 | 464 | dir after a purge. |
|
465 | 465 | |
|
466 | 466 | $ hg purge --all |
|
467 | 467 | $ cat sub/large4 |
|
468 | 468 | large44 |
|
469 | 469 | $ cat sub2/large6 |
|
470 | 470 | large6 |
|
471 | 471 | $ cat sub2/large7 |
|
472 | 472 | large7 |
|
473 | 473 | |
|
474 | 474 | Test addremove: verify that files that should be added as largefiles are added as |
|
475 | 475 | such and that already-existing largefiles are not added as normal files by |
|
476 | 476 | accident. |
|
477 | 477 | |
|
478 | 478 | $ rm normal3 |
|
479 | 479 | $ rm sub/large4 |
|
480 | 480 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
481 | 481 | $ echo "normaladdremove" > normaladdremove |
|
482 | 482 | $ hg addremove |
|
483 | 483 | removing sub/large4 |
|
484 | 484 | adding testaddremove.dat as a largefile |
|
485 | 485 | removing normal3 |
|
486 | 486 | adding normaladdremove |
|
487 | 487 | |
|
488 | 488 | Test addremove with -R |
|
489 | 489 | |
|
490 | 490 | $ hg up -C |
|
491 | 491 | getting changed largefiles |
|
492 | 492 | 1 largefiles updated, 0 removed |
|
493 | 493 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
494 | 494 | $ rm normal3 |
|
495 | 495 | $ rm sub/large4 |
|
496 | 496 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
497 | 497 | $ echo "normaladdremove" > normaladdremove |
|
498 | 498 | $ cd .. |
|
499 | 499 | $ hg -R a -v addremove |
|
500 | 500 | removing sub/large4 |
|
501 | 501 | adding testaddremove.dat as a largefile |
|
502 | 502 | removing normal3 |
|
503 | 503 | adding normaladdremove |
|
504 | 504 | $ cd a |
|
505 | 505 | |
|
506 | 506 | Test 3364 |
|
507 | 507 | $ hg clone . ../addrm |
|
508 | 508 | updating to branch default |
|
509 | 509 | getting changed largefiles |
|
510 | 510 | 3 largefiles updated, 0 removed |
|
511 | 511 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
512 | 512 | $ cd ../addrm |
|
513 | 513 | $ cat >> .hg/hgrc <<EOF |
|
514 | 514 | > [hooks] |
|
515 | 515 | > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" |
|
516 | 516 | > EOF |
|
517 | 517 | $ touch foo |
|
518 | 518 | $ hg add --large foo |
|
519 | 519 | $ hg ci -m "add foo" |
|
520 | 520 | Invoking status precommit hook |
|
521 | 521 | A foo |
|
522 | 522 | Invoking status postcommit hook |
|
523 | 523 | C foo |
|
524 | 524 | C normal3 |
|
525 | 525 | C sub/large4 |
|
526 | 526 | C sub/normal4 |
|
527 | 527 | C sub2/large6 |
|
528 | 528 | C sub2/large7 |
|
529 | 529 | $ rm foo |
|
530 | 530 | $ hg st |
|
531 | 531 | ! foo |
|
532 | 532 | hmm.. no precommit invoked, but there is a postcommit?? |
|
533 | 533 | $ hg ci -m "will not checkin" |
|
534 | 534 | nothing changed |
|
535 | 535 | Invoking status postcommit hook |
|
536 | 536 | ! foo |
|
537 | 537 | C normal3 |
|
538 | 538 | C sub/large4 |
|
539 | 539 | C sub/normal4 |
|
540 | 540 | C sub2/large6 |
|
541 | 541 | C sub2/large7 |
|
542 | 542 | [1] |
|
543 | 543 | $ hg addremove |
|
544 | 544 | removing foo |
|
545 | 545 | $ hg st |
|
546 | 546 | R foo |
|
547 | 547 | $ hg ci -m "used to say nothing changed" |
|
548 | 548 | Invoking status precommit hook |
|
549 | 549 | R foo |
|
550 | 550 | Invoking status postcommit hook |
|
551 | 551 | C normal3 |
|
552 | 552 | C sub/large4 |
|
553 | 553 | C sub/normal4 |
|
554 | 554 | C sub2/large6 |
|
555 | 555 | C sub2/large7 |
|
556 | 556 | $ hg st |
|
557 | 557 | |
|
558 | 558 | Test 3507 (both normal files and largefiles were a problem) |
|
559 | 559 | |
|
560 | 560 | $ touch normal |
|
561 | 561 | $ touch large |
|
562 | 562 | $ hg add normal |
|
563 | 563 | $ hg add --large large |
|
564 | 564 | $ hg ci -m "added" |
|
565 | 565 | Invoking status precommit hook |
|
566 | 566 | A large |
|
567 | 567 | A normal |
|
568 | 568 | Invoking status postcommit hook |
|
569 | 569 | C large |
|
570 | 570 | C normal |
|
571 | 571 | C normal3 |
|
572 | 572 | C sub/large4 |
|
573 | 573 | C sub/normal4 |
|
574 | 574 | C sub2/large6 |
|
575 | 575 | C sub2/large7 |
|
576 | 576 | $ hg remove normal |
|
577 | 577 | $ hg addremove --traceback |
|
578 | 578 | $ hg ci -m "addremoved normal" |
|
579 | 579 | Invoking status precommit hook |
|
580 | 580 | R normal |
|
581 | 581 | Invoking status postcommit hook |
|
582 | 582 | C large |
|
583 | 583 | C normal3 |
|
584 | 584 | C sub/large4 |
|
585 | 585 | C sub/normal4 |
|
586 | 586 | C sub2/large6 |
|
587 | 587 | C sub2/large7 |
|
588 | 588 | $ hg up -C '.^' |
|
589 | 589 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
590 | 590 | $ hg remove large |
|
591 | 591 | $ hg addremove --traceback |
|
592 | 592 | $ hg ci -m "removed large" |
|
593 | 593 | Invoking status precommit hook |
|
594 | 594 | R large |
|
595 | 595 | created new head |
|
596 | 596 | Invoking status postcommit hook |
|
597 | 597 | C normal |
|
598 | 598 | C normal3 |
|
599 | 599 | C sub/large4 |
|
600 | 600 | C sub/normal4 |
|
601 | 601 | C sub2/large6 |
|
602 | 602 | C sub2/large7 |
|
603 | 603 | |
|
604 | 604 | Test commit -A (issue3542) |
|
605 | 605 | $ echo large8 > large8 |
|
606 | 606 | $ hg add --large large8 |
|
607 | 607 | $ hg ci -Am 'this used to add large8 as normal and commit both' |
|
608 | 608 | Invoking status precommit hook |
|
609 | 609 | A large8 |
|
610 | 610 | Invoking status postcommit hook |
|
611 | 611 | C large8 |
|
612 | 612 | C normal |
|
613 | 613 | C normal3 |
|
614 | 614 | C sub/large4 |
|
615 | 615 | C sub/normal4 |
|
616 | 616 | C sub2/large6 |
|
617 | 617 | C sub2/large7 |
|
618 | 618 | $ rm large8 |
|
619 | 619 | $ hg ci -Am 'this used to not notice the rm' |
|
620 | 620 | removing large8 |
|
621 | 621 | Invoking status precommit hook |
|
622 | 622 | R large8 |
|
623 | 623 | Invoking status postcommit hook |
|
624 | 624 | C normal |
|
625 | 625 | C normal3 |
|
626 | 626 | C sub/large4 |
|
627 | 627 | C sub/normal4 |
|
628 | 628 | C sub2/large6 |
|
629 | 629 | C sub2/large7 |
|
630 | 630 | |
|
631 | 631 | Test that a standin can't be added as a large file |
|
632 | 632 | |
|
633 | 633 | $ touch large |
|
634 | 634 | $ hg add --large large |
|
635 | 635 | $ hg ci -m "add" |
|
636 | 636 | Invoking status precommit hook |
|
637 | 637 | A large |
|
638 | 638 | Invoking status postcommit hook |
|
639 | 639 | C large |
|
640 | 640 | C normal |
|
641 | 641 | C normal3 |
|
642 | 642 | C sub/large4 |
|
643 | 643 | C sub/normal4 |
|
644 | 644 | C sub2/large6 |
|
645 | 645 | C sub2/large7 |
|
646 | 646 | $ hg remove large |
|
647 | 647 | $ touch large |
|
648 | 648 | $ hg addremove --config largefiles.patterns=**large --traceback |
|
649 | 649 | adding large as a largefile |
|
650 | 650 | |
|
651 | 651 | Test that outgoing --large works (with revsets too) |
|
652 | 652 | $ hg outgoing --rev '.^' --large |
|
653 | 653 | comparing with $TESTTMP/a (glob) |
|
654 | 654 | searching for changes |
|
655 | 655 | changeset: 8:c02fd3b77ec4 |
|
656 | 656 | user: test |
|
657 | 657 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
658 | 658 | summary: add foo |
|
659 | 659 | |
|
660 | 660 | changeset: 9:289dd08c9bbb |
|
661 | 661 | user: test |
|
662 | 662 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
663 | 663 | summary: used to say nothing changed |
|
664 | 664 | |
|
665 | 665 | changeset: 10:34f23ac6ac12 |
|
666 | 666 | user: test |
|
667 | 667 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
668 | 668 | summary: added |
|
669 | 669 | |
|
670 | 670 | changeset: 12:710c1b2f523c |
|
671 | 671 | parent: 10:34f23ac6ac12 |
|
672 | 672 | user: test |
|
673 | 673 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
674 | 674 | summary: removed large |
|
675 | 675 | |
|
676 | 676 | changeset: 13:0a3e75774479 |
|
677 | 677 | user: test |
|
678 | 678 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
679 | 679 | summary: this used to add large8 as normal and commit both |
|
680 | 680 | |
|
681 | 681 | changeset: 14:84f3d378175c |
|
682 | 682 | user: test |
|
683 | 683 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
684 | 684 | summary: this used to not notice the rm |
|
685 | 685 | |
|
686 | 686 | largefiles to upload (1 entities): |
|
687 | 687 | large8 |
|
688 | 688 | |
|
689 | 689 | $ cd ../a |
|
690 | 690 | |
|
691 | 691 | Clone a largefiles repo. |
|
692 | 692 | |
|
693 | 693 | $ hg clone . ../b |
|
694 | 694 | updating to branch default |
|
695 | 695 | getting changed largefiles |
|
696 | 696 | 3 largefiles updated, 0 removed |
|
697 | 697 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
698 | 698 | $ cd ../b |
|
699 | 699 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
700 | 700 | 7:daea875e9014 add/edit more largefiles |
|
701 | 701 | 6:4355d653f84f edit files yet again |
|
702 | 702 | 5:9d5af5072dbd edit files again |
|
703 | 703 | 4:74c02385b94c move files |
|
704 | 704 | 3:9e8fbc4bce62 copy files |
|
705 | 705 | 2:51a0ae4d5864 remove files |
|
706 | 706 | 1:ce8896473775 edit files |
|
707 | 707 | 0:30d30fe6a5be add files |
|
708 | 708 | $ cat normal3 |
|
709 | 709 | normal33 |
|
710 | 710 | |
|
711 | 711 | Test graph log |
|
712 | 712 | |
|
713 | 713 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
714 | 714 | @ 7:daea875e9014 add/edit more largefiles |
|
715 | 715 | | |
|
716 | 716 | o 6:4355d653f84f edit files yet again |
|
717 | 717 | | |
|
718 | 718 | o 5:9d5af5072dbd edit files again |
|
719 | 719 | | |
|
720 | 720 | o 4:74c02385b94c move files |
|
721 | 721 | | |
|
722 | 722 | o 3:9e8fbc4bce62 copy files |
|
723 | 723 | | |
|
724 | 724 | o 2:51a0ae4d5864 remove files |
|
725 | 725 | | |
|
726 | 726 | o 1:ce8896473775 edit files |
|
727 | 727 | | |
|
728 | 728 | o 0:30d30fe6a5be add files |
|
729 | 729 | |
|
730 | 730 | |
|
731 | 731 | Test log with --patch |
|
732 | 732 | |
|
733 | 733 | $ hg log --patch -r 6::7 |
|
734 | 734 | changeset: 6:4355d653f84f |
|
735 | 735 | user: test |
|
736 | 736 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
737 | 737 | summary: edit files yet again |
|
738 | 738 | |
|
739 | 739 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 |
|
740 | 740 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
741 | 741 | +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
742 | 742 | @@ -1,1 +1,1 @@ |
|
743 | 743 | -baaf12afde9d8d67f25dab6dced0d2bf77dba47c |
|
744 | 744 | +7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
745 | 745 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
746 | 746 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
747 | 747 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
748 | 748 | @@ -1,1 +1,1 @@ |
|
749 | 749 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
750 | 750 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
751 | 751 | diff -r 9d5af5072dbd -r 4355d653f84f normal3 |
|
752 | 752 | --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
753 | 753 | +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
754 | 754 | @@ -1,1 +1,1 @@ |
|
755 | 755 | -normal3 |
|
756 | 756 | +normal33 |
|
757 | 757 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
758 | 758 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
759 | 759 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
760 | 760 | @@ -1,1 +1,1 @@ |
|
761 | 761 | -normal4 |
|
762 | 762 | +normal44 |
|
763 | 763 | |
|
764 | 764 | changeset: 7:daea875e9014 |
|
765 | 765 | tag: tip |
|
766 | 766 | user: test |
|
767 | 767 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
768 | 768 | summary: add/edit more largefiles |
|
769 | 769 | |
|
770 | 770 | diff -r 4355d653f84f -r daea875e9014 .hglf/large3 |
|
771 | 771 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
772 | 772 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
773 | 773 | @@ -1,1 +0,0 @@ |
|
774 | 774 | -7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
775 | 775 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 |
|
776 | 776 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
777 | 777 | +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 |
|
778 | 778 | @@ -0,0 +1,1 @@ |
|
779 | 779 | +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 |
|
780 | 780 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 |
|
781 | 781 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
782 | 782 | +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 |
|
783 | 783 | @@ -0,0 +1,1 @@ |
|
784 | 784 | +bb3151689acb10f0c3125c560d5e63df914bc1af |
|
785 | 785 | |
|
786 | 786 | |
|
787 | 787 | $ hg log --patch -r 6::7 sub/ |
|
788 | 788 | changeset: 6:4355d653f84f |
|
789 | 789 | user: test |
|
790 | 790 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
791 | 791 | summary: edit files yet again |
|
792 | 792 | |
|
793 | 793 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
794 | 794 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
795 | 795 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
796 | 796 | @@ -1,1 +1,1 @@ |
|
797 | 797 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
798 | 798 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
799 | 799 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
800 | 800 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
801 | 801 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
802 | 802 | @@ -1,1 +1,1 @@ |
|
803 | 803 | -normal4 |
|
804 | 804 | +normal44 |
|
805 | 805 | |
|
806 | 806 | |
|
807 | 807 | log with both --follow and --patch |
|
808 | 808 | |
|
809 | 809 | $ hg log --follow --patch --limit 2 |
|
810 | 810 | changeset: 7:daea875e9014 |
|
811 | 811 | tag: tip |
|
812 | 812 | user: test |
|
813 | 813 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
814 | 814 | summary: add/edit more largefiles |
|
815 | 815 | |
|
816 | 816 | diff -r 4355d653f84f -r daea875e9014 .hglf/large3 |
|
817 | 817 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
818 | 818 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
819 | 819 | @@ -1,1 +0,0 @@ |
|
820 | 820 | -7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
821 | 821 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 |
|
822 | 822 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
823 | 823 | +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 |
|
824 | 824 | @@ -0,0 +1,1 @@ |
|
825 | 825 | +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 |
|
826 | 826 | diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 |
|
827 | 827 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
828 | 828 | +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 |
|
829 | 829 | @@ -0,0 +1,1 @@ |
|
830 | 830 | +bb3151689acb10f0c3125c560d5e63df914bc1af |
|
831 | 831 | |
|
832 | 832 | changeset: 6:4355d653f84f |
|
833 | 833 | user: test |
|
834 | 834 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
835 | 835 | summary: edit files yet again |
|
836 | 836 | |
|
837 | 837 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 |
|
838 | 838 | --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
839 | 839 | +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 |
|
840 | 840 | @@ -1,1 +1,1 @@ |
|
841 | 841 | -baaf12afde9d8d67f25dab6dced0d2bf77dba47c |
|
842 | 842 | +7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
843 | 843 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
844 | 844 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
845 | 845 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
846 | 846 | @@ -1,1 +1,1 @@ |
|
847 | 847 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
848 | 848 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
849 | 849 | diff -r 9d5af5072dbd -r 4355d653f84f normal3 |
|
850 | 850 | --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
851 | 851 | +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 |
|
852 | 852 | @@ -1,1 +1,1 @@ |
|
853 | 853 | -normal3 |
|
854 | 854 | +normal33 |
|
855 | 855 | diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 |
|
856 | 856 | --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
857 | 857 | +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 |
|
858 | 858 | @@ -1,1 +1,1 @@ |
|
859 | 859 | -normal4 |
|
860 | 860 | +normal44 |
|
861 | 861 | |
|
862 | 862 | $ hg log --follow --patch sub/large4 |
|
863 | 863 | changeset: 6:4355d653f84f |
|
864 | 864 | user: test |
|
865 | 865 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
866 | 866 | summary: edit files yet again |
|
867 | 867 | |
|
868 | 868 | diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 |
|
869 | 869 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
870 | 870 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
871 | 871 | @@ -1,1 +1,1 @@ |
|
872 | 872 | -aeb2210d19f02886dde00dac279729a48471e2f9 |
|
873 | 873 | +971fb41e78fea4f8e0ba5244784239371cb00591 |
|
874 | 874 | |
|
875 | 875 | changeset: 5:9d5af5072dbd |
|
876 | 876 | user: test |
|
877 | 877 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
878 | 878 | summary: edit files again |
|
879 | 879 | |
|
880 | 880 | diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4 |
|
881 | 881 | --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
882 | 882 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
883 | 883 | @@ -1,1 +1,1 @@ |
|
884 | 884 | -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
885 | 885 | +aeb2210d19f02886dde00dac279729a48471e2f9 |
|
886 | 886 | |
|
887 | 887 | changeset: 4:74c02385b94c |
|
888 | 888 | user: test |
|
889 | 889 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
890 | 890 | summary: move files |
|
891 | 891 | |
|
892 | 892 | diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4 |
|
893 | 893 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
894 | 894 | +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 |
|
895 | 895 | @@ -0,0 +1,1 @@ |
|
896 | 896 | +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
897 | 897 | |
|
898 | 898 | changeset: 1:ce8896473775 |
|
899 | 899 | user: test |
|
900 | 900 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
901 | 901 | summary: edit files |
|
902 | 902 | |
|
903 | 903 | diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2 |
|
904 | 904 | --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
905 | 905 | +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
906 | 906 | @@ -1,1 +1,1 @@ |
|
907 | 907 | -1deebade43c8c498a3c8daddac0244dc55d1331d |
|
908 | 908 | +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
909 | 909 | |
|
910 | 910 | changeset: 0:30d30fe6a5be |
|
911 | 911 | user: test |
|
912 | 912 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
913 | 913 | summary: add files |
|
914 | 914 | |
|
915 | 915 | diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2 |
|
916 | 916 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
917 | 917 | +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 |
|
918 | 918 | @@ -0,0 +1,1 @@ |
|
919 | 919 | +1deebade43c8c498a3c8daddac0244dc55d1331d |
|
920 | 920 | |
|
921 | 921 | $ cat sub/normal4 |
|
922 | 922 | normal44 |
|
923 | 923 | $ cat sub/large4 |
|
924 | 924 | large44 |
|
925 | 925 | $ cat sub2/large6 |
|
926 | 926 | large6 |
|
927 | 927 | $ cat sub2/large7 |
|
928 | 928 | large7 |
|
929 | 929 | $ hg log -qf sub2/large7 |
|
930 | 930 | 7:daea875e9014 |
|
931 | 931 | $ hg log -Gqf sub2/large7 |
|
932 | 932 | @ 7:daea875e9014 |
|
933 | 933 | | |
|
934 | 934 | $ cd .. |
|
935 | 935 | |
|
936 | 936 | Test log from outside repo |
|
937 | 937 | |
|
938 | 938 | $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n' |
|
939 | 939 | 6:4355d653f84f edit files yet again |
|
940 | 940 | 5:9d5af5072dbd edit files again |
|
941 | 941 | 4:74c02385b94c move files |
|
942 | 942 | 1:ce8896473775 edit files |
|
943 | 943 | 0:30d30fe6a5be add files |
|
944 | 944 | |
|
945 | 945 | Test clone at revision |
|
946 | 946 | |
|
947 | 947 | $ hg clone a -r 3 c |
|
948 | 948 | adding changesets |
|
949 | 949 | adding manifests |
|
950 | 950 | adding file changes |
|
951 | 951 | added 4 changesets with 10 changes to 4 files |
|
952 | 952 | updating to branch default |
|
953 | 953 | getting changed largefiles |
|
954 | 954 | 2 largefiles updated, 0 removed |
|
955 | 955 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
956 | 956 | $ cd c |
|
957 | 957 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
958 | 958 | 3:9e8fbc4bce62 copy files |
|
959 | 959 | 2:51a0ae4d5864 remove files |
|
960 | 960 | 1:ce8896473775 edit files |
|
961 | 961 | 0:30d30fe6a5be add files |
|
962 | 962 | $ cat normal1 |
|
963 | 963 | normal22 |
|
964 | 964 | $ cat large1 |
|
965 | 965 | large22 |
|
966 | 966 | $ cat sub/normal2 |
|
967 | 967 | normal22 |
|
968 | 968 | $ cat sub/large2 |
|
969 | 969 | large22 |
|
970 | 970 | |
|
971 | 971 | Old revisions of a clone have correct largefiles content (this also |
|
972 | 972 | tests update). |
|
973 | 973 | |
|
974 | 974 | $ hg update -r 1 |
|
975 | 975 | getting changed largefiles |
|
976 | 976 | 1 largefiles updated, 0 removed |
|
977 | 977 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
978 | 978 | $ cat large1 |
|
979 | 979 | large11 |
|
980 | 980 | $ cat sub/large2 |
|
981 | 981 | large22 |
|
982 | 982 | $ cd .. |
|
983 | 983 | |
|
984 | 984 | Test cloning with --all-largefiles flag |
|
985 | 985 | |
|
986 | 986 | $ rm "${USERCACHE}"/* |
|
987 | 987 | $ hg clone --all-largefiles a a-backup |
|
988 | 988 | updating to branch default |
|
989 | 989 | getting changed largefiles |
|
990 | 990 | 3 largefiles updated, 0 removed |
|
991 | 991 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
992 | 992 | 8 additional largefiles cached |
|
993 | 993 | |
|
994 | 994 | $ rm "${USERCACHE}"/* |
|
995 | 995 | $ hg clone --all-largefiles -u 0 a a-clone0 |
|
996 | 996 | updating to branch default |
|
997 | 997 | getting changed largefiles |
|
998 | 998 | 2 largefiles updated, 0 removed |
|
999 | 999 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1000 | 1000 | 9 additional largefiles cached |
|
1001 | 1001 | $ hg -R a-clone0 sum |
|
1002 | 1002 | parent: 0:30d30fe6a5be |
|
1003 | 1003 | add files |
|
1004 | 1004 | branch: default |
|
1005 | 1005 | commit: (clean) |
|
1006 | 1006 | update: 7 new changesets (update) |
|
1007 | 1007 | phases: 8 draft |
|
1008 | 1008 | |
|
1009 | 1009 | $ rm "${USERCACHE}"/* |
|
1010 | 1010 | $ hg clone --all-largefiles -u 1 a a-clone1 |
|
1011 | 1011 | updating to branch default |
|
1012 | 1012 | getting changed largefiles |
|
1013 | 1013 | 2 largefiles updated, 0 removed |
|
1014 | 1014 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1015 | 1015 | 8 additional largefiles cached |
|
1016 | 1016 | $ hg -R a-clone1 verify --large --lfa --lfc |
|
1017 | 1017 | checking changesets |
|
1018 | 1018 | checking manifests |
|
1019 | 1019 | crosschecking files in changesets and manifests |
|
1020 | 1020 | checking files |
|
1021 | 1021 | 10 files, 8 changesets, 24 total revisions |
|
1022 | 1022 | searching 8 changesets for largefiles |
|
1023 | 1023 | verified contents of 13 revisions of 6 largefiles |
|
1024 | 1024 | $ hg -R a-clone1 sum |
|
1025 | 1025 | parent: 1:ce8896473775 |
|
1026 | 1026 | edit files |
|
1027 | 1027 | branch: default |
|
1028 | 1028 | commit: (clean) |
|
1029 | 1029 | update: 6 new changesets (update) |
|
1030 | 1030 | phases: 8 draft |
|
1031 | 1031 | |
|
1032 | 1032 | $ rm "${USERCACHE}"/* |
|
1033 | 1033 | $ hg clone --all-largefiles -U a a-clone-u |
|
1034 | 1034 | 11 additional largefiles cached |
|
1035 | 1035 | $ hg -R a-clone-u sum |
|
1036 | 1036 | parent: -1:000000000000 (no revision checked out) |
|
1037 | 1037 | branch: default |
|
1038 | 1038 | commit: (clean) |
|
1039 | 1039 | update: 8 new changesets (update) |
|
1040 | 1040 | phases: 8 draft |
|
1041 | 1041 | |
|
1042 | 1042 | Show computed destination directory: |
|
1043 | 1043 | |
|
1044 | 1044 | $ mkdir xyz |
|
1045 | 1045 | $ cd xyz |
|
1046 | 1046 | $ hg clone ../a |
|
1047 | 1047 | destination directory: a |
|
1048 | 1048 | updating to branch default |
|
1049 | 1049 | getting changed largefiles |
|
1050 | 1050 | 3 largefiles updated, 0 removed |
|
1051 | 1051 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1052 | 1052 | $ cd .. |
|
1053 | 1053 | |
|
1054 | 1054 | Clone URL without path: |
|
1055 | 1055 | |
|
1056 | 1056 | $ hg clone file:// |
|
1057 | 1057 | abort: repository / not found! |
|
1058 | 1058 | [255] |
|
1059 | 1059 | |
|
1060 | 1060 | Ensure base clone command argument validation |
|
1061 | 1061 | |
|
1062 | 1062 | $ hg clone -U -u 0 a a-clone-failure |
|
1063 | 1063 | abort: cannot specify both --noupdate and --updaterev |
|
1064 | 1064 | [255] |
|
1065 | 1065 | |
|
1066 | 1066 | $ hg clone --all-largefiles a ssh://localhost/a |
|
1067 | 1067 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
1068 | 1068 | [255] |
|
1069 | 1069 | |
|
1070 | 1070 | Test pulling with --all-largefiles flag. Also test that the largefiles are |
|
1071 | 1071 | downloaded from 'default' instead of 'default-push' when no source is specified |
|
1072 | 1072 | (issue3584) |
|
1073 | 1073 | |
|
1074 | 1074 | $ rm -Rf a-backup |
|
1075 | 1075 | $ hg clone -r 1 a a-backup |
|
1076 | 1076 | adding changesets |
|
1077 | 1077 | adding manifests |
|
1078 | 1078 | adding file changes |
|
1079 | 1079 | added 2 changesets with 8 changes to 4 files |
|
1080 | 1080 | updating to branch default |
|
1081 | 1081 | getting changed largefiles |
|
1082 | 1082 | 2 largefiles updated, 0 removed |
|
1083 | 1083 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1084 | 1084 | $ rm "${USERCACHE}"/* |
|
1085 | 1085 | $ cd a-backup |
|
1086 | 1086 | $ hg pull --all-largefiles --config paths.default-push=bogus/path |
|
1087 | 1087 | pulling from $TESTTMP/a (glob) |
|
1088 | 1088 | searching for changes |
|
1089 | 1089 | adding changesets |
|
1090 | 1090 | adding manifests |
|
1091 | 1091 | adding file changes |
|
1092 | 1092 | added 6 changesets with 16 changes to 8 files |
|
1093 | 1093 | (run 'hg update' to get a working copy) |
|
1094 | 1094 | 6 largefiles cached |
|
1095 | 1095 | |
|
1096 | 1096 | redo pull with --lfrev and check it pulls largefiles for the right revs |
|
1097 | 1097 | |
|
1098 | 1098 | $ hg rollback |
|
1099 | 1099 | repository tip rolled back to revision 1 (undo pull) |
|
1100 | 1100 | $ hg pull -v --lfrev 'heads(pulled())+min(pulled())' |
|
1101 | 1101 | pulling from $TESTTMP/a (glob) |
|
1102 | 1102 | searching for changes |
|
1103 | 1103 | all local heads known remotely |
|
1104 | 1104 | 6 changesets found |
|
1105 | 1105 | uncompressed size of bundle content: |
|
1106 | 1106 | 1333 (changelog) |
|
1107 | 1107 | 1599 (manifests) |
|
1108 | 1108 | 254 .hglf/large1 |
|
1109 | 1109 | 564 .hglf/large3 |
|
1110 | 1110 | 572 .hglf/sub/large4 |
|
1111 | 1111 | 182 .hglf/sub2/large6 |
|
1112 | 1112 | 182 .hglf/sub2/large7 |
|
1113 | 1113 | 212 normal1 |
|
1114 | 1114 | 457 normal3 |
|
1115 | 1115 | 465 sub/normal4 |
|
1116 | 1116 | adding changesets |
|
1117 | 1117 | adding manifests |
|
1118 | 1118 | adding file changes |
|
1119 | 1119 | added 6 changesets with 16 changes to 8 files |
|
1120 | 1120 | calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles |
|
1121 | 1121 | (run 'hg update' to get a working copy) |
|
1122 | 1122 | pulling largefiles for revision 7 |
|
1123 | 1123 | found 971fb41e78fea4f8e0ba5244784239371cb00591 in store |
|
1124 | 1124 | found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store |
|
1125 | 1125 | found bb3151689acb10f0c3125c560d5e63df914bc1af in store |
|
1126 | 1126 | pulling largefiles for revision 2 |
|
1127 | 1127 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1128 | 1128 | 0 largefiles cached |
|
1129 | 1129 | |
|
1130 | 1130 | lfpull |
|
1131 | 1131 | |
|
1132 | 1132 | $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull |
|
1133 | 1133 | 2 largefiles cached |
|
1134 | 1134 | $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull |
|
1135 | 1135 | pulling largefiles for revision 4 |
|
1136 | 1136 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1137 | 1137 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1138 | 1138 | pulling largefiles for revision 2 |
|
1139 | 1139 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
1140 | 1140 | 0 largefiles cached |
|
1141 | 1141 | |
|
1142 | 1142 | $ ls usercache-lfpull/* | sort |
|
1143 | 1143 | usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d |
|
1144 | 1144 | usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64 |
|
1145 | 1145 | |
|
1146 | 1146 | $ cd .. |
|
1147 | 1147 | |
|
1148 | 1148 | Rebasing between two repositories does not revert largefiles to old |
|
1149 | 1149 | revisions (this was a very bad bug that took a lot of work to fix). |
|
1150 | 1150 | |
|
1151 | 1151 | $ hg clone a d |
|
1152 | 1152 | updating to branch default |
|
1153 | 1153 | getting changed largefiles |
|
1154 | 1154 | 3 largefiles updated, 0 removed |
|
1155 | 1155 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1156 | 1156 | $ cd b |
|
1157 | 1157 | $ echo large4-modified > sub/large4 |
|
1158 | 1158 | $ echo normal3-modified > normal3 |
|
1159 | 1159 | $ hg commit -m "modify normal file and largefile in repo b" |
|
1160 | 1160 | Invoking status precommit hook |
|
1161 | 1161 | M normal3 |
|
1162 | 1162 | M sub/large4 |
|
1163 | 1163 | $ cd ../d |
|
1164 | 1164 | $ echo large6-modified > sub2/large6 |
|
1165 | 1165 | $ echo normal4-modified > sub/normal4 |
|
1166 | 1166 | $ hg commit -m "modify normal file largefile in repo d" |
|
1167 | 1167 | Invoking status precommit hook |
|
1168 | 1168 | M sub/normal4 |
|
1169 | 1169 | M sub2/large6 |
|
1170 | 1170 | $ cd .. |
|
1171 | 1171 | $ hg clone d e |
|
1172 | 1172 | updating to branch default |
|
1173 | 1173 | getting changed largefiles |
|
1174 | 1174 | 3 largefiles updated, 0 removed |
|
1175 | 1175 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1176 | 1176 | $ cd d |
|
1177 | 1177 | |
|
1178 | 1178 | More rebase testing, but also test that the largefiles are downloaded from |
|
1179 | 1179 | 'default-push' when no source is specified (issue3584). (The largefile from the |
|
1180 | 1180 | pulled revision is however not downloaded but found in the local cache.) |
|
1181 | 1181 | Largefiles are fetched for the new pulled revision, not for existing revisions, |
|
1182 | 1182 | rebased or not. |
|
1183 | 1183 | |
|
1184 | 1184 | $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1185 | 1185 | $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b |
|
1186 | 1186 | pulling from $TESTTMP/b (glob) |
|
1187 | 1187 | searching for changes |
|
1188 | 1188 | adding changesets |
|
1189 | 1189 | adding manifests |
|
1190 | 1190 | adding file changes |
|
1191 | 1191 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1192 | 1192 | rebasing 8:f574fb32bb45 "modify normal file largefile in repo d" |
|
1193 | 1193 | Invoking status precommit hook |
|
1194 | 1194 | M sub/normal4 |
|
1195 | 1195 | M sub2/large6 |
|
1196 | 1196 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-dd1d9f80-backup.hg (glob) |
|
1197 | 1197 | 0 largefiles cached |
|
1198 | 1198 | $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1199 | 1199 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1200 | 1200 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1201 | 1201 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1202 | 1202 | 7:daea875e9014 add/edit more largefiles |
|
1203 | 1203 | 6:4355d653f84f edit files yet again |
|
1204 | 1204 | 5:9d5af5072dbd edit files again |
|
1205 | 1205 | 4:74c02385b94c move files |
|
1206 | 1206 | 3:9e8fbc4bce62 copy files |
|
1207 | 1207 | 2:51a0ae4d5864 remove files |
|
1208 | 1208 | 1:ce8896473775 edit files |
|
1209 | 1209 | 0:30d30fe6a5be add files |
|
1210 | 1210 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
1211 | 1211 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1212 | 1212 | | |
|
1213 | 1213 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1214 | 1214 | | |
|
1215 | 1215 | o 7:daea875e9014 add/edit more largefiles |
|
1216 | 1216 | | |
|
1217 | 1217 | o 6:4355d653f84f edit files yet again |
|
1218 | 1218 | | |
|
1219 | 1219 | o 5:9d5af5072dbd edit files again |
|
1220 | 1220 | | |
|
1221 | 1221 | o 4:74c02385b94c move files |
|
1222 | 1222 | | |
|
1223 | 1223 | o 3:9e8fbc4bce62 copy files |
|
1224 | 1224 | | |
|
1225 | 1225 | o 2:51a0ae4d5864 remove files |
|
1226 | 1226 | | |
|
1227 | 1227 | o 1:ce8896473775 edit files |
|
1228 | 1228 | | |
|
1229 | 1229 | o 0:30d30fe6a5be add files |
|
1230 | 1230 | |
|
1231 | 1231 | $ cat normal3 |
|
1232 | 1232 | normal3-modified |
|
1233 | 1233 | $ cat sub/normal4 |
|
1234 | 1234 | normal4-modified |
|
1235 | 1235 | $ cat sub/large4 |
|
1236 | 1236 | large4-modified |
|
1237 | 1237 | $ cat sub2/large6 |
|
1238 | 1238 | large6-modified |
|
1239 | 1239 | $ cat sub2/large7 |
|
1240 | 1240 | large7 |
|
1241 | 1241 | $ cd ../e |
|
1242 | 1242 | $ hg pull ../b |
|
1243 | 1243 | pulling from ../b |
|
1244 | 1244 | searching for changes |
|
1245 | 1245 | adding changesets |
|
1246 | 1246 | adding manifests |
|
1247 | 1247 | adding file changes |
|
1248 | 1248 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1249 | 1249 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1250 | 1250 | $ hg rebase |
|
1251 | 1251 | rebasing 8:f574fb32bb45 "modify normal file largefile in repo d" |
|
1252 | 1252 | Invoking status precommit hook |
|
1253 | 1253 | M sub/normal4 |
|
1254 | 1254 | M sub2/large6 |
|
1255 | 1255 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-dd1d9f80-backup.hg (glob) |
|
1256 | 1256 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1257 | 1257 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1258 | 1258 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1259 | 1259 | 7:daea875e9014 add/edit more largefiles |
|
1260 | 1260 | 6:4355d653f84f edit files yet again |
|
1261 | 1261 | 5:9d5af5072dbd edit files again |
|
1262 | 1262 | 4:74c02385b94c move files |
|
1263 | 1263 | 3:9e8fbc4bce62 copy files |
|
1264 | 1264 | 2:51a0ae4d5864 remove files |
|
1265 | 1265 | 1:ce8896473775 edit files |
|
1266 | 1266 | 0:30d30fe6a5be add files |
|
1267 | 1267 | $ cat normal3 |
|
1268 | 1268 | normal3-modified |
|
1269 | 1269 | $ cat sub/normal4 |
|
1270 | 1270 | normal4-modified |
|
1271 | 1271 | $ cat sub/large4 |
|
1272 | 1272 | large4-modified |
|
1273 | 1273 | $ cat sub2/large6 |
|
1274 | 1274 | large6-modified |
|
1275 | 1275 | $ cat sub2/large7 |
|
1276 | 1276 | large7 |
|
1277 | 1277 | |
|
1278 | 1278 | Log on largefiles |
|
1279 | 1279 | |
|
1280 | 1280 | - same output |
|
1281 | 1281 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1282 | 1282 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1283 | 1283 | 6:4355d653f84f edit files yet again |
|
1284 | 1284 | 5:9d5af5072dbd edit files again |
|
1285 | 1285 | 4:74c02385b94c move files |
|
1286 | 1286 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1287 | 1287 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1288 | 1288 | | |
|
1289 | 1289 | o 6:4355d653f84f edit files yet again |
|
1290 | 1290 | | |
|
1291 | 1291 | o 5:9d5af5072dbd edit files again |
|
1292 | 1292 | | |
|
1293 | 1293 | o 4:74c02385b94c move files |
|
1294 | 1294 | | |
|
1295 | 1295 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4 |
|
1296 | 1296 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1297 | 1297 | 6:4355d653f84f edit files yet again |
|
1298 | 1298 | 5:9d5af5072dbd edit files again |
|
1299 | 1299 | 4:74c02385b94c move files |
|
1300 | 1300 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1301 | 1301 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1302 | 1302 | | |
|
1303 | 1303 | o 6:4355d653f84f edit files yet again |
|
1304 | 1304 | | |
|
1305 | 1305 | o 5:9d5af5072dbd edit files again |
|
1306 | 1306 | | |
|
1307 | 1307 | o 4:74c02385b94c move files |
|
1308 | 1308 | | |
|
1309 | 1309 | |
|
1310 | 1310 | - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal |
|
1311 | 1311 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1312 | 1312 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1313 | 1313 | 6:4355d653f84f edit files yet again |
|
1314 | 1314 | 5:9d5af5072dbd edit files again |
|
1315 | 1315 | 4:74c02385b94c move files |
|
1316 | 1316 | 1:ce8896473775 edit files |
|
1317 | 1317 | 0:30d30fe6a5be add files |
|
1318 | 1318 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1319 | 1319 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1320 | 1320 | | |
|
1321 | 1321 | o 6:4355d653f84f edit files yet again |
|
1322 | 1322 | | |
|
1323 | 1323 | o 5:9d5af5072dbd edit files again |
|
1324 | 1324 | | |
|
1325 | 1325 | o 4:74c02385b94c move files |
|
1326 | 1326 | | |
|
1327 | 1327 | o 1:ce8896473775 edit files |
|
1328 | 1328 | | |
|
1329 | 1329 | o 0:30d30fe6a5be add files |
|
1330 | 1330 | |
|
1331 | 1331 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1332 | 1332 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1333 | 1333 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1334 | 1334 | 6:4355d653f84f edit files yet again |
|
1335 | 1335 | 5:9d5af5072dbd edit files again |
|
1336 | 1336 | 4:74c02385b94c move files |
|
1337 | 1337 | 1:ce8896473775 edit files |
|
1338 | 1338 | 0:30d30fe6a5be add files |
|
1339 | 1339 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1340 | 1340 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1341 | 1341 | | |
|
1342 | 1342 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1343 | 1343 | | |
|
1344 | 1344 | o 6:4355d653f84f edit files yet again |
|
1345 | 1345 | | |
|
1346 | 1346 | o 5:9d5af5072dbd edit files again |
|
1347 | 1347 | | |
|
1348 | 1348 | o 4:74c02385b94c move files |
|
1349 | 1349 | | |
|
1350 | 1350 | o 1:ce8896473775 edit files |
|
1351 | 1351 | | |
|
1352 | 1352 | o 0:30d30fe6a5be add files |
|
1353 | 1353 | |
|
1354 | 1354 | - globbing gives same result |
|
1355 | 1355 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1356 | 1356 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1357 | 1357 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1358 | 1358 | 6:4355d653f84f edit files yet again |
|
1359 | 1359 | 5:9d5af5072dbd edit files again |
|
1360 | 1360 | 4:74c02385b94c move files |
|
1361 | 1361 | 1:ce8896473775 edit files |
|
1362 | 1362 | 0:30d30fe6a5be add files |
|
1363 | 1363 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1364 | 1364 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1365 | 1365 | | |
|
1366 | 1366 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1367 | 1367 | | |
|
1368 | 1368 | o 6:4355d653f84f edit files yet again |
|
1369 | 1369 | | |
|
1370 | 1370 | o 5:9d5af5072dbd edit files again |
|
1371 | 1371 | | |
|
1372 | 1372 | o 4:74c02385b94c move files |
|
1373 | 1373 | | |
|
1374 | 1374 | o 1:ce8896473775 edit files |
|
1375 | 1375 | | |
|
1376 | 1376 | o 0:30d30fe6a5be add files |
|
1377 | 1377 | |
|
1378 | 1378 | Rollback on largefiles. |
|
1379 | 1379 | |
|
1380 | 1380 | $ echo large4-modified-again > sub/large4 |
|
1381 | 1381 | $ hg commit -m "Modify large4 again" |
|
1382 | 1382 | Invoking status precommit hook |
|
1383 | 1383 | M sub/large4 |
|
1384 | 1384 | $ hg rollback |
|
1385 | 1385 | repository tip rolled back to revision 9 (undo commit) |
|
1386 | 1386 | working directory now based on revision 9 |
|
1387 | 1387 | $ hg st |
|
1388 | 1388 | M sub/large4 |
|
1389 | 1389 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1390 | 1390 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1391 | 1391 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1392 | 1392 | 7:daea875e9014 add/edit more largefiles |
|
1393 | 1393 | 6:4355d653f84f edit files yet again |
|
1394 | 1394 | 5:9d5af5072dbd edit files again |
|
1395 | 1395 | 4:74c02385b94c move files |
|
1396 | 1396 | 3:9e8fbc4bce62 copy files |
|
1397 | 1397 | 2:51a0ae4d5864 remove files |
|
1398 | 1398 | 1:ce8896473775 edit files |
|
1399 | 1399 | 0:30d30fe6a5be add files |
|
1400 | 1400 | $ cat sub/large4 |
|
1401 | 1401 | large4-modified-again |
|
1402 | 1402 | |
|
1403 | 1403 | "update --check" refuses to update with uncommitted changes. |
|
1404 | 1404 | $ hg update --check 8 |
|
1405 | 1405 | abort: uncommitted changes |
|
1406 | 1406 | [255] |
|
1407 | 1407 | |
|
1408 | 1408 | "update --clean" leaves correct largefiles in working copy, even when there is |
|
1409 | 1409 | .orig files from revert in .hglf. |
|
1410 | 1410 | |
|
1411 | 1411 | $ echo mistake > sub2/large7 |
|
1412 | 1412 | $ hg revert sub2/large7 |
|
1413 | 1413 | $ cat sub2/large7 |
|
1414 | 1414 | large7 |
|
1415 | 1415 | $ cat sub2/large7.orig |
|
1416 | 1416 | mistake |
|
1417 | 1417 | $ test ! -f .hglf/sub2/large7.orig |
|
1418 | 1418 | |
|
1419 | 1419 | $ hg -q update --clean -r null |
|
1420 | 1420 | $ hg update --clean |
|
1421 | 1421 | getting changed largefiles |
|
1422 | 1422 | 3 largefiles updated, 0 removed |
|
1423 | 1423 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1424 | 1424 | $ cat normal3 |
|
1425 | 1425 | normal3-modified |
|
1426 | 1426 | $ cat sub/normal4 |
|
1427 | 1427 | normal4-modified |
|
1428 | 1428 | $ cat sub/large4 |
|
1429 | 1429 | large4-modified |
|
1430 | 1430 | $ cat sub2/large6 |
|
1431 | 1431 | large6-modified |
|
1432 | 1432 | $ cat sub2/large7 |
|
1433 | 1433 | large7 |
|
1434 | 1434 | $ cat sub2/large7.orig |
|
1435 | 1435 | mistake |
|
1436 | 1436 | $ test ! -f .hglf/sub2/large7.orig |
|
1437 | 1437 | |
|
1438 | 1438 | verify that largefile .orig file no longer is overwritten on every update -C: |
|
1439 | 1439 | $ hg update --clean |
|
1440 | 1440 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1441 | 1441 | $ cat sub2/large7.orig |
|
1442 | 1442 | mistake |
|
1443 | 1443 | $ rm sub2/large7.orig |
|
1444 | 1444 | |
|
1445 | 1445 | Now "update check" is happy. |
|
1446 | 1446 | $ hg update --check 8 |
|
1447 | 1447 | getting changed largefiles |
|
1448 | 1448 | 1 largefiles updated, 0 removed |
|
1449 | 1449 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1450 | 1450 | $ hg update --check |
|
1451 | 1451 | getting changed largefiles |
|
1452 | 1452 | 1 largefiles updated, 0 removed |
|
1453 | 1453 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1454 | 1454 | |
|
1455 | 1455 | Test removing empty largefiles directories on update |
|
1456 | 1456 | $ test -d sub2 && echo "sub2 exists" |
|
1457 | 1457 | sub2 exists |
|
1458 | 1458 | $ hg update -q null |
|
1459 | 1459 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1460 | 1460 | [1] |
|
1461 | 1461 | $ hg update -q |
|
1462 | 1462 | |
|
1463 | 1463 | Test hg remove removes empty largefiles directories |
|
1464 | 1464 | $ test -d sub2 && echo "sub2 exists" |
|
1465 | 1465 | sub2 exists |
|
1466 | 1466 | $ hg remove sub2/* |
|
1467 | 1467 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1468 | 1468 | [1] |
|
1469 | 1469 | $ hg revert sub2/large6 sub2/large7 |
|
1470 | 1470 | |
|
1471 | 1471 | "revert" works on largefiles (and normal files too). |
|
1472 | 1472 | $ echo hack3 >> normal3 |
|
1473 | 1473 | $ echo hack4 >> sub/normal4 |
|
1474 | 1474 | $ echo hack4 >> sub/large4 |
|
1475 | 1475 | $ rm sub2/large6 |
|
1476 | 1476 | $ hg revert sub2/large6 |
|
1477 | 1477 | $ hg rm sub2/large6 |
|
1478 | 1478 | $ echo new >> sub2/large8 |
|
1479 | 1479 | $ hg add --large sub2/large8 |
|
1480 | 1480 | # XXX we don't really want to report that we're reverting the standin; |
|
1481 | 1481 | # that's just an implementation detail. But I don't see an obvious fix. ;-( |
|
1482 | 1482 | $ hg revert sub |
|
1483 | 1483 | reverting .hglf/sub/large4 (glob) |
|
1484 | 1484 | reverting sub/normal4 (glob) |
|
1485 | 1485 | $ hg status |
|
1486 | 1486 | M normal3 |
|
1487 | 1487 | A sub2/large8 |
|
1488 | 1488 | R sub2/large6 |
|
1489 | 1489 | ? sub/large4.orig |
|
1490 | 1490 | ? sub/normal4.orig |
|
1491 | 1491 | $ cat sub/normal4 |
|
1492 | 1492 | normal4-modified |
|
1493 | 1493 | $ cat sub/large4 |
|
1494 | 1494 | large4-modified |
|
1495 | 1495 | $ hg revert -a --no-backup |
|
1496 | 1496 | undeleting .hglf/sub2/large6 (glob) |
|
1497 | 1497 | forgetting .hglf/sub2/large8 (glob) |
|
1498 | 1498 | reverting normal3 |
|
1499 | 1499 | $ hg status |
|
1500 | 1500 | ? sub/large4.orig |
|
1501 | 1501 | ? sub/normal4.orig |
|
1502 | 1502 | ? sub2/large8 |
|
1503 | 1503 | $ cat normal3 |
|
1504 | 1504 | normal3-modified |
|
1505 | 1505 | $ cat sub2/large6 |
|
1506 | 1506 | large6-modified |
|
1507 | 1507 | $ rm sub/*.orig sub2/large8 |
|
1508 | 1508 | |
|
1509 | 1509 | revert some files to an older revision |
|
1510 | 1510 | $ hg revert --no-backup -r 8 sub2 |
|
1511 | 1511 | reverting .hglf/sub2/large6 (glob) |
|
1512 | 1512 | $ cat sub2/large6 |
|
1513 | 1513 | large6 |
|
1514 | 1514 | $ hg revert --no-backup -C -r '.^' sub2 |
|
1515 | 1515 | $ hg revert --no-backup sub2 |
|
1516 | 1516 | reverting .hglf/sub2/large6 (glob) |
|
1517 | 1517 | $ hg status |
|
1518 | 1518 | |
|
1519 | 1519 | "verify --large" actually verifies largefiles |
|
1520 | 1520 | |
|
1521 | 1521 | - Where Do We Come From? What Are We? Where Are We Going? |
|
1522 | 1522 | $ pwd |
|
1523 | 1523 | $TESTTMP/e |
|
1524 | 1524 | $ hg paths |
|
1525 | 1525 | default = $TESTTMP/d (glob) |
|
1526 | 1526 | |
|
1527 | 1527 | $ hg verify --large |
|
1528 | 1528 | checking changesets |
|
1529 | 1529 | checking manifests |
|
1530 | 1530 | crosschecking files in changesets and manifests |
|
1531 | 1531 | checking files |
|
1532 | 1532 | 10 files, 10 changesets, 28 total revisions |
|
1533 | 1533 | searching 1 changesets for largefiles |
|
1534 | 1534 | verified existence of 3 revisions of 3 largefiles |
|
1535 | 1535 | |
|
1536 | 1536 | - introduce missing blob in local store repo and make sure that this is caught: |
|
1537 | 1537 | $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 . |
|
1538 | 1538 | $ hg verify --large |
|
1539 | 1539 | checking changesets |
|
1540 | 1540 | checking manifests |
|
1541 | 1541 | crosschecking files in changesets and manifests |
|
1542 | 1542 | checking files |
|
1543 | 1543 | 10 files, 10 changesets, 28 total revisions |
|
1544 | 1544 | searching 1 changesets for largefiles |
|
1545 | 1545 | changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob) |
|
1546 | 1546 | verified existence of 3 revisions of 3 largefiles |
|
1547 | 1547 | [1] |
|
1548 | 1548 | |
|
1549 | 1549 | - introduce corruption and make sure that it is caught when checking content: |
|
1550 | 1550 | $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1551 | 1551 | $ hg verify -q --large --lfc |
|
1552 | 1552 | changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob) |
|
1553 | 1553 | [1] |
|
1554 | 1554 | |
|
1555 | 1555 | - cleanup |
|
1556 | 1556 | $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/ |
|
1557 | 1557 | |
|
1558 | 1558 | - verifying all revisions will fail because we didn't clone all largefiles to d: |
|
1559 | 1559 | $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1560 | 1560 | $ hg verify -q --lfa --lfc |
|
1561 | 1561 | changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob) |
|
1562 | 1562 | changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob) |
|
1563 | 1563 | changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob) |
|
1564 | 1564 | changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1565 | 1565 | changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1566 | 1566 | changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1567 | 1567 | changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1568 | 1568 | changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob) |
|
1569 | 1569 | changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob) |
|
1570 | 1570 | changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob) |
|
1571 | 1571 | [1] |
|
1572 | 1572 | |
|
1573 | 1573 | - cleanup |
|
1574 | 1574 | $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1575 | 1575 | $ rm -f .hglf/sub/*.orig |
|
1576 | 1576 | |
|
1577 | 1577 | Update to revision with missing largefile - and make sure it really is missing |
|
1578 | 1578 | |
|
1579 | 1579 | $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
1580 | 1580 | $ hg up -r 6 |
|
1581 | 1581 | getting changed largefiles |
|
1582 | 1582 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1583 | 1583 | 1 largefiles updated, 2 removed |
|
1584 | 1584 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1585 | 1585 | $ rm normal3 |
|
1586 | 1586 | $ echo >> sub/normal4 |
|
1587 | 1587 | $ hg ci -m 'commit with missing files' |
|
1588 | 1588 | Invoking status precommit hook |
|
1589 | 1589 | M sub/normal4 |
|
1590 | 1590 | ! large3 |
|
1591 | 1591 | ! normal3 |
|
1592 | 1592 | created new head |
|
1593 | 1593 | $ hg st |
|
1594 | 1594 | ! large3 |
|
1595 | 1595 | ! normal3 |
|
1596 | 1596 | $ hg up -r. |
|
1597 | 1597 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1598 | 1598 | $ hg st |
|
1599 | 1599 | ! large3 |
|
1600 | 1600 | ! normal3 |
|
1601 | 1601 | $ hg up -Cr. |
|
1602 | 1602 | getting changed largefiles |
|
1603 | 1603 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1604 | 1604 | 0 largefiles updated, 0 removed |
|
1605 | 1605 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1606 | 1606 | $ hg st |
|
1607 | 1607 | ! large3 |
|
1608 | 1608 | $ hg rollback |
|
1609 | 1609 | repository tip rolled back to revision 9 (undo commit) |
|
1610 | 1610 | working directory now based on revision 6 |
|
1611 | 1611 | |
|
1612 | 1612 | Merge with revision with missing largefile - and make sure it tries to fetch it. |
|
1613 | 1613 | |
|
1614 | 1614 | $ hg up -Cqr null |
|
1615 | 1615 | $ echo f > f |
|
1616 | 1616 | $ hg ci -Am branch |
|
1617 | 1617 | adding f |
|
1618 | 1618 | Invoking status precommit hook |
|
1619 | 1619 | A f |
|
1620 | 1620 | created new head |
|
1621 | 1621 | $ hg merge -r 6 |
|
1622 | 1622 | getting changed largefiles |
|
1623 | 1623 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1624 | 1624 | 1 largefiles updated, 0 removed |
|
1625 | 1625 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1626 | 1626 | (branch merge, don't forget to commit) |
|
1627 | 1627 | |
|
1628 | 1628 | $ hg rollback -q |
|
1629 | 1629 | $ hg up -Cq |
|
1630 | 1630 | |
|
1631 | 1631 | Pulling 0 revisions with --all-largefiles should not fetch for all revisions |
|
1632 | 1632 | |
|
1633 | 1633 | $ hg pull --all-largefiles |
|
1634 | 1634 | pulling from $TESTTMP/d (glob) |
|
1635 | 1635 | searching for changes |
|
1636 | 1636 | no changes found |
|
1637 | 1637 | |
|
1638 | 1638 | Merging does not revert to old versions of largefiles and also check |
|
1639 | 1639 | that merging after having pulled from a non-default remote works |
|
1640 | 1640 | correctly. |
|
1641 | 1641 | |
|
1642 | 1642 | $ cd .. |
|
1643 | 1643 | $ hg clone -r 7 e temp |
|
1644 | 1644 | adding changesets |
|
1645 | 1645 | adding manifests |
|
1646 | 1646 | adding file changes |
|
1647 | 1647 | added 8 changesets with 24 changes to 10 files |
|
1648 | 1648 | updating to branch default |
|
1649 | 1649 | getting changed largefiles |
|
1650 | 1650 | 3 largefiles updated, 0 removed |
|
1651 | 1651 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1652 | 1652 | $ hg clone temp f |
|
1653 | 1653 | updating to branch default |
|
1654 | 1654 | getting changed largefiles |
|
1655 | 1655 | 3 largefiles updated, 0 removed |
|
1656 | 1656 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1657 | 1657 | # Delete the largefiles in the largefiles system cache so that we have an |
|
1658 | 1658 | # opportunity to test that caching after a pull works. |
|
1659 | 1659 | $ rm "${USERCACHE}"/* |
|
1660 | 1660 | $ cd f |
|
1661 | 1661 | $ echo "large4-merge-test" > sub/large4 |
|
1662 | 1662 | $ hg commit -m "Modify large4 to test merge" |
|
1663 | 1663 | Invoking status precommit hook |
|
1664 | 1664 | M sub/large4 |
|
1665 | 1665 | # Test --cache-largefiles flag |
|
1666 | 1666 | $ hg pull --lfrev 'heads(pulled())' ../e |
|
1667 | 1667 | pulling from ../e |
|
1668 | 1668 | searching for changes |
|
1669 | 1669 | adding changesets |
|
1670 | 1670 | adding manifests |
|
1671 | 1671 | adding file changes |
|
1672 | 1672 | added 2 changesets with 4 changes to 4 files (+1 heads) |
|
1673 | 1673 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1674 | 1674 | 2 largefiles cached |
|
1675 | 1675 | $ hg merge |
|
1676 | 1676 | largefile sub/large4 has a merge conflict |
|
1677 | 1677 | ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591 |
|
1678 | 1678 | keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or |
|
1679 | 1679 | take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l |
|
1680 | 1680 | getting changed largefiles |
|
1681 | 1681 | 1 largefiles updated, 0 removed |
|
1682 | 1682 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1683 | 1683 | (branch merge, don't forget to commit) |
|
1684 | 1684 | $ hg commit -m "Merge repos e and f" |
|
1685 | 1685 | Invoking status precommit hook |
|
1686 | 1686 | M normal3 |
|
1687 | 1687 | M sub/normal4 |
|
1688 | 1688 | M sub2/large6 |
|
1689 | 1689 | $ cat normal3 |
|
1690 | 1690 | normal3-modified |
|
1691 | 1691 | $ cat sub/normal4 |
|
1692 | 1692 | normal4-modified |
|
1693 | 1693 | $ cat sub/large4 |
|
1694 | 1694 | large4-merge-test |
|
1695 | 1695 | $ cat sub2/large6 |
|
1696 | 1696 | large6-modified |
|
1697 | 1697 | $ cat sub2/large7 |
|
1698 | 1698 | large7 |
|
1699 | 1699 | |
|
1700 | 1700 | Test status after merging with a branch that introduces a new largefile: |
|
1701 | 1701 | |
|
1702 | 1702 | $ echo large > large |
|
1703 | 1703 | $ hg add --large large |
|
1704 | 1704 | $ hg commit -m 'add largefile' |
|
1705 | 1705 | Invoking status precommit hook |
|
1706 | 1706 | A large |
|
1707 | 1707 | $ hg update -q ".^" |
|
1708 | 1708 | $ echo change >> normal3 |
|
1709 | 1709 | $ hg commit -m 'some change' |
|
1710 | 1710 | Invoking status precommit hook |
|
1711 | 1711 | M normal3 |
|
1712 | 1712 | created new head |
|
1713 | 1713 | $ hg merge |
|
1714 | 1714 | getting changed largefiles |
|
1715 | 1715 | 1 largefiles updated, 0 removed |
|
1716 | 1716 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1717 | 1717 | (branch merge, don't forget to commit) |
|
1718 | 1718 | $ hg status |
|
1719 | 1719 | M large |
|
1720 | 1720 | |
|
1721 | 1721 | - make sure update of merge with removed largefiles fails as expected |
|
1722 | 1722 | $ hg rm sub2/large6 |
|
1723 | 1723 | $ hg up -r. |
|
1724 | 1724 | abort: outstanding uncommitted merge |
|
1725 | 1725 | [255] |
|
1726 | 1726 | |
|
1727 | 1727 | - revert should be able to revert files introduced in a pending merge |
|
1728 | 1728 | $ hg revert --all -r . |
|
1729 | 1729 | removing .hglf/large (glob) |
|
1730 | 1730 | undeleting .hglf/sub2/large6 (glob) |
|
1731 | 1731 | |
|
1732 | 1732 | Test that a normal file and a largefile with the same name and path cannot |
|
1733 | 1733 | coexist. |
|
1734 | 1734 | |
|
1735 | 1735 | $ rm sub2/large7 |
|
1736 | 1736 | $ echo "largeasnormal" > sub2/large7 |
|
1737 | 1737 | $ hg add sub2/large7 |
|
1738 | 1738 | sub2/large7 already a largefile (glob) |
|
1739 | 1739 | |
|
1740 | 1740 | Test that transplanting a largefile change works correctly. |
|
1741 | 1741 | |
|
1742 | 1742 | $ cd .. |
|
1743 | 1743 | $ hg clone -r 8 d g |
|
1744 | 1744 | adding changesets |
|
1745 | 1745 | adding manifests |
|
1746 | 1746 | adding file changes |
|
1747 | 1747 | added 9 changesets with 26 changes to 10 files |
|
1748 | 1748 | updating to branch default |
|
1749 | 1749 | getting changed largefiles |
|
1750 | 1750 | 3 largefiles updated, 0 removed |
|
1751 | 1751 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1752 | 1752 | $ cd g |
|
1753 | 1753 | $ hg transplant -s ../d 598410d3eb9a |
|
1754 | 1754 | searching for changes |
|
1755 | 1755 | searching for changes |
|
1756 | 1756 | adding changesets |
|
1757 | 1757 | adding manifests |
|
1758 | 1758 | adding file changes |
|
1759 | 1759 | added 1 changesets with 2 changes to 2 files |
|
1760 | 1760 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1761 | 1761 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1762 | 1762 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1763 | 1763 | 7:daea875e9014 add/edit more largefiles |
|
1764 | 1764 | 6:4355d653f84f edit files yet again |
|
1765 | 1765 | 5:9d5af5072dbd edit files again |
|
1766 | 1766 | 4:74c02385b94c move files |
|
1767 | 1767 | 3:9e8fbc4bce62 copy files |
|
1768 | 1768 | 2:51a0ae4d5864 remove files |
|
1769 | 1769 | 1:ce8896473775 edit files |
|
1770 | 1770 | 0:30d30fe6a5be add files |
|
1771 | 1771 | $ cat normal3 |
|
1772 | 1772 | normal3-modified |
|
1773 | 1773 | $ cat sub/normal4 |
|
1774 | 1774 | normal4-modified |
|
1775 | 1775 | $ cat sub/large4 |
|
1776 | 1776 | large4-modified |
|
1777 | 1777 | $ cat sub2/large6 |
|
1778 | 1778 | large6-modified |
|
1779 | 1779 | $ cat sub2/large7 |
|
1780 | 1780 | large7 |
|
1781 | 1781 | |
|
1782 | 1782 | Cat a largefile |
|
1783 | 1783 | $ hg cat normal3 |
|
1784 | 1784 | normal3-modified |
|
1785 | 1785 | $ hg cat sub/large4 |
|
1786 | 1786 | large4-modified |
|
1787 | 1787 | $ rm "${USERCACHE}"/* |
|
1788 | 1788 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 |
|
1789 | 1789 | $ cat cat.out |
|
1790 | 1790 | large4-modified |
|
1791 | 1791 | $ rm cat.out |
|
1792 | 1792 | $ hg cat -r a381d2c8c80e normal3 |
|
1793 | 1793 | normal3-modified |
|
1794 | 1794 | $ hg cat -r '.^' normal3 |
|
1795 | 1795 | normal3-modified |
|
1796 | 1796 | $ hg cat -r '.^' sub/large4 doesntexist |
|
1797 | 1797 | large4-modified |
|
1798 | 1798 | doesntexist: no such file in rev a381d2c8c80e |
|
1799 | 1799 | $ hg --cwd sub cat -r '.^' large4 |
|
1800 | 1800 | large4-modified |
|
1801 | 1801 | $ hg --cwd sub cat -r '.^' ../normal3 |
|
1802 | 1802 | normal3-modified |
|
1803 | 1803 | Cat a standin |
|
1804 | 1804 | $ hg cat .hglf/sub/large4 |
|
1805 | 1805 | e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1806 | 1806 | $ hg cat .hglf/normal3 |
|
1807 | 1807 | .hglf/normal3: no such file in rev 598410d3eb9a (glob) |
|
1808 | 1808 | [1] |
|
1809 | 1809 | |
|
1810 | 1810 | Test that renaming a largefile results in correct output for status |
|
1811 | 1811 | |
|
1812 | 1812 | $ hg rename sub/large4 large4-renamed |
|
1813 | 1813 | $ hg commit -m "test rename output" |
|
1814 | 1814 | Invoking status precommit hook |
|
1815 | 1815 | A large4-renamed |
|
1816 | 1816 | R sub/large4 |
|
1817 | 1817 | $ cat large4-renamed |
|
1818 | 1818 | large4-modified |
|
1819 | 1819 | $ cd sub2 |
|
1820 | 1820 | $ hg rename large6 large6-renamed |
|
1821 | 1821 | $ hg st |
|
1822 | 1822 | A sub2/large6-renamed |
|
1823 | 1823 | R sub2/large6 |
|
1824 | 1824 | $ cd .. |
|
1825 | 1825 | |
|
1826 | 1826 | Test --normal flag |
|
1827 | 1827 | |
|
1828 | 1828 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null |
|
1829 | 1829 | $ hg add --normal --large new-largefile |
|
1830 | 1830 | abort: --normal cannot be used with --large |
|
1831 | 1831 | [255] |
|
1832 | 1832 | $ hg add --normal new-largefile |
|
1833 | 1833 | new-largefile: up to 69 MB of RAM may be required to manage this file |
|
1834 | 1834 | (use 'hg revert new-largefile' to cancel the pending addition) |
|
1835 | 1835 | |
|
1836 | 1836 | Test explicit commit of switch between normal and largefile - make sure both |
|
1837 | 1837 | the add and the remove is committed. |
|
1838 | 1838 | |
|
1839 | 1839 | $ hg up -qC |
|
1840 | 1840 | $ hg forget normal3 large4-renamed |
|
1841 | 1841 | $ hg add --large normal3 |
|
1842 | 1842 | $ hg add large4-renamed |
|
1843 | 1843 | $ hg commit -m 'swap' normal3 large4-renamed |
|
1844 | 1844 | Invoking status precommit hook |
|
1845 | 1845 | A large4-renamed |
|
1846 | 1846 | A normal3 |
|
1847 | 1847 | ? new-largefile |
|
1848 | 1848 | ? sub2/large6-renamed |
|
1849 | 1849 | $ hg mani |
|
1850 | 1850 | .hglf/normal3 |
|
1851 | 1851 | .hglf/sub2/large6 |
|
1852 | 1852 | .hglf/sub2/large7 |
|
1853 | normal3 | |
|
1853 | large4-renamed | |
|
1854 | 1854 | sub/normal4 |
|
1855 | 1855 | |
|
1856 | 1856 | $ cd .. |
|
1857 | 1857 | |
|
1858 | 1858 | |
|
1859 | 1859 |
General Comments 0
You need to be logged in to leave comments.
Login now