##// END OF EJS Templates
largefiles: align rm warnings with warnings used in core
Mads Kiilerich -
r18066:abe9799a default
parent child Browse files
Show More
@@ -1,1129 +1,1131 b''
1 # Copyright 2009-2010 Gregory P. Ward
1 # Copyright 2009-2010 Gregory P. Ward
2 # Copyright 2009-2010 Intelerad Medical Systems Incorporated
2 # Copyright 2009-2010 Intelerad Medical Systems Incorporated
3 # Copyright 2010-2011 Fog Creek Software
3 # Copyright 2010-2011 Fog Creek Software
4 # Copyright 2010-2011 Unity Technologies
4 # Copyright 2010-2011 Unity Technologies
5 #
5 #
6 # This software may be used and distributed according to the terms of the
6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version.
7 # GNU General Public License version 2 or any later version.
8
8
9 '''Overridden Mercurial commands and functions for the largefiles extension'''
9 '''Overridden Mercurial commands and functions for the largefiles extension'''
10
10
11 import os
11 import os
12 import copy
12 import copy
13
13
14 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
14 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
15 node, archival, error, merge
15 node, archival, error, merge
16 from mercurial.i18n import _
16 from mercurial.i18n import _
17 from mercurial.node import hex
17 from mercurial.node import hex
18 from hgext import rebase
18 from hgext import rebase
19
19
20 import lfutil
20 import lfutil
21 import lfcommands
21 import lfcommands
22
22
23 # -- Utility functions: commonly/repeatedly needed functionality ---------------
23 # -- Utility functions: commonly/repeatedly needed functionality ---------------
24
24
25 def installnormalfilesmatchfn(manifest):
25 def installnormalfilesmatchfn(manifest):
26 '''overrides scmutil.match so that the matcher it returns will ignore all
26 '''overrides scmutil.match so that the matcher it returns will ignore all
27 largefiles'''
27 largefiles'''
28 oldmatch = None # for the closure
28 oldmatch = None # for the closure
29 def overridematch(ctx, pats=[], opts={}, globbed=False,
29 def overridematch(ctx, pats=[], opts={}, globbed=False,
30 default='relpath'):
30 default='relpath'):
31 match = oldmatch(ctx, pats, opts, globbed, default)
31 match = oldmatch(ctx, pats, opts, globbed, default)
32 m = copy.copy(match)
32 m = copy.copy(match)
33 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
33 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
34 manifest)
34 manifest)
35 m._files = filter(notlfile, m._files)
35 m._files = filter(notlfile, m._files)
36 m._fmap = set(m._files)
36 m._fmap = set(m._files)
37 origmatchfn = m.matchfn
37 origmatchfn = m.matchfn
38 m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None
38 m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None
39 return m
39 return m
40 oldmatch = installmatchfn(overridematch)
40 oldmatch = installmatchfn(overridematch)
41
41
42 def installmatchfn(f):
42 def installmatchfn(f):
43 oldmatch = scmutil.match
43 oldmatch = scmutil.match
44 setattr(f, 'oldmatch', oldmatch)
44 setattr(f, 'oldmatch', oldmatch)
45 scmutil.match = f
45 scmutil.match = f
46 return oldmatch
46 return oldmatch
47
47
48 def restorematchfn():
48 def restorematchfn():
49 '''restores scmutil.match to what it was before installnormalfilesmatchfn
49 '''restores scmutil.match to what it was before installnormalfilesmatchfn
50 was called. no-op if scmutil.match is its original function.
50 was called. no-op if scmutil.match is its original function.
51
51
52 Note that n calls to installnormalfilesmatchfn will require n calls to
52 Note that n calls to installnormalfilesmatchfn will require n calls to
53 restore matchfn to reverse'''
53 restore matchfn to reverse'''
54 scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match)
54 scmutil.match = getattr(scmutil.match, 'oldmatch', scmutil.match)
55
55
56 def addlargefiles(ui, repo, *pats, **opts):
56 def addlargefiles(ui, repo, *pats, **opts):
57 large = opts.pop('large', None)
57 large = opts.pop('large', None)
58 lfsize = lfutil.getminsize(
58 lfsize = lfutil.getminsize(
59 ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
59 ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
60
60
61 lfmatcher = None
61 lfmatcher = None
62 if lfutil.islfilesrepo(repo):
62 if lfutil.islfilesrepo(repo):
63 lfpats = ui.configlist(lfutil.longname, 'patterns', default=[])
63 lfpats = ui.configlist(lfutil.longname, 'patterns', default=[])
64 if lfpats:
64 if lfpats:
65 lfmatcher = match_.match(repo.root, '', list(lfpats))
65 lfmatcher = match_.match(repo.root, '', list(lfpats))
66
66
67 lfnames = []
67 lfnames = []
68 m = scmutil.match(repo[None], pats, opts)
68 m = scmutil.match(repo[None], pats, opts)
69 m.bad = lambda x, y: None
69 m.bad = lambda x, y: None
70 wctx = repo[None]
70 wctx = repo[None]
71 for f in repo.walk(m):
71 for f in repo.walk(m):
72 exact = m.exact(f)
72 exact = m.exact(f)
73 lfile = lfutil.standin(f) in wctx
73 lfile = lfutil.standin(f) in wctx
74 nfile = f in wctx
74 nfile = f in wctx
75 exists = lfile or nfile
75 exists = lfile or nfile
76
76
77 # Don't warn the user when they attempt to add a normal tracked file.
77 # Don't warn the user when they attempt to add a normal tracked file.
78 # The normal add code will do that for us.
78 # The normal add code will do that for us.
79 if exact and exists:
79 if exact and exists:
80 if lfile:
80 if lfile:
81 ui.warn(_('%s already a largefile\n') % f)
81 ui.warn(_('%s already a largefile\n') % f)
82 continue
82 continue
83
83
84 if (exact or not exists) and not lfutil.isstandin(f):
84 if (exact or not exists) and not lfutil.isstandin(f):
85 wfile = repo.wjoin(f)
85 wfile = repo.wjoin(f)
86
86
87 # In case the file was removed previously, but not committed
87 # In case the file was removed previously, but not committed
88 # (issue3507)
88 # (issue3507)
89 if not os.path.exists(wfile):
89 if not os.path.exists(wfile):
90 continue
90 continue
91
91
92 abovemin = (lfsize and
92 abovemin = (lfsize and
93 os.lstat(wfile).st_size >= lfsize * 1024 * 1024)
93 os.lstat(wfile).st_size >= lfsize * 1024 * 1024)
94 if large or abovemin or (lfmatcher and lfmatcher(f)):
94 if large or abovemin or (lfmatcher and lfmatcher(f)):
95 lfnames.append(f)
95 lfnames.append(f)
96 if ui.verbose or not exact:
96 if ui.verbose or not exact:
97 ui.status(_('adding %s as a largefile\n') % m.rel(f))
97 ui.status(_('adding %s as a largefile\n') % m.rel(f))
98
98
99 bad = []
99 bad = []
100 standins = []
100 standins = []
101
101
102 # Need to lock, otherwise there could be a race condition between
102 # Need to lock, otherwise there could be a race condition between
103 # when standins are created and added to the repo.
103 # when standins are created and added to the repo.
104 wlock = repo.wlock()
104 wlock = repo.wlock()
105 try:
105 try:
106 if not opts.get('dry_run'):
106 if not opts.get('dry_run'):
107 lfdirstate = lfutil.openlfdirstate(ui, repo)
107 lfdirstate = lfutil.openlfdirstate(ui, repo)
108 for f in lfnames:
108 for f in lfnames:
109 standinname = lfutil.standin(f)
109 standinname = lfutil.standin(f)
110 lfutil.writestandin(repo, standinname, hash='',
110 lfutil.writestandin(repo, standinname, hash='',
111 executable=lfutil.getexecutable(repo.wjoin(f)))
111 executable=lfutil.getexecutable(repo.wjoin(f)))
112 standins.append(standinname)
112 standins.append(standinname)
113 if lfdirstate[f] == 'r':
113 if lfdirstate[f] == 'r':
114 lfdirstate.normallookup(f)
114 lfdirstate.normallookup(f)
115 else:
115 else:
116 lfdirstate.add(f)
116 lfdirstate.add(f)
117 lfdirstate.write()
117 lfdirstate.write()
118 bad += [lfutil.splitstandin(f)
118 bad += [lfutil.splitstandin(f)
119 for f in lfutil.repoadd(repo, standins)
119 for f in lfutil.repoadd(repo, standins)
120 if f in m.files()]
120 if f in m.files()]
121 finally:
121 finally:
122 wlock.release()
122 wlock.release()
123 return bad
123 return bad
124
124
125 def removelargefiles(ui, repo, *pats, **opts):
125 def removelargefiles(ui, repo, *pats, **opts):
126 after = opts.get('after')
126 after = opts.get('after')
127 if not pats and not after:
127 if not pats and not after:
128 raise util.Abort(_('no files specified'))
128 raise util.Abort(_('no files specified'))
129 m = scmutil.match(repo[None], pats, opts)
129 m = scmutil.match(repo[None], pats, opts)
130 try:
130 try:
131 repo.lfstatus = True
131 repo.lfstatus = True
132 s = repo.status(match=m, clean=True)
132 s = repo.status(match=m, clean=True)
133 finally:
133 finally:
134 repo.lfstatus = False
134 repo.lfstatus = False
135 manifest = repo[None].manifest()
135 manifest = repo[None].manifest()
136 modified, added, deleted, clean = [[f for f in list
136 modified, added, deleted, clean = [[f for f in list
137 if lfutil.standin(f) in manifest]
137 if lfutil.standin(f) in manifest]
138 for list in [s[0], s[1], s[3], s[6]]]
138 for list in [s[0], s[1], s[3], s[6]]]
139
139
140 def warn(files, reason):
140 def warn(files, msg):
141 for f in files:
141 for f in files:
142 ui.warn(_('not removing %s: %s (use forget to undo)\n')
142 ui.warn(msg % m.rel(f))
143 % (m.rel(f), reason))
144 return int(len(files) > 0)
143 return int(len(files) > 0)
145
144
146 result = 0
145 result = 0
147
146
148 if after:
147 if after:
149 remove, forget = deleted, []
148 remove, forget = deleted, []
150 result = warn(modified + added + clean, _('file still exists'))
149 result = warn(modified + added + clean,
150 _('not removing %s: file still exists\n'))
151 else:
151 else:
152 remove, forget = deleted + clean, []
152 remove, forget = deleted + clean, []
153 result = warn(modified, _('file is modified'))
153 result = warn(modified, _('not removing %s: file is modified (use -f'
154 result = warn(added, _('file has been marked for add')) or result
154 ' to force removal)\n'))
155 result = warn(added, _('not removing %s: file has been marked for add'
156 ' (use forget to undo)\n')) or result
155
157
156 for f in sorted(remove + forget):
158 for f in sorted(remove + forget):
157 if ui.verbose or not m.exact(f):
159 if ui.verbose or not m.exact(f):
158 ui.status(_('removing %s\n') % m.rel(f))
160 ui.status(_('removing %s\n') % m.rel(f))
159
161
160 # Need to lock because standin files are deleted then removed from the
162 # Need to lock because standin files are deleted then removed from the
161 # repository and we could race in-between.
163 # repository and we could race in-between.
162 wlock = repo.wlock()
164 wlock = repo.wlock()
163 try:
165 try:
164 lfdirstate = lfutil.openlfdirstate(ui, repo)
166 lfdirstate = lfutil.openlfdirstate(ui, repo)
165 for f in remove:
167 for f in remove:
166 if not after:
168 if not after:
167 # If this is being called by addremove, notify the user that we
169 # If this is being called by addremove, notify the user that we
168 # are removing the file.
170 # are removing the file.
169 if getattr(repo, "_isaddremove", False):
171 if getattr(repo, "_isaddremove", False):
170 ui.status(_('removing %s\n') % f)
172 ui.status(_('removing %s\n') % f)
171 if os.path.exists(repo.wjoin(f)):
173 if os.path.exists(repo.wjoin(f)):
172 util.unlinkpath(repo.wjoin(f))
174 util.unlinkpath(repo.wjoin(f))
173 lfdirstate.remove(f)
175 lfdirstate.remove(f)
174 lfdirstate.write()
176 lfdirstate.write()
175 forget = [lfutil.standin(f) for f in forget]
177 forget = [lfutil.standin(f) for f in forget]
176 remove = [lfutil.standin(f) for f in remove]
178 remove = [lfutil.standin(f) for f in remove]
177 lfutil.repoforget(repo, forget)
179 lfutil.repoforget(repo, forget)
178 # If this is being called by addremove, let the original addremove
180 # If this is being called by addremove, let the original addremove
179 # function handle this.
181 # function handle this.
180 if not getattr(repo, "_isaddremove", False):
182 if not getattr(repo, "_isaddremove", False):
181 lfutil.reporemove(repo, remove, unlink=True)
183 lfutil.reporemove(repo, remove, unlink=True)
182 else:
184 else:
183 lfutil.reporemove(repo, remove, unlink=False)
185 lfutil.reporemove(repo, remove, unlink=False)
184 finally:
186 finally:
185 wlock.release()
187 wlock.release()
186
188
187 return result
189 return result
188
190
189 # For overriding mercurial.hgweb.webcommands so that largefiles will
191 # For overriding mercurial.hgweb.webcommands so that largefiles will
190 # appear at their right place in the manifests.
192 # appear at their right place in the manifests.
191 def decodepath(orig, path):
193 def decodepath(orig, path):
192 return lfutil.splitstandin(path) or path
194 return lfutil.splitstandin(path) or path
193
195
194 # -- Wrappers: modify existing commands --------------------------------
196 # -- Wrappers: modify existing commands --------------------------------
195
197
196 # Add works by going through the files that the user wanted to add and
198 # Add works by going through the files that the user wanted to add and
197 # checking if they should be added as largefiles. Then it makes a new
199 # checking if they should be added as largefiles. Then it makes a new
198 # matcher which matches only the normal files and runs the original
200 # matcher which matches only the normal files and runs the original
199 # version of add.
201 # version of add.
200 def overrideadd(orig, ui, repo, *pats, **opts):
202 def overrideadd(orig, ui, repo, *pats, **opts):
201 normal = opts.pop('normal')
203 normal = opts.pop('normal')
202 if normal:
204 if normal:
203 if opts.get('large'):
205 if opts.get('large'):
204 raise util.Abort(_('--normal cannot be used with --large'))
206 raise util.Abort(_('--normal cannot be used with --large'))
205 return orig(ui, repo, *pats, **opts)
207 return orig(ui, repo, *pats, **opts)
206 bad = addlargefiles(ui, repo, *pats, **opts)
208 bad = addlargefiles(ui, repo, *pats, **opts)
207 installnormalfilesmatchfn(repo[None].manifest())
209 installnormalfilesmatchfn(repo[None].manifest())
208 result = orig(ui, repo, *pats, **opts)
210 result = orig(ui, repo, *pats, **opts)
209 restorematchfn()
211 restorematchfn()
210
212
211 return (result == 1 or bad) and 1 or 0
213 return (result == 1 or bad) and 1 or 0
212
214
213 def overrideremove(orig, ui, repo, *pats, **opts):
215 def overrideremove(orig, ui, repo, *pats, **opts):
214 installnormalfilesmatchfn(repo[None].manifest())
216 installnormalfilesmatchfn(repo[None].manifest())
215 result = orig(ui, repo, *pats, **opts)
217 result = orig(ui, repo, *pats, **opts)
216 restorematchfn()
218 restorematchfn()
217 return removelargefiles(ui, repo, *pats, **opts) or result
219 return removelargefiles(ui, repo, *pats, **opts) or result
218
220
219 def overridestatusfn(orig, repo, rev2, **opts):
221 def overridestatusfn(orig, repo, rev2, **opts):
220 try:
222 try:
221 repo._repo.lfstatus = True
223 repo._repo.lfstatus = True
222 return orig(repo, rev2, **opts)
224 return orig(repo, rev2, **opts)
223 finally:
225 finally:
224 repo._repo.lfstatus = False
226 repo._repo.lfstatus = False
225
227
226 def overridestatus(orig, ui, repo, *pats, **opts):
228 def overridestatus(orig, ui, repo, *pats, **opts):
227 try:
229 try:
228 repo.lfstatus = True
230 repo.lfstatus = True
229 return orig(ui, repo, *pats, **opts)
231 return orig(ui, repo, *pats, **opts)
230 finally:
232 finally:
231 repo.lfstatus = False
233 repo.lfstatus = False
232
234
233 def overridedirty(orig, repo, ignoreupdate=False):
235 def overridedirty(orig, repo, ignoreupdate=False):
234 try:
236 try:
235 repo._repo.lfstatus = True
237 repo._repo.lfstatus = True
236 return orig(repo, ignoreupdate)
238 return orig(repo, ignoreupdate)
237 finally:
239 finally:
238 repo._repo.lfstatus = False
240 repo._repo.lfstatus = False
239
241
240 def overridelog(orig, ui, repo, *pats, **opts):
242 def overridelog(orig, ui, repo, *pats, **opts):
241 try:
243 try:
242 repo.lfstatus = True
244 repo.lfstatus = True
243 return orig(ui, repo, *pats, **opts)
245 return orig(ui, repo, *pats, **opts)
244 finally:
246 finally:
245 repo.lfstatus = False
247 repo.lfstatus = False
246
248
247 def overrideverify(orig, ui, repo, *pats, **opts):
249 def overrideverify(orig, ui, repo, *pats, **opts):
248 large = opts.pop('large', False)
250 large = opts.pop('large', False)
249 all = opts.pop('lfa', False)
251 all = opts.pop('lfa', False)
250 contents = opts.pop('lfc', False)
252 contents = opts.pop('lfc', False)
251
253
252 result = orig(ui, repo, *pats, **opts)
254 result = orig(ui, repo, *pats, **opts)
253 if large:
255 if large:
254 result = result or lfcommands.verifylfiles(ui, repo, all, contents)
256 result = result or lfcommands.verifylfiles(ui, repo, all, contents)
255 return result
257 return result
256
258
257 # Override needs to refresh standins so that update's normal merge
259 # Override needs to refresh standins so that update's normal merge
258 # will go through properly. Then the other update hook (overriding repo.update)
260 # will go through properly. Then the other update hook (overriding repo.update)
259 # will get the new files. Filemerge is also overridden so that the merge
261 # will get the new files. Filemerge is also overridden so that the merge
260 # will merge standins correctly.
262 # will merge standins correctly.
261 def overrideupdate(orig, ui, repo, *pats, **opts):
263 def overrideupdate(orig, ui, repo, *pats, **opts):
262 lfdirstate = lfutil.openlfdirstate(ui, repo)
264 lfdirstate = lfutil.openlfdirstate(ui, repo)
263 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
265 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
264 False, False)
266 False, False)
265 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
267 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
266
268
267 # Need to lock between the standins getting updated and their
269 # Need to lock between the standins getting updated and their
268 # largefiles getting updated
270 # largefiles getting updated
269 wlock = repo.wlock()
271 wlock = repo.wlock()
270 try:
272 try:
271 if opts['check']:
273 if opts['check']:
272 mod = len(modified) > 0
274 mod = len(modified) > 0
273 for lfile in unsure:
275 for lfile in unsure:
274 standin = lfutil.standin(lfile)
276 standin = lfutil.standin(lfile)
275 if repo['.'][standin].data().strip() != \
277 if repo['.'][standin].data().strip() != \
276 lfutil.hashfile(repo.wjoin(lfile)):
278 lfutil.hashfile(repo.wjoin(lfile)):
277 mod = True
279 mod = True
278 else:
280 else:
279 lfdirstate.normal(lfile)
281 lfdirstate.normal(lfile)
280 lfdirstate.write()
282 lfdirstate.write()
281 if mod:
283 if mod:
282 raise util.Abort(_('uncommitted local changes'))
284 raise util.Abort(_('uncommitted local changes'))
283 # XXX handle removed differently
285 # XXX handle removed differently
284 if not opts['clean']:
286 if not opts['clean']:
285 for lfile in unsure + modified + added:
287 for lfile in unsure + modified + added:
286 lfutil.updatestandin(repo, lfutil.standin(lfile))
288 lfutil.updatestandin(repo, lfutil.standin(lfile))
287 finally:
289 finally:
288 wlock.release()
290 wlock.release()
289 return orig(ui, repo, *pats, **opts)
291 return orig(ui, repo, *pats, **opts)
290
292
291 # Before starting the manifest merge, merge.updates will call
293 # Before starting the manifest merge, merge.updates will call
292 # _checkunknown to check if there are any files in the merged-in
294 # _checkunknown to check if there are any files in the merged-in
293 # changeset that collide with unknown files in the working copy.
295 # changeset that collide with unknown files in the working copy.
294 #
296 #
295 # The largefiles are seen as unknown, so this prevents us from merging
297 # The largefiles are seen as unknown, so this prevents us from merging
296 # in a file 'foo' if we already have a largefile with the same name.
298 # in a file 'foo' if we already have a largefile with the same name.
297 #
299 #
298 # The overridden function filters the unknown files by removing any
300 # The overridden function filters the unknown files by removing any
299 # largefiles. This makes the merge proceed and we can then handle this
301 # largefiles. This makes the merge proceed and we can then handle this
300 # case further in the overridden manifestmerge function below.
302 # case further in the overridden manifestmerge function below.
301 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
303 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
302 if lfutil.standin(f) in wctx:
304 if lfutil.standin(f) in wctx:
303 return False
305 return False
304 return origfn(repo, wctx, mctx, f)
306 return origfn(repo, wctx, mctx, f)
305
307
306 # The manifest merge handles conflicts on the manifest level. We want
308 # The manifest merge handles conflicts on the manifest level. We want
307 # to handle changes in largefile-ness of files at this level too.
309 # to handle changes in largefile-ness of files at this level too.
308 #
310 #
309 # The strategy is to run the original manifestmerge and then process
311 # The strategy is to run the original manifestmerge and then process
310 # the action list it outputs. There are two cases we need to deal with:
312 # the action list it outputs. There are two cases we need to deal with:
311 #
313 #
312 # 1. Normal file in p1, largefile in p2. Here the largefile is
314 # 1. Normal file in p1, largefile in p2. Here the largefile is
313 # detected via its standin file, which will enter the working copy
315 # detected via its standin file, which will enter the working copy
314 # with a "get" action. It is not "merge" since the standin is all
316 # with a "get" action. It is not "merge" since the standin is all
315 # Mercurial is concerned with at this level -- the link to the
317 # Mercurial is concerned with at this level -- the link to the
316 # existing normal file is not relevant here.
318 # existing normal file is not relevant here.
317 #
319 #
318 # 2. Largefile in p1, normal file in p2. Here we get a "merge" action
320 # 2. Largefile in p1, normal file in p2. Here we get a "merge" action
319 # since the largefile will be present in the working copy and
321 # since the largefile will be present in the working copy and
320 # different from the normal file in p2. Mercurial therefore
322 # different from the normal file in p2. Mercurial therefore
321 # triggers a merge action.
323 # triggers a merge action.
322 #
324 #
323 # In both cases, we prompt the user and emit new actions to either
325 # In both cases, we prompt the user and emit new actions to either
324 # remove the standin (if the normal file was kept) or to remove the
326 # remove the standin (if the normal file was kept) or to remove the
325 # normal file and get the standin (if the largefile was kept). The
327 # normal file and get the standin (if the largefile was kept). The
326 # default prompt answer is to use the largefile version since it was
328 # default prompt answer is to use the largefile version since it was
327 # presumably changed on purpose.
329 # presumably changed on purpose.
328 #
330 #
329 # Finally, the merge.applyupdates function will then take care of
331 # Finally, the merge.applyupdates function will then take care of
330 # writing the files into the working copy and lfcommands.updatelfiles
332 # writing the files into the working copy and lfcommands.updatelfiles
331 # will update the largefiles.
333 # will update the largefiles.
332 def overridemanifestmerge(origfn, repo, p1, p2, pa, overwrite, partial):
334 def overridemanifestmerge(origfn, repo, p1, p2, pa, overwrite, partial):
333 actions = origfn(repo, p1, p2, pa, overwrite, partial)
335 actions = origfn(repo, p1, p2, pa, overwrite, partial)
334 processed = []
336 processed = []
335
337
336 for action in actions:
338 for action in actions:
337 if overwrite:
339 if overwrite:
338 processed.append(action)
340 processed.append(action)
339 continue
341 continue
340 f, m = action[:2]
342 f, m = action[:2]
341
343
342 choices = (_('&Largefile'), _('&Normal file'))
344 choices = (_('&Largefile'), _('&Normal file'))
343 if m == "g" and lfutil.splitstandin(f) in p1 and f in p2:
345 if m == "g" and lfutil.splitstandin(f) in p1 and f in p2:
344 # Case 1: normal file in the working copy, largefile in
346 # Case 1: normal file in the working copy, largefile in
345 # the second parent
347 # the second parent
346 lfile = lfutil.splitstandin(f)
348 lfile = lfutil.splitstandin(f)
347 standin = f
349 standin = f
348 msg = _('%s has been turned into a largefile\n'
350 msg = _('%s has been turned into a largefile\n'
349 'use (l)argefile or keep as (n)ormal file?') % lfile
351 'use (l)argefile or keep as (n)ormal file?') % lfile
350 if repo.ui.promptchoice(msg, choices, 0) == 0:
352 if repo.ui.promptchoice(msg, choices, 0) == 0:
351 processed.append((lfile, "r"))
353 processed.append((lfile, "r"))
352 processed.append((standin, "g", p2.flags(standin)))
354 processed.append((standin, "g", p2.flags(standin)))
353 else:
355 else:
354 processed.append((standin, "r"))
356 processed.append((standin, "r"))
355 elif m == "g" and lfutil.standin(f) in p1 and f in p2:
357 elif m == "g" and lfutil.standin(f) in p1 and f in p2:
356 # Case 2: largefile in the working copy, normal file in
358 # Case 2: largefile in the working copy, normal file in
357 # the second parent
359 # the second parent
358 standin = lfutil.standin(f)
360 standin = lfutil.standin(f)
359 lfile = f
361 lfile = f
360 msg = _('%s has been turned into a normal file\n'
362 msg = _('%s has been turned into a normal file\n'
361 'keep as (l)argefile or use (n)ormal file?') % lfile
363 'keep as (l)argefile or use (n)ormal file?') % lfile
362 if repo.ui.promptchoice(msg, choices, 0) == 0:
364 if repo.ui.promptchoice(msg, choices, 0) == 0:
363 processed.append((lfile, "r"))
365 processed.append((lfile, "r"))
364 else:
366 else:
365 processed.append((standin, "r"))
367 processed.append((standin, "r"))
366 processed.append((lfile, "g", p2.flags(lfile)))
368 processed.append((lfile, "g", p2.flags(lfile)))
367 else:
369 else:
368 processed.append(action)
370 processed.append(action)
369
371
370 return processed
372 return processed
371
373
372 # Override filemerge to prompt the user about how they wish to merge
374 # Override filemerge to prompt the user about how they wish to merge
373 # largefiles. This will handle identical edits, and copy/rename +
375 # largefiles. This will handle identical edits, and copy/rename +
374 # edit without prompting the user.
376 # edit without prompting the user.
375 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
377 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca):
376 # Use better variable names here. Because this is a wrapper we cannot
378 # Use better variable names here. Because this is a wrapper we cannot
377 # change the variable names in the function declaration.
379 # change the variable names in the function declaration.
378 fcdest, fcother, fcancestor = fcd, fco, fca
380 fcdest, fcother, fcancestor = fcd, fco, fca
379 if not lfutil.isstandin(orig):
381 if not lfutil.isstandin(orig):
380 return origfn(repo, mynode, orig, fcdest, fcother, fcancestor)
382 return origfn(repo, mynode, orig, fcdest, fcother, fcancestor)
381 else:
383 else:
382 if not fcother.cmp(fcdest): # files identical?
384 if not fcother.cmp(fcdest): # files identical?
383 return None
385 return None
384
386
385 # backwards, use working dir parent as ancestor
387 # backwards, use working dir parent as ancestor
386 if fcancestor == fcother:
388 if fcancestor == fcother:
387 fcancestor = fcdest.parents()[0]
389 fcancestor = fcdest.parents()[0]
388
390
389 if orig != fcother.path():
391 if orig != fcother.path():
390 repo.ui.status(_('merging %s and %s to %s\n')
392 repo.ui.status(_('merging %s and %s to %s\n')
391 % (lfutil.splitstandin(orig),
393 % (lfutil.splitstandin(orig),
392 lfutil.splitstandin(fcother.path()),
394 lfutil.splitstandin(fcother.path()),
393 lfutil.splitstandin(fcdest.path())))
395 lfutil.splitstandin(fcdest.path())))
394 else:
396 else:
395 repo.ui.status(_('merging %s\n')
397 repo.ui.status(_('merging %s\n')
396 % lfutil.splitstandin(fcdest.path()))
398 % lfutil.splitstandin(fcdest.path()))
397
399
398 if fcancestor.path() != fcother.path() and fcother.data() == \
400 if fcancestor.path() != fcother.path() and fcother.data() == \
399 fcancestor.data():
401 fcancestor.data():
400 return 0
402 return 0
401 if fcancestor.path() != fcdest.path() and fcdest.data() == \
403 if fcancestor.path() != fcdest.path() and fcdest.data() == \
402 fcancestor.data():
404 fcancestor.data():
403 repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
405 repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
404 return 0
406 return 0
405
407
406 if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
408 if repo.ui.promptchoice(_('largefile %s has a merge conflict\n'
407 'keep (l)ocal or take (o)ther?') %
409 'keep (l)ocal or take (o)ther?') %
408 lfutil.splitstandin(orig),
410 lfutil.splitstandin(orig),
409 (_('&Local'), _('&Other')), 0) == 0:
411 (_('&Local'), _('&Other')), 0) == 0:
410 return 0
412 return 0
411 else:
413 else:
412 repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
414 repo.wwrite(fcdest.path(), fcother.data(), fcother.flags())
413 return 0
415 return 0
414
416
415 # Copy first changes the matchers to match standins instead of
417 # Copy first changes the matchers to match standins instead of
416 # largefiles. Then it overrides util.copyfile in that function it
418 # largefiles. Then it overrides util.copyfile in that function it
417 # checks if the destination largefile already exists. It also keeps a
419 # checks if the destination largefile already exists. It also keeps a
418 # list of copied files so that the largefiles can be copied and the
420 # list of copied files so that the largefiles can be copied and the
419 # dirstate updated.
421 # dirstate updated.
420 def overridecopy(orig, ui, repo, pats, opts, rename=False):
422 def overridecopy(orig, ui, repo, pats, opts, rename=False):
421 # doesn't remove largefile on rename
423 # doesn't remove largefile on rename
422 if len(pats) < 2:
424 if len(pats) < 2:
423 # this isn't legal, let the original function deal with it
425 # this isn't legal, let the original function deal with it
424 return orig(ui, repo, pats, opts, rename)
426 return orig(ui, repo, pats, opts, rename)
425
427
426 def makestandin(relpath):
428 def makestandin(relpath):
427 path = scmutil.canonpath(repo.root, repo.getcwd(), relpath)
429 path = scmutil.canonpath(repo.root, repo.getcwd(), relpath)
428 return os.path.join(repo.wjoin(lfutil.standin(path)))
430 return os.path.join(repo.wjoin(lfutil.standin(path)))
429
431
430 fullpats = scmutil.expandpats(pats)
432 fullpats = scmutil.expandpats(pats)
431 dest = fullpats[-1]
433 dest = fullpats[-1]
432
434
433 if os.path.isdir(dest):
435 if os.path.isdir(dest):
434 if not os.path.isdir(makestandin(dest)):
436 if not os.path.isdir(makestandin(dest)):
435 os.makedirs(makestandin(dest))
437 os.makedirs(makestandin(dest))
436 # This could copy both lfiles and normal files in one command,
438 # This could copy both lfiles and normal files in one command,
437 # but we don't want to do that. First replace their matcher to
439 # but we don't want to do that. First replace their matcher to
438 # only match normal files and run it, then replace it to just
440 # only match normal files and run it, then replace it to just
439 # match largefiles and run it again.
441 # match largefiles and run it again.
440 nonormalfiles = False
442 nonormalfiles = False
441 nolfiles = False
443 nolfiles = False
442 try:
444 try:
443 try:
445 try:
444 installnormalfilesmatchfn(repo[None].manifest())
446 installnormalfilesmatchfn(repo[None].manifest())
445 result = orig(ui, repo, pats, opts, rename)
447 result = orig(ui, repo, pats, opts, rename)
446 except util.Abort, e:
448 except util.Abort, e:
447 if str(e) != _('no files to copy'):
449 if str(e) != _('no files to copy'):
448 raise e
450 raise e
449 else:
451 else:
450 nonormalfiles = True
452 nonormalfiles = True
451 result = 0
453 result = 0
452 finally:
454 finally:
453 restorematchfn()
455 restorematchfn()
454
456
455 # The first rename can cause our current working directory to be removed.
457 # The first rename can cause our current working directory to be removed.
456 # In that case there is nothing left to copy/rename so just quit.
458 # In that case there is nothing left to copy/rename so just quit.
457 try:
459 try:
458 repo.getcwd()
460 repo.getcwd()
459 except OSError:
461 except OSError:
460 return result
462 return result
461
463
462 try:
464 try:
463 try:
465 try:
464 # When we call orig below it creates the standins but we don't add
466 # When we call orig below it creates the standins but we don't add
465 # them to the dir state until later so lock during that time.
467 # them to the dir state until later so lock during that time.
466 wlock = repo.wlock()
468 wlock = repo.wlock()
467
469
468 manifest = repo[None].manifest()
470 manifest = repo[None].manifest()
469 oldmatch = None # for the closure
471 oldmatch = None # for the closure
470 def overridematch(ctx, pats=[], opts={}, globbed=False,
472 def overridematch(ctx, pats=[], opts={}, globbed=False,
471 default='relpath'):
473 default='relpath'):
472 newpats = []
474 newpats = []
473 # The patterns were previously mangled to add the standin
475 # The patterns were previously mangled to add the standin
474 # directory; we need to remove that now
476 # directory; we need to remove that now
475 for pat in pats:
477 for pat in pats:
476 if match_.patkind(pat) is None and lfutil.shortname in pat:
478 if match_.patkind(pat) is None and lfutil.shortname in pat:
477 newpats.append(pat.replace(lfutil.shortname, ''))
479 newpats.append(pat.replace(lfutil.shortname, ''))
478 else:
480 else:
479 newpats.append(pat)
481 newpats.append(pat)
480 match = oldmatch(ctx, newpats, opts, globbed, default)
482 match = oldmatch(ctx, newpats, opts, globbed, default)
481 m = copy.copy(match)
483 m = copy.copy(match)
482 lfile = lambda f: lfutil.standin(f) in manifest
484 lfile = lambda f: lfutil.standin(f) in manifest
483 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
485 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
484 m._fmap = set(m._files)
486 m._fmap = set(m._files)
485 origmatchfn = m.matchfn
487 origmatchfn = m.matchfn
486 m.matchfn = lambda f: (lfutil.isstandin(f) and
488 m.matchfn = lambda f: (lfutil.isstandin(f) and
487 (f in manifest) and
489 (f in manifest) and
488 origmatchfn(lfutil.splitstandin(f)) or
490 origmatchfn(lfutil.splitstandin(f)) or
489 None)
491 None)
490 return m
492 return m
491 oldmatch = installmatchfn(overridematch)
493 oldmatch = installmatchfn(overridematch)
492 listpats = []
494 listpats = []
493 for pat in pats:
495 for pat in pats:
494 if match_.patkind(pat) is not None:
496 if match_.patkind(pat) is not None:
495 listpats.append(pat)
497 listpats.append(pat)
496 else:
498 else:
497 listpats.append(makestandin(pat))
499 listpats.append(makestandin(pat))
498
500
499 try:
501 try:
500 origcopyfile = util.copyfile
502 origcopyfile = util.copyfile
501 copiedfiles = []
503 copiedfiles = []
502 def overridecopyfile(src, dest):
504 def overridecopyfile(src, dest):
503 if (lfutil.shortname in src and
505 if (lfutil.shortname in src and
504 dest.startswith(repo.wjoin(lfutil.shortname))):
506 dest.startswith(repo.wjoin(lfutil.shortname))):
505 destlfile = dest.replace(lfutil.shortname, '')
507 destlfile = dest.replace(lfutil.shortname, '')
506 if not opts['force'] and os.path.exists(destlfile):
508 if not opts['force'] and os.path.exists(destlfile):
507 raise IOError('',
509 raise IOError('',
508 _('destination largefile already exists'))
510 _('destination largefile already exists'))
509 copiedfiles.append((src, dest))
511 copiedfiles.append((src, dest))
510 origcopyfile(src, dest)
512 origcopyfile(src, dest)
511
513
512 util.copyfile = overridecopyfile
514 util.copyfile = overridecopyfile
513 result += orig(ui, repo, listpats, opts, rename)
515 result += orig(ui, repo, listpats, opts, rename)
514 finally:
516 finally:
515 util.copyfile = origcopyfile
517 util.copyfile = origcopyfile
516
518
517 lfdirstate = lfutil.openlfdirstate(ui, repo)
519 lfdirstate = lfutil.openlfdirstate(ui, repo)
518 for (src, dest) in copiedfiles:
520 for (src, dest) in copiedfiles:
519 if (lfutil.shortname in src and
521 if (lfutil.shortname in src and
520 dest.startswith(repo.wjoin(lfutil.shortname))):
522 dest.startswith(repo.wjoin(lfutil.shortname))):
521 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
523 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
522 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
524 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
523 destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
525 destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
524 if not os.path.isdir(destlfiledir):
526 if not os.path.isdir(destlfiledir):
525 os.makedirs(destlfiledir)
527 os.makedirs(destlfiledir)
526 if rename:
528 if rename:
527 os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
529 os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
528 lfdirstate.remove(srclfile)
530 lfdirstate.remove(srclfile)
529 else:
531 else:
530 util.copyfile(repo.wjoin(srclfile),
532 util.copyfile(repo.wjoin(srclfile),
531 repo.wjoin(destlfile))
533 repo.wjoin(destlfile))
532
534
533 lfdirstate.add(destlfile)
535 lfdirstate.add(destlfile)
534 lfdirstate.write()
536 lfdirstate.write()
535 except util.Abort, e:
537 except util.Abort, e:
536 if str(e) != _('no files to copy'):
538 if str(e) != _('no files to copy'):
537 raise e
539 raise e
538 else:
540 else:
539 nolfiles = True
541 nolfiles = True
540 finally:
542 finally:
541 restorematchfn()
543 restorematchfn()
542 wlock.release()
544 wlock.release()
543
545
544 if nolfiles and nonormalfiles:
546 if nolfiles and nonormalfiles:
545 raise util.Abort(_('no files to copy'))
547 raise util.Abort(_('no files to copy'))
546
548
547 return result
549 return result
548
550
549 # When the user calls revert, we have to be careful to not revert any
551 # When the user calls revert, we have to be careful to not revert any
550 # changes to other largefiles accidentally. This means we have to keep
552 # changes to other largefiles accidentally. This means we have to keep
551 # track of the largefiles that are being reverted so we only pull down
553 # track of the largefiles that are being reverted so we only pull down
552 # the necessary largefiles.
554 # the necessary largefiles.
553 #
555 #
554 # Standins are only updated (to match the hash of largefiles) before
556 # Standins are only updated (to match the hash of largefiles) before
555 # commits. Update the standins then run the original revert, changing
557 # commits. Update the standins then run the original revert, changing
556 # the matcher to hit standins instead of largefiles. Based on the
558 # the matcher to hit standins instead of largefiles. Based on the
557 # resulting standins update the largefiles. Then return the standins
559 # resulting standins update the largefiles. Then return the standins
558 # to their proper state
560 # to their proper state
559 def overriderevert(orig, ui, repo, *pats, **opts):
561 def overriderevert(orig, ui, repo, *pats, **opts):
560 # Because we put the standins in a bad state (by updating them)
562 # Because we put the standins in a bad state (by updating them)
561 # and then return them to a correct state we need to lock to
563 # and then return them to a correct state we need to lock to
562 # prevent others from changing them in their incorrect state.
564 # prevent others from changing them in their incorrect state.
563 wlock = repo.wlock()
565 wlock = repo.wlock()
564 try:
566 try:
565 lfdirstate = lfutil.openlfdirstate(ui, repo)
567 lfdirstate = lfutil.openlfdirstate(ui, repo)
566 (modified, added, removed, missing, unknown, ignored, clean) = \
568 (modified, added, removed, missing, unknown, ignored, clean) = \
567 lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
569 lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
568 for lfile in modified:
570 for lfile in modified:
569 lfutil.updatestandin(repo, lfutil.standin(lfile))
571 lfutil.updatestandin(repo, lfutil.standin(lfile))
570 for lfile in missing:
572 for lfile in missing:
571 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
573 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
572 os.unlink(repo.wjoin(lfutil.standin(lfile)))
574 os.unlink(repo.wjoin(lfutil.standin(lfile)))
573
575
574 try:
576 try:
575 ctx = scmutil.revsingle(repo, opts.get('rev'))
577 ctx = scmutil.revsingle(repo, opts.get('rev'))
576 oldmatch = None # for the closure
578 oldmatch = None # for the closure
577 def overridematch(ctx, pats=[], opts={}, globbed=False,
579 def overridematch(ctx, pats=[], opts={}, globbed=False,
578 default='relpath'):
580 default='relpath'):
579 match = oldmatch(ctx, pats, opts, globbed, default)
581 match = oldmatch(ctx, pats, opts, globbed, default)
580 m = copy.copy(match)
582 m = copy.copy(match)
581 def tostandin(f):
583 def tostandin(f):
582 if lfutil.standin(f) in ctx:
584 if lfutil.standin(f) in ctx:
583 return lfutil.standin(f)
585 return lfutil.standin(f)
584 elif lfutil.standin(f) in repo[None]:
586 elif lfutil.standin(f) in repo[None]:
585 return None
587 return None
586 return f
588 return f
587 m._files = [tostandin(f) for f in m._files]
589 m._files = [tostandin(f) for f in m._files]
588 m._files = [f for f in m._files if f is not None]
590 m._files = [f for f in m._files if f is not None]
589 m._fmap = set(m._files)
591 m._fmap = set(m._files)
590 origmatchfn = m.matchfn
592 origmatchfn = m.matchfn
591 def matchfn(f):
593 def matchfn(f):
592 if lfutil.isstandin(f):
594 if lfutil.isstandin(f):
593 # We need to keep track of what largefiles are being
595 # We need to keep track of what largefiles are being
594 # matched so we know which ones to update later --
596 # matched so we know which ones to update later --
595 # otherwise we accidentally revert changes to other
597 # otherwise we accidentally revert changes to other
596 # largefiles. This is repo-specific, so duckpunch the
598 # largefiles. This is repo-specific, so duckpunch the
597 # repo object to keep the list of largefiles for us
599 # repo object to keep the list of largefiles for us
598 # later.
600 # later.
599 if origmatchfn(lfutil.splitstandin(f)) and \
601 if origmatchfn(lfutil.splitstandin(f)) and \
600 (f in repo[None] or f in ctx):
602 (f in repo[None] or f in ctx):
601 lfileslist = getattr(repo, '_lfilestoupdate', [])
603 lfileslist = getattr(repo, '_lfilestoupdate', [])
602 lfileslist.append(lfutil.splitstandin(f))
604 lfileslist.append(lfutil.splitstandin(f))
603 repo._lfilestoupdate = lfileslist
605 repo._lfilestoupdate = lfileslist
604 return True
606 return True
605 else:
607 else:
606 return False
608 return False
607 return origmatchfn(f)
609 return origmatchfn(f)
608 m.matchfn = matchfn
610 m.matchfn = matchfn
609 return m
611 return m
610 oldmatch = installmatchfn(overridematch)
612 oldmatch = installmatchfn(overridematch)
611 scmutil.match
613 scmutil.match
612 matches = overridematch(repo[None], pats, opts)
614 matches = overridematch(repo[None], pats, opts)
613 orig(ui, repo, *pats, **opts)
615 orig(ui, repo, *pats, **opts)
614 finally:
616 finally:
615 restorematchfn()
617 restorematchfn()
616 lfileslist = getattr(repo, '_lfilestoupdate', [])
618 lfileslist = getattr(repo, '_lfilestoupdate', [])
617 lfcommands.updatelfiles(ui, repo, filelist=lfileslist,
619 lfcommands.updatelfiles(ui, repo, filelist=lfileslist,
618 printmessage=False)
620 printmessage=False)
619
621
620 # empty out the largefiles list so we start fresh next time
622 # empty out the largefiles list so we start fresh next time
621 repo._lfilestoupdate = []
623 repo._lfilestoupdate = []
622 for lfile in modified:
624 for lfile in modified:
623 if lfile in lfileslist:
625 if lfile in lfileslist:
624 if os.path.exists(repo.wjoin(lfutil.standin(lfile))) and lfile\
626 if os.path.exists(repo.wjoin(lfutil.standin(lfile))) and lfile\
625 in repo['.']:
627 in repo['.']:
626 lfutil.writestandin(repo, lfutil.standin(lfile),
628 lfutil.writestandin(repo, lfutil.standin(lfile),
627 repo['.'][lfile].data().strip(),
629 repo['.'][lfile].data().strip(),
628 'x' in repo['.'][lfile].flags())
630 'x' in repo['.'][lfile].flags())
629 lfdirstate = lfutil.openlfdirstate(ui, repo)
631 lfdirstate = lfutil.openlfdirstate(ui, repo)
630 for lfile in added:
632 for lfile in added:
631 standin = lfutil.standin(lfile)
633 standin = lfutil.standin(lfile)
632 if standin not in ctx and (standin in matches or opts.get('all')):
634 if standin not in ctx and (standin in matches or opts.get('all')):
633 if lfile in lfdirstate:
635 if lfile in lfdirstate:
634 lfdirstate.drop(lfile)
636 lfdirstate.drop(lfile)
635 util.unlinkpath(repo.wjoin(standin))
637 util.unlinkpath(repo.wjoin(standin))
636 lfdirstate.write()
638 lfdirstate.write()
637 finally:
639 finally:
638 wlock.release()
640 wlock.release()
639
641
640 def hgupdate(orig, repo, node):
642 def hgupdate(orig, repo, node):
641 # Only call updatelfiles the standins that have changed to save time
643 # Only call updatelfiles the standins that have changed to save time
642 oldstandins = lfutil.getstandinsstate(repo)
644 oldstandins = lfutil.getstandinsstate(repo)
643 result = orig(repo, node)
645 result = orig(repo, node)
644 newstandins = lfutil.getstandinsstate(repo)
646 newstandins = lfutil.getstandinsstate(repo)
645 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
647 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
646 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True)
648 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True)
647 return result
649 return result
648
650
649 def hgclean(orig, repo, node, show_stats=True):
651 def hgclean(orig, repo, node, show_stats=True):
650 result = orig(repo, node, show_stats)
652 result = orig(repo, node, show_stats)
651 lfcommands.updatelfiles(repo.ui, repo)
653 lfcommands.updatelfiles(repo.ui, repo)
652 return result
654 return result
653
655
654 def hgmerge(orig, repo, node, force=None, remind=True):
656 def hgmerge(orig, repo, node, force=None, remind=True):
655 # Mark the repo as being in the middle of a merge, so that
657 # Mark the repo as being in the middle of a merge, so that
656 # updatelfiles() will know that it needs to trust the standins in
658 # updatelfiles() will know that it needs to trust the standins in
657 # the working copy, not in the standins in the current node
659 # the working copy, not in the standins in the current node
658 repo._ismerging = True
660 repo._ismerging = True
659 try:
661 try:
660 result = orig(repo, node, force, remind)
662 result = orig(repo, node, force, remind)
661 lfcommands.updatelfiles(repo.ui, repo)
663 lfcommands.updatelfiles(repo.ui, repo)
662 finally:
664 finally:
663 repo._ismerging = False
665 repo._ismerging = False
664 return result
666 return result
665
667
666 # When we rebase a repository with remotely changed largefiles, we need to
668 # When we rebase a repository with remotely changed largefiles, we need to
667 # take some extra care so that the largefiles are correctly updated in the
669 # take some extra care so that the largefiles are correctly updated in the
668 # working copy
670 # working copy
669 def overridepull(orig, ui, repo, source=None, **opts):
671 def overridepull(orig, ui, repo, source=None, **opts):
670 revsprepull = len(repo)
672 revsprepull = len(repo)
671 if opts.get('rebase', False):
673 if opts.get('rebase', False):
672 repo._isrebasing = True
674 repo._isrebasing = True
673 try:
675 try:
674 if opts.get('update'):
676 if opts.get('update'):
675 del opts['update']
677 del opts['update']
676 ui.debug('--update and --rebase are not compatible, ignoring '
678 ui.debug('--update and --rebase are not compatible, ignoring '
677 'the update flag\n')
679 'the update flag\n')
678 del opts['rebase']
680 del opts['rebase']
679 cmdutil.bailifchanged(repo)
681 cmdutil.bailifchanged(repo)
680 origpostincoming = commands.postincoming
682 origpostincoming = commands.postincoming
681 def _dummy(*args, **kwargs):
683 def _dummy(*args, **kwargs):
682 pass
684 pass
683 commands.postincoming = _dummy
685 commands.postincoming = _dummy
684 if not source:
686 if not source:
685 source = 'default'
687 source = 'default'
686 repo.lfpullsource = source
688 repo.lfpullsource = source
687 try:
689 try:
688 result = commands.pull(ui, repo, source, **opts)
690 result = commands.pull(ui, repo, source, **opts)
689 finally:
691 finally:
690 commands.postincoming = origpostincoming
692 commands.postincoming = origpostincoming
691 revspostpull = len(repo)
693 revspostpull = len(repo)
692 if revspostpull > revsprepull:
694 if revspostpull > revsprepull:
693 result = result or rebase.rebase(ui, repo)
695 result = result or rebase.rebase(ui, repo)
694 finally:
696 finally:
695 repo._isrebasing = False
697 repo._isrebasing = False
696 else:
698 else:
697 if not source:
699 if not source:
698 source = 'default'
700 source = 'default'
699 repo.lfpullsource = source
701 repo.lfpullsource = source
700 oldheads = lfutil.getcurrentheads(repo)
702 oldheads = lfutil.getcurrentheads(repo)
701 result = orig(ui, repo, source, **opts)
703 result = orig(ui, repo, source, **opts)
702 # If we do not have the new largefiles for any new heads we pulled, we
704 # If we do not have the new largefiles for any new heads we pulled, we
703 # will run into a problem later if we try to merge or rebase with one of
705 # will run into a problem later if we try to merge or rebase with one of
704 # these heads, so cache the largefiles now directly into the system
706 # these heads, so cache the largefiles now directly into the system
705 # cache.
707 # cache.
706 ui.status(_("caching new largefiles\n"))
708 ui.status(_("caching new largefiles\n"))
707 numcached = 0
709 numcached = 0
708 heads = lfutil.getcurrentheads(repo)
710 heads = lfutil.getcurrentheads(repo)
709 newheads = set(heads).difference(set(oldheads))
711 newheads = set(heads).difference(set(oldheads))
710 for head in newheads:
712 for head in newheads:
711 (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
713 (cached, missing) = lfcommands.cachelfiles(ui, repo, head)
712 numcached += len(cached)
714 numcached += len(cached)
713 ui.status(_("%d largefiles cached\n") % numcached)
715 ui.status(_("%d largefiles cached\n") % numcached)
714 if opts.get('all_largefiles'):
716 if opts.get('all_largefiles'):
715 revspostpull = len(repo)
717 revspostpull = len(repo)
716 revs = []
718 revs = []
717 for rev in xrange(revsprepull + 1, revspostpull):
719 for rev in xrange(revsprepull + 1, revspostpull):
718 revs.append(repo[rev].rev())
720 revs.append(repo[rev].rev())
719 lfcommands.downloadlfiles(ui, repo, revs)
721 lfcommands.downloadlfiles(ui, repo, revs)
720 return result
722 return result
721
723
722 def overrideclone(orig, ui, source, dest=None, **opts):
724 def overrideclone(orig, ui, source, dest=None, **opts):
723 d = dest
725 d = dest
724 if d is None:
726 if d is None:
725 d = hg.defaultdest(source)
727 d = hg.defaultdest(source)
726 if opts.get('all_largefiles') and not hg.islocal(d):
728 if opts.get('all_largefiles') and not hg.islocal(d):
727 raise util.Abort(_(
729 raise util.Abort(_(
728 '--all-largefiles is incompatible with non-local destination %s' %
730 '--all-largefiles is incompatible with non-local destination %s' %
729 d))
731 d))
730
732
731 return orig(ui, source, dest, **opts)
733 return orig(ui, source, dest, **opts)
732
734
733 def hgclone(orig, ui, opts, *args, **kwargs):
735 def hgclone(orig, ui, opts, *args, **kwargs):
734 result = orig(ui, opts, *args, **kwargs)
736 result = orig(ui, opts, *args, **kwargs)
735
737
736 if result is not None:
738 if result is not None:
737 sourcerepo, destrepo = result
739 sourcerepo, destrepo = result
738 repo = destrepo.local()
740 repo = destrepo.local()
739
741
740 # The .hglf directory must exist for the standin matcher to match
742 # The .hglf directory must exist for the standin matcher to match
741 # anything (which listlfiles uses for each rev), and .hg/largefiles is
743 # anything (which listlfiles uses for each rev), and .hg/largefiles is
742 # assumed to exist by the code that caches the downloaded file. These
744 # assumed to exist by the code that caches the downloaded file. These
743 # directories exist if clone updated to any rev. (If the repo does not
745 # directories exist if clone updated to any rev. (If the repo does not
744 # have largefiles, download never gets to the point of needing
746 # have largefiles, download never gets to the point of needing
745 # .hg/largefiles, and the standin matcher won't match anything anyway.)
747 # .hg/largefiles, and the standin matcher won't match anything anyway.)
746 if 'largefiles' in repo.requirements:
748 if 'largefiles' in repo.requirements:
747 if opts.get('noupdate'):
749 if opts.get('noupdate'):
748 util.makedirs(repo.pathto(lfutil.shortname))
750 util.makedirs(repo.pathto(lfutil.shortname))
749 util.makedirs(repo.join(lfutil.longname))
751 util.makedirs(repo.join(lfutil.longname))
750
752
751 # Caching is implicitly limited to 'rev' option, since the dest repo was
753 # Caching is implicitly limited to 'rev' option, since the dest repo was
752 # truncated at that point. The user may expect a download count with
754 # truncated at that point. The user may expect a download count with
753 # this option, so attempt whether or not this is a largefile repo.
755 # this option, so attempt whether or not this is a largefile repo.
754 if opts.get('all_largefiles'):
756 if opts.get('all_largefiles'):
755 success, missing = lfcommands.downloadlfiles(ui, repo, None)
757 success, missing = lfcommands.downloadlfiles(ui, repo, None)
756
758
757 if missing != 0:
759 if missing != 0:
758 return None
760 return None
759
761
760 return result
762 return result
761
763
762 def overriderebase(orig, ui, repo, **opts):
764 def overriderebase(orig, ui, repo, **opts):
763 repo._isrebasing = True
765 repo._isrebasing = True
764 try:
766 try:
765 return orig(ui, repo, **opts)
767 return orig(ui, repo, **opts)
766 finally:
768 finally:
767 repo._isrebasing = False
769 repo._isrebasing = False
768
770
769 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
771 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
770 prefix=None, mtime=None, subrepos=None):
772 prefix=None, mtime=None, subrepos=None):
771 # No need to lock because we are only reading history and
773 # No need to lock because we are only reading history and
772 # largefile caches, neither of which are modified.
774 # largefile caches, neither of which are modified.
773 lfcommands.cachelfiles(repo.ui, repo, node)
775 lfcommands.cachelfiles(repo.ui, repo, node)
774
776
775 if kind not in archival.archivers:
777 if kind not in archival.archivers:
776 raise util.Abort(_("unknown archive type '%s'") % kind)
778 raise util.Abort(_("unknown archive type '%s'") % kind)
777
779
778 ctx = repo[node]
780 ctx = repo[node]
779
781
780 if kind == 'files':
782 if kind == 'files':
781 if prefix:
783 if prefix:
782 raise util.Abort(
784 raise util.Abort(
783 _('cannot give prefix when archiving to files'))
785 _('cannot give prefix when archiving to files'))
784 else:
786 else:
785 prefix = archival.tidyprefix(dest, kind, prefix)
787 prefix = archival.tidyprefix(dest, kind, prefix)
786
788
787 def write(name, mode, islink, getdata):
789 def write(name, mode, islink, getdata):
788 if matchfn and not matchfn(name):
790 if matchfn and not matchfn(name):
789 return
791 return
790 data = getdata()
792 data = getdata()
791 if decode:
793 if decode:
792 data = repo.wwritedata(name, data)
794 data = repo.wwritedata(name, data)
793 archiver.addfile(prefix + name, mode, islink, data)
795 archiver.addfile(prefix + name, mode, islink, data)
794
796
795 archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
797 archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
796
798
797 if repo.ui.configbool("ui", "archivemeta", True):
799 if repo.ui.configbool("ui", "archivemeta", True):
798 def metadata():
800 def metadata():
799 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
801 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
800 hex(repo.changelog.node(0)), hex(node), ctx.branch())
802 hex(repo.changelog.node(0)), hex(node), ctx.branch())
801
803
802 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
804 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
803 if repo.tagtype(t) == 'global')
805 if repo.tagtype(t) == 'global')
804 if not tags:
806 if not tags:
805 repo.ui.pushbuffer()
807 repo.ui.pushbuffer()
806 opts = {'template': '{latesttag}\n{latesttagdistance}',
808 opts = {'template': '{latesttag}\n{latesttagdistance}',
807 'style': '', 'patch': None, 'git': None}
809 'style': '', 'patch': None, 'git': None}
808 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
810 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
809 ltags, dist = repo.ui.popbuffer().split('\n')
811 ltags, dist = repo.ui.popbuffer().split('\n')
810 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
812 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
811 tags += 'latesttagdistance: %s\n' % dist
813 tags += 'latesttagdistance: %s\n' % dist
812
814
813 return base + tags
815 return base + tags
814
816
815 write('.hg_archival.txt', 0644, False, metadata)
817 write('.hg_archival.txt', 0644, False, metadata)
816
818
817 for f in ctx:
819 for f in ctx:
818 ff = ctx.flags(f)
820 ff = ctx.flags(f)
819 getdata = ctx[f].data
821 getdata = ctx[f].data
820 if lfutil.isstandin(f):
822 if lfutil.isstandin(f):
821 path = lfutil.findfile(repo, getdata().strip())
823 path = lfutil.findfile(repo, getdata().strip())
822 if path is None:
824 if path is None:
823 raise util.Abort(
825 raise util.Abort(
824 _('largefile %s not found in repo store or system cache')
826 _('largefile %s not found in repo store or system cache')
825 % lfutil.splitstandin(f))
827 % lfutil.splitstandin(f))
826 f = lfutil.splitstandin(f)
828 f = lfutil.splitstandin(f)
827
829
828 def getdatafn():
830 def getdatafn():
829 fd = None
831 fd = None
830 try:
832 try:
831 fd = open(path, 'rb')
833 fd = open(path, 'rb')
832 return fd.read()
834 return fd.read()
833 finally:
835 finally:
834 if fd:
836 if fd:
835 fd.close()
837 fd.close()
836
838
837 getdata = getdatafn
839 getdata = getdatafn
838 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
840 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
839
841
840 if subrepos:
842 if subrepos:
841 for subpath in ctx.substate:
843 for subpath in ctx.substate:
842 sub = ctx.sub(subpath)
844 sub = ctx.sub(subpath)
843 submatch = match_.narrowmatcher(subpath, matchfn)
845 submatch = match_.narrowmatcher(subpath, matchfn)
844 sub.archive(repo.ui, archiver, prefix, submatch)
846 sub.archive(repo.ui, archiver, prefix, submatch)
845
847
846 archiver.done()
848 archiver.done()
847
849
848 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
850 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
849 repo._get(repo._state + ('hg',))
851 repo._get(repo._state + ('hg',))
850 rev = repo._state[1]
852 rev = repo._state[1]
851 ctx = repo._repo[rev]
853 ctx = repo._repo[rev]
852
854
853 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
855 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
854
856
855 def write(name, mode, islink, getdata):
857 def write(name, mode, islink, getdata):
856 # At this point, the standin has been replaced with the largefile name,
858 # At this point, the standin has been replaced with the largefile name,
857 # so the normal matcher works here without the lfutil variants.
859 # so the normal matcher works here without the lfutil variants.
858 if match and not match(f):
860 if match and not match(f):
859 return
861 return
860 data = getdata()
862 data = getdata()
861
863
862 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
864 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
863
865
864 for f in ctx:
866 for f in ctx:
865 ff = ctx.flags(f)
867 ff = ctx.flags(f)
866 getdata = ctx[f].data
868 getdata = ctx[f].data
867 if lfutil.isstandin(f):
869 if lfutil.isstandin(f):
868 path = lfutil.findfile(repo._repo, getdata().strip())
870 path = lfutil.findfile(repo._repo, getdata().strip())
869 if path is None:
871 if path is None:
870 raise util.Abort(
872 raise util.Abort(
871 _('largefile %s not found in repo store or system cache')
873 _('largefile %s not found in repo store or system cache')
872 % lfutil.splitstandin(f))
874 % lfutil.splitstandin(f))
873 f = lfutil.splitstandin(f)
875 f = lfutil.splitstandin(f)
874
876
875 def getdatafn():
877 def getdatafn():
876 fd = None
878 fd = None
877 try:
879 try:
878 fd = open(os.path.join(prefix, path), 'rb')
880 fd = open(os.path.join(prefix, path), 'rb')
879 return fd.read()
881 return fd.read()
880 finally:
882 finally:
881 if fd:
883 if fd:
882 fd.close()
884 fd.close()
883
885
884 getdata = getdatafn
886 getdata = getdatafn
885
887
886 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
888 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
887
889
888 for subpath in ctx.substate:
890 for subpath in ctx.substate:
889 sub = ctx.sub(subpath)
891 sub = ctx.sub(subpath)
890 submatch = match_.narrowmatcher(subpath, match)
892 submatch = match_.narrowmatcher(subpath, match)
891 sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/',
893 sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/',
892 submatch)
894 submatch)
893
895
894 # If a largefile is modified, the change is not reflected in its
896 # If a largefile is modified, the change is not reflected in its
895 # standin until a commit. cmdutil.bailifchanged() raises an exception
897 # standin until a commit. cmdutil.bailifchanged() raises an exception
896 # if the repo has uncommitted changes. Wrap it to also check if
898 # if the repo has uncommitted changes. Wrap it to also check if
897 # largefiles were changed. This is used by bisect and backout.
899 # largefiles were changed. This is used by bisect and backout.
898 def overridebailifchanged(orig, repo):
900 def overridebailifchanged(orig, repo):
899 orig(repo)
901 orig(repo)
900 repo.lfstatus = True
902 repo.lfstatus = True
901 modified, added, removed, deleted = repo.status()[:4]
903 modified, added, removed, deleted = repo.status()[:4]
902 repo.lfstatus = False
904 repo.lfstatus = False
903 if modified or added or removed or deleted:
905 if modified or added or removed or deleted:
904 raise util.Abort(_('outstanding uncommitted changes'))
906 raise util.Abort(_('outstanding uncommitted changes'))
905
907
906 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
908 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
907 def overridefetch(orig, ui, repo, *pats, **opts):
909 def overridefetch(orig, ui, repo, *pats, **opts):
908 repo.lfstatus = True
910 repo.lfstatus = True
909 modified, added, removed, deleted = repo.status()[:4]
911 modified, added, removed, deleted = repo.status()[:4]
910 repo.lfstatus = False
912 repo.lfstatus = False
911 if modified or added or removed or deleted:
913 if modified or added or removed or deleted:
912 raise util.Abort(_('outstanding uncommitted changes'))
914 raise util.Abort(_('outstanding uncommitted changes'))
913 return orig(ui, repo, *pats, **opts)
915 return orig(ui, repo, *pats, **opts)
914
916
915 def overrideforget(orig, ui, repo, *pats, **opts):
917 def overrideforget(orig, ui, repo, *pats, **opts):
916 installnormalfilesmatchfn(repo[None].manifest())
918 installnormalfilesmatchfn(repo[None].manifest())
917 result = orig(ui, repo, *pats, **opts)
919 result = orig(ui, repo, *pats, **opts)
918 restorematchfn()
920 restorematchfn()
919 m = scmutil.match(repo[None], pats, opts)
921 m = scmutil.match(repo[None], pats, opts)
920
922
921 try:
923 try:
922 repo.lfstatus = True
924 repo.lfstatus = True
923 s = repo.status(match=m, clean=True)
925 s = repo.status(match=m, clean=True)
924 finally:
926 finally:
925 repo.lfstatus = False
927 repo.lfstatus = False
926 forget = sorted(s[0] + s[1] + s[3] + s[6])
928 forget = sorted(s[0] + s[1] + s[3] + s[6])
927 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
929 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
928
930
929 for f in forget:
931 for f in forget:
930 if lfutil.standin(f) not in repo.dirstate and not \
932 if lfutil.standin(f) not in repo.dirstate and not \
931 os.path.isdir(m.rel(lfutil.standin(f))):
933 os.path.isdir(m.rel(lfutil.standin(f))):
932 ui.warn(_('not removing %s: file is already untracked\n')
934 ui.warn(_('not removing %s: file is already untracked\n')
933 % m.rel(f))
935 % m.rel(f))
934 result = 1
936 result = 1
935
937
936 for f in forget:
938 for f in forget:
937 if ui.verbose or not m.exact(f):
939 if ui.verbose or not m.exact(f):
938 ui.status(_('removing %s\n') % m.rel(f))
940 ui.status(_('removing %s\n') % m.rel(f))
939
941
940 # Need to lock because standin files are deleted then removed from the
942 # Need to lock because standin files are deleted then removed from the
941 # repository and we could race in-between.
943 # repository and we could race in-between.
942 wlock = repo.wlock()
944 wlock = repo.wlock()
943 try:
945 try:
944 lfdirstate = lfutil.openlfdirstate(ui, repo)
946 lfdirstate = lfutil.openlfdirstate(ui, repo)
945 for f in forget:
947 for f in forget:
946 if lfdirstate[f] == 'a':
948 if lfdirstate[f] == 'a':
947 lfdirstate.drop(f)
949 lfdirstate.drop(f)
948 else:
950 else:
949 lfdirstate.remove(f)
951 lfdirstate.remove(f)
950 lfdirstate.write()
952 lfdirstate.write()
951 lfutil.reporemove(repo, [lfutil.standin(f) for f in forget],
953 lfutil.reporemove(repo, [lfutil.standin(f) for f in forget],
952 unlink=True)
954 unlink=True)
953 finally:
955 finally:
954 wlock.release()
956 wlock.release()
955
957
956 return result
958 return result
957
959
958 def getoutgoinglfiles(ui, repo, dest=None, **opts):
960 def getoutgoinglfiles(ui, repo, dest=None, **opts):
959 dest = ui.expandpath(dest or 'default-push', dest or 'default')
961 dest = ui.expandpath(dest or 'default-push', dest or 'default')
960 dest, branches = hg.parseurl(dest, opts.get('branch'))
962 dest, branches = hg.parseurl(dest, opts.get('branch'))
961 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
963 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
962 if revs:
964 if revs:
963 revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)]
965 revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)]
964
966
965 try:
967 try:
966 remote = hg.peer(repo, opts, dest)
968 remote = hg.peer(repo, opts, dest)
967 except error.RepoError:
969 except error.RepoError:
968 return None
970 return None
969 o = lfutil.findoutgoing(repo, remote, False)
971 o = lfutil.findoutgoing(repo, remote, False)
970 if not o:
972 if not o:
971 return o
973 return o
972 o = repo.changelog.nodesbetween(o, revs)[0]
974 o = repo.changelog.nodesbetween(o, revs)[0]
973 if opts.get('newest_first'):
975 if opts.get('newest_first'):
974 o.reverse()
976 o.reverse()
975
977
976 toupload = set()
978 toupload = set()
977 for n in o:
979 for n in o:
978 parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
980 parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
979 ctx = repo[n]
981 ctx = repo[n]
980 files = set(ctx.files())
982 files = set(ctx.files())
981 if len(parents) == 2:
983 if len(parents) == 2:
982 mc = ctx.manifest()
984 mc = ctx.manifest()
983 mp1 = ctx.parents()[0].manifest()
985 mp1 = ctx.parents()[0].manifest()
984 mp2 = ctx.parents()[1].manifest()
986 mp2 = ctx.parents()[1].manifest()
985 for f in mp1:
987 for f in mp1:
986 if f not in mc:
988 if f not in mc:
987 files.add(f)
989 files.add(f)
988 for f in mp2:
990 for f in mp2:
989 if f not in mc:
991 if f not in mc:
990 files.add(f)
992 files.add(f)
991 for f in mc:
993 for f in mc:
992 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
994 if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
993 files.add(f)
995 files.add(f)
994 toupload = toupload.union(
996 toupload = toupload.union(
995 set([f for f in files if lfutil.isstandin(f) and f in ctx]))
997 set([f for f in files if lfutil.isstandin(f) and f in ctx]))
996 return toupload
998 return toupload
997
999
998 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
1000 def overrideoutgoing(orig, ui, repo, dest=None, **opts):
999 result = orig(ui, repo, dest, **opts)
1001 result = orig(ui, repo, dest, **opts)
1000
1002
1001 if opts.pop('large', None):
1003 if opts.pop('large', None):
1002 toupload = getoutgoinglfiles(ui, repo, dest, **opts)
1004 toupload = getoutgoinglfiles(ui, repo, dest, **opts)
1003 if toupload is None:
1005 if toupload is None:
1004 ui.status(_('largefiles: No remote repo\n'))
1006 ui.status(_('largefiles: No remote repo\n'))
1005 elif not toupload:
1007 elif not toupload:
1006 ui.status(_('largefiles: no files to upload\n'))
1008 ui.status(_('largefiles: no files to upload\n'))
1007 else:
1009 else:
1008 ui.status(_('largefiles to upload:\n'))
1010 ui.status(_('largefiles to upload:\n'))
1009 for file in toupload:
1011 for file in toupload:
1010 ui.status(lfutil.splitstandin(file) + '\n')
1012 ui.status(lfutil.splitstandin(file) + '\n')
1011 ui.status('\n')
1013 ui.status('\n')
1012
1014
1013 return result
1015 return result
1014
1016
1015 def overridesummary(orig, ui, repo, *pats, **opts):
1017 def overridesummary(orig, ui, repo, *pats, **opts):
1016 try:
1018 try:
1017 repo.lfstatus = True
1019 repo.lfstatus = True
1018 orig(ui, repo, *pats, **opts)
1020 orig(ui, repo, *pats, **opts)
1019 finally:
1021 finally:
1020 repo.lfstatus = False
1022 repo.lfstatus = False
1021
1023
1022 if opts.pop('large', None):
1024 if opts.pop('large', None):
1023 toupload = getoutgoinglfiles(ui, repo, None, **opts)
1025 toupload = getoutgoinglfiles(ui, repo, None, **opts)
1024 if toupload is None:
1026 if toupload is None:
1025 # i18n: column positioning for "hg summary"
1027 # i18n: column positioning for "hg summary"
1026 ui.status(_('largefiles: (no remote repo)\n'))
1028 ui.status(_('largefiles: (no remote repo)\n'))
1027 elif not toupload:
1029 elif not toupload:
1028 # i18n: column positioning for "hg summary"
1030 # i18n: column positioning for "hg summary"
1029 ui.status(_('largefiles: (no files to upload)\n'))
1031 ui.status(_('largefiles: (no files to upload)\n'))
1030 else:
1032 else:
1031 # i18n: column positioning for "hg summary"
1033 # i18n: column positioning for "hg summary"
1032 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1034 ui.status(_('largefiles: %d to upload\n') % len(toupload))
1033
1035
1034 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1036 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1035 similarity=None):
1037 similarity=None):
1036 if not lfutil.islfilesrepo(repo):
1038 if not lfutil.islfilesrepo(repo):
1037 return orig(repo, pats, opts, dry_run, similarity)
1039 return orig(repo, pats, opts, dry_run, similarity)
1038 # Get the list of missing largefiles so we can remove them
1040 # Get the list of missing largefiles so we can remove them
1039 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1041 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1040 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1042 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False,
1041 False, False)
1043 False, False)
1042 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
1044 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
1043
1045
1044 # Call into the normal remove code, but the removing of the standin, we want
1046 # Call into the normal remove code, but the removing of the standin, we want
1045 # to have handled by original addremove. Monkey patching here makes sure
1047 # to have handled by original addremove. Monkey patching here makes sure
1046 # we don't remove the standin in the largefiles code, preventing a very
1048 # we don't remove the standin in the largefiles code, preventing a very
1047 # confused state later.
1049 # confused state later.
1048 if missing:
1050 if missing:
1049 m = [repo.wjoin(f) for f in missing]
1051 m = [repo.wjoin(f) for f in missing]
1050 repo._isaddremove = True
1052 repo._isaddremove = True
1051 removelargefiles(repo.ui, repo, *m, **opts)
1053 removelargefiles(repo.ui, repo, *m, **opts)
1052 repo._isaddremove = False
1054 repo._isaddremove = False
1053 # Call into the normal add code, and any files that *should* be added as
1055 # Call into the normal add code, and any files that *should* be added as
1054 # largefiles will be
1056 # largefiles will be
1055 addlargefiles(repo.ui, repo, *pats, **opts)
1057 addlargefiles(repo.ui, repo, *pats, **opts)
1056 # Now that we've handled largefiles, hand off to the original addremove
1058 # Now that we've handled largefiles, hand off to the original addremove
1057 # function to take care of the rest. Make sure it doesn't do anything with
1059 # function to take care of the rest. Make sure it doesn't do anything with
1058 # largefiles by installing a matcher that will ignore them.
1060 # largefiles by installing a matcher that will ignore them.
1059 installnormalfilesmatchfn(repo[None].manifest())
1061 installnormalfilesmatchfn(repo[None].manifest())
1060 result = orig(repo, pats, opts, dry_run, similarity)
1062 result = orig(repo, pats, opts, dry_run, similarity)
1061 restorematchfn()
1063 restorematchfn()
1062 return result
1064 return result
1063
1065
1064 # Calling purge with --all will cause the largefiles to be deleted.
1066 # Calling purge with --all will cause the largefiles to be deleted.
1065 # Override repo.status to prevent this from happening.
1067 # Override repo.status to prevent this from happening.
1066 def overridepurge(orig, ui, repo, *dirs, **opts):
1068 def overridepurge(orig, ui, repo, *dirs, **opts):
1067 # XXX large file status is buggy when used on repo proxy.
1069 # XXX large file status is buggy when used on repo proxy.
1068 # XXX this needs to be investigate.
1070 # XXX this needs to be investigate.
1069 repo = repo.unfiltered()
1071 repo = repo.unfiltered()
1070 oldstatus = repo.status
1072 oldstatus = repo.status
1071 def overridestatus(node1='.', node2=None, match=None, ignored=False,
1073 def overridestatus(node1='.', node2=None, match=None, ignored=False,
1072 clean=False, unknown=False, listsubrepos=False):
1074 clean=False, unknown=False, listsubrepos=False):
1073 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1075 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1074 listsubrepos)
1076 listsubrepos)
1075 lfdirstate = lfutil.openlfdirstate(ui, repo)
1077 lfdirstate = lfutil.openlfdirstate(ui, repo)
1076 modified, added, removed, deleted, unknown, ignored, clean = r
1078 modified, added, removed, deleted, unknown, ignored, clean = r
1077 unknown = [f for f in unknown if lfdirstate[f] == '?']
1079 unknown = [f for f in unknown if lfdirstate[f] == '?']
1078 ignored = [f for f in ignored if lfdirstate[f] == '?']
1080 ignored = [f for f in ignored if lfdirstate[f] == '?']
1079 return modified, added, removed, deleted, unknown, ignored, clean
1081 return modified, added, removed, deleted, unknown, ignored, clean
1080 repo.status = overridestatus
1082 repo.status = overridestatus
1081 orig(ui, repo, *dirs, **opts)
1083 orig(ui, repo, *dirs, **opts)
1082 repo.status = oldstatus
1084 repo.status = oldstatus
1083
1085
1084 def overriderollback(orig, ui, repo, **opts):
1086 def overriderollback(orig, ui, repo, **opts):
1085 result = orig(ui, repo, **opts)
1087 result = orig(ui, repo, **opts)
1086 merge.update(repo, node=None, branchmerge=False, force=True,
1088 merge.update(repo, node=None, branchmerge=False, force=True,
1087 partial=lfutil.isstandin)
1089 partial=lfutil.isstandin)
1088 wlock = repo.wlock()
1090 wlock = repo.wlock()
1089 try:
1091 try:
1090 lfdirstate = lfutil.openlfdirstate(ui, repo)
1092 lfdirstate = lfutil.openlfdirstate(ui, repo)
1091 lfiles = lfutil.listlfiles(repo)
1093 lfiles = lfutil.listlfiles(repo)
1092 oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev())
1094 oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev())
1093 for file in lfiles:
1095 for file in lfiles:
1094 if file in oldlfiles:
1096 if file in oldlfiles:
1095 lfdirstate.normallookup(file)
1097 lfdirstate.normallookup(file)
1096 else:
1098 else:
1097 lfdirstate.add(file)
1099 lfdirstate.add(file)
1098 lfdirstate.write()
1100 lfdirstate.write()
1099 finally:
1101 finally:
1100 wlock.release()
1102 wlock.release()
1101 return result
1103 return result
1102
1104
1103 def overridetransplant(orig, ui, repo, *revs, **opts):
1105 def overridetransplant(orig, ui, repo, *revs, **opts):
1104 try:
1106 try:
1105 oldstandins = lfutil.getstandinsstate(repo)
1107 oldstandins = lfutil.getstandinsstate(repo)
1106 repo._istransplanting = True
1108 repo._istransplanting = True
1107 result = orig(ui, repo, *revs, **opts)
1109 result = orig(ui, repo, *revs, **opts)
1108 newstandins = lfutil.getstandinsstate(repo)
1110 newstandins = lfutil.getstandinsstate(repo)
1109 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1111 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1110 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1112 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1111 printmessage=True)
1113 printmessage=True)
1112 finally:
1114 finally:
1113 repo._istransplanting = False
1115 repo._istransplanting = False
1114 return result
1116 return result
1115
1117
1116 def overridecat(orig, ui, repo, file1, *pats, **opts):
1118 def overridecat(orig, ui, repo, file1, *pats, **opts):
1117 ctx = scmutil.revsingle(repo, opts.get('rev'))
1119 ctx = scmutil.revsingle(repo, opts.get('rev'))
1118 if not lfutil.standin(file1) in ctx:
1120 if not lfutil.standin(file1) in ctx:
1119 result = orig(ui, repo, file1, *pats, **opts)
1121 result = orig(ui, repo, file1, *pats, **opts)
1120 return result
1122 return result
1121 return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output'))
1123 return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output'))
1122
1124
1123 def mercurialsinkbefore(orig, sink):
1125 def mercurialsinkbefore(orig, sink):
1124 sink.repo._isconverting = True
1126 sink.repo._isconverting = True
1125 orig(sink)
1127 orig(sink)
1126
1128
1127 def mercurialsinkafter(orig, sink):
1129 def mercurialsinkafter(orig, sink):
1128 sink.repo._isconverting = False
1130 sink.repo._isconverting = False
1129 orig(sink)
1131 orig(sink)
@@ -1,1796 +1,1806 b''
1 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
1 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
2 $ mkdir "${USERCACHE}"
2 $ mkdir "${USERCACHE}"
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [extensions]
4 > [extensions]
5 > largefiles=
5 > largefiles=
6 > purge=
6 > purge=
7 > rebase=
7 > rebase=
8 > transplant=
8 > transplant=
9 > [phases]
9 > [phases]
10 > publish=False
10 > publish=False
11 > [largefiles]
11 > [largefiles]
12 > minsize=2
12 > minsize=2
13 > patterns=glob:**.dat
13 > patterns=glob:**.dat
14 > usercache=${USERCACHE}
14 > usercache=${USERCACHE}
15 > [hooks]
15 > [hooks]
16 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
16 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
17 > EOF
17 > EOF
18
18
19 Create the repo with a couple of revisions of both large and normal
19 Create the repo with a couple of revisions of both large and normal
20 files, testing that status correctly shows largefiles and that summary output
20 files, testing that status correctly shows largefiles and that summary output
21 is correct.
21 is correct.
22
22
23 $ hg init a
23 $ hg init a
24 $ cd a
24 $ cd a
25 $ mkdir sub
25 $ mkdir sub
26 $ echo normal1 > normal1
26 $ echo normal1 > normal1
27 $ echo normal2 > sub/normal2
27 $ echo normal2 > sub/normal2
28 $ echo large1 > large1
28 $ echo large1 > large1
29 $ echo large2 > sub/large2
29 $ echo large2 > sub/large2
30 $ hg add normal1 sub/normal2
30 $ hg add normal1 sub/normal2
31 $ hg add --large large1 sub/large2
31 $ hg add --large large1 sub/large2
32 $ hg commit -m "add files"
32 $ hg commit -m "add files"
33 Invoking status precommit hook
33 Invoking status precommit hook
34 A large1
34 A large1
35 A normal1
35 A normal1
36 A sub/large2
36 A sub/large2
37 A sub/normal2
37 A sub/normal2
38 $ echo normal11 > normal1
38 $ echo normal11 > normal1
39 $ echo normal22 > sub/normal2
39 $ echo normal22 > sub/normal2
40 $ echo large11 > large1
40 $ echo large11 > large1
41 $ echo large22 > sub/large2
41 $ echo large22 > sub/large2
42 $ hg commit -m "edit files"
42 $ hg commit -m "edit files"
43 Invoking status precommit hook
43 Invoking status precommit hook
44 M large1
44 M large1
45 M normal1
45 M normal1
46 M sub/large2
46 M sub/large2
47 M sub/normal2
47 M sub/normal2
48 $ hg sum --large
48 $ hg sum --large
49 parent: 1:ce8896473775 tip
49 parent: 1:ce8896473775 tip
50 edit files
50 edit files
51 branch: default
51 branch: default
52 commit: (clean)
52 commit: (clean)
53 update: (current)
53 update: (current)
54 largefiles: (no remote repo)
54 largefiles: (no remote repo)
55
55
56 Commit preserved largefile contents.
56 Commit preserved largefile contents.
57
57
58 $ cat normal1
58 $ cat normal1
59 normal11
59 normal11
60 $ cat large1
60 $ cat large1
61 large11
61 large11
62 $ cat sub/normal2
62 $ cat sub/normal2
63 normal22
63 normal22
64 $ cat sub/large2
64 $ cat sub/large2
65 large22
65 large22
66
66
67 Test status, subdir and unknown files
67 Test status, subdir and unknown files
68
68
69 $ echo unknown > sub/unknown
69 $ echo unknown > sub/unknown
70 $ hg st --all
70 $ hg st --all
71 ? sub/unknown
71 ? sub/unknown
72 C large1
72 C large1
73 C normal1
73 C normal1
74 C sub/large2
74 C sub/large2
75 C sub/normal2
75 C sub/normal2
76 $ hg st --all sub
76 $ hg st --all sub
77 ? sub/unknown
77 ? sub/unknown
78 C sub/large2
78 C sub/large2
79 C sub/normal2
79 C sub/normal2
80 $ rm sub/unknown
80 $ rm sub/unknown
81
81
82 Test exit codes for remove warning cases (modified and still exiting)
82 Test messages and exit codes for remove warning cases
83
83
84 $ hg remove -A large1
84 $ hg remove -A large1
85 not removing large1: file still exists (use forget to undo)
85 not removing large1: file still exists
86 [1]
86 [1]
87 $ echo 'modified' > large1
87 $ echo 'modified' > large1
88 $ hg remove large1
88 $ hg remove large1
89 not removing large1: file is modified (use forget to undo)
89 not removing large1: file is modified (use -f to force removal)
90 [1]
90 [1]
91 $ echo 'new' > normalnew
92 $ hg add normalnew
93 $ echo 'new' > largenew
94 $ hg add --large normalnew
95 normalnew already tracked!
96 $ hg remove normalnew largenew
97 not removing largenew: file is untracked
98 not removing normalnew: file has been marked for add (use forget to undo)
99 [1]
100 $ rm normalnew largenew
91 $ hg up -Cq
101 $ hg up -Cq
92
102
93 Remove both largefiles and normal files.
103 Remove both largefiles and normal files.
94
104
95 $ hg remove normal1 large1
105 $ hg remove normal1 large1
96 $ hg status large1
106 $ hg status large1
97 R large1
107 R large1
98 $ hg commit -m "remove files"
108 $ hg commit -m "remove files"
99 Invoking status precommit hook
109 Invoking status precommit hook
100 R large1
110 R large1
101 R normal1
111 R normal1
102 $ ls
112 $ ls
103 sub
113 sub
104 $ echo "testlargefile" > large1-test
114 $ echo "testlargefile" > large1-test
105 $ hg add --large large1-test
115 $ hg add --large large1-test
106 $ hg st
116 $ hg st
107 A large1-test
117 A large1-test
108 $ hg rm large1-test
118 $ hg rm large1-test
109 not removing large1-test: file has been marked for add (use forget to undo)
119 not removing large1-test: file has been marked for add (use forget to undo)
110 [1]
120 [1]
111 $ hg st
121 $ hg st
112 A large1-test
122 A large1-test
113 $ hg forget large1-test
123 $ hg forget large1-test
114 $ hg st
124 $ hg st
115 ? large1-test
125 ? large1-test
116 $ hg remove large1-test
126 $ hg remove large1-test
117 not removing large1-test: file is untracked
127 not removing large1-test: file is untracked
118 [1]
128 [1]
119 $ hg forget large1-test
129 $ hg forget large1-test
120 not removing large1-test: file is already untracked
130 not removing large1-test: file is already untracked
121 [1]
131 [1]
122 $ rm large1-test
132 $ rm large1-test
123
133
124 Copy both largefiles and normal files (testing that status output is correct).
134 Copy both largefiles and normal files (testing that status output is correct).
125
135
126 $ hg cp sub/normal2 normal1
136 $ hg cp sub/normal2 normal1
127 $ hg cp sub/large2 large1
137 $ hg cp sub/large2 large1
128 $ hg commit -m "copy files"
138 $ hg commit -m "copy files"
129 Invoking status precommit hook
139 Invoking status precommit hook
130 A large1
140 A large1
131 A normal1
141 A normal1
132 $ cat normal1
142 $ cat normal1
133 normal22
143 normal22
134 $ cat large1
144 $ cat large1
135 large22
145 large22
136
146
137 Test moving largefiles and verify that normal files are also unaffected.
147 Test moving largefiles and verify that normal files are also unaffected.
138
148
139 $ hg mv normal1 normal3
149 $ hg mv normal1 normal3
140 $ hg mv large1 large3
150 $ hg mv large1 large3
141 $ hg mv sub/normal2 sub/normal4
151 $ hg mv sub/normal2 sub/normal4
142 $ hg mv sub/large2 sub/large4
152 $ hg mv sub/large2 sub/large4
143 $ hg commit -m "move files"
153 $ hg commit -m "move files"
144 Invoking status precommit hook
154 Invoking status precommit hook
145 A large3
155 A large3
146 A normal3
156 A normal3
147 A sub/large4
157 A sub/large4
148 A sub/normal4
158 A sub/normal4
149 R large1
159 R large1
150 R normal1
160 R normal1
151 R sub/large2
161 R sub/large2
152 R sub/normal2
162 R sub/normal2
153 $ cat normal3
163 $ cat normal3
154 normal22
164 normal22
155 $ cat large3
165 $ cat large3
156 large22
166 large22
157 $ cat sub/normal4
167 $ cat sub/normal4
158 normal22
168 normal22
159 $ cat sub/large4
169 $ cat sub/large4
160 large22
170 large22
161
171
162 Test copies and moves from a directory other than root (issue3516)
172 Test copies and moves from a directory other than root (issue3516)
163
173
164 $ cd ..
174 $ cd ..
165 $ hg init lf_cpmv
175 $ hg init lf_cpmv
166 $ cd lf_cpmv
176 $ cd lf_cpmv
167 $ mkdir dira
177 $ mkdir dira
168 $ mkdir dira/dirb
178 $ mkdir dira/dirb
169 $ touch dira/dirb/largefile
179 $ touch dira/dirb/largefile
170 $ hg add --large dira/dirb/largefile
180 $ hg add --large dira/dirb/largefile
171 $ hg commit -m "added"
181 $ hg commit -m "added"
172 Invoking status precommit hook
182 Invoking status precommit hook
173 A dira/dirb/largefile
183 A dira/dirb/largefile
174 $ cd dira
184 $ cd dira
175 $ hg cp dirb/largefile foo/largefile
185 $ hg cp dirb/largefile foo/largefile
176 $ hg ci -m "deep copy"
186 $ hg ci -m "deep copy"
177 Invoking status precommit hook
187 Invoking status precommit hook
178 A dira/foo/largefile
188 A dira/foo/largefile
179 $ find . | sort
189 $ find . | sort
180 .
190 .
181 ./dirb
191 ./dirb
182 ./dirb/largefile
192 ./dirb/largefile
183 ./foo
193 ./foo
184 ./foo/largefile
194 ./foo/largefile
185 $ hg mv foo/largefile baz/largefile
195 $ hg mv foo/largefile baz/largefile
186 $ hg ci -m "moved"
196 $ hg ci -m "moved"
187 Invoking status precommit hook
197 Invoking status precommit hook
188 A dira/baz/largefile
198 A dira/baz/largefile
189 R dira/foo/largefile
199 R dira/foo/largefile
190 $ find . | sort
200 $ find . | sort
191 .
201 .
192 ./baz
202 ./baz
193 ./baz/largefile
203 ./baz/largefile
194 ./dirb
204 ./dirb
195 ./dirb/largefile
205 ./dirb/largefile
196 ./foo
206 ./foo
197 $ cd ../../a
207 $ cd ../../a
198
208
199 #if hgweb
209 #if hgweb
200 Test display of largefiles in hgweb
210 Test display of largefiles in hgweb
201
211
202 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
212 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
203 $ cat ../hg.pid >> $DAEMON_PIDS
213 $ cat ../hg.pid >> $DAEMON_PIDS
204 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
214 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
205 200 Script output follows
215 200 Script output follows
206
216
207
217
208 drwxr-xr-x sub
218 drwxr-xr-x sub
209 -rw-r--r-- 41 large3
219 -rw-r--r-- 41 large3
210 -rw-r--r-- 9 normal3
220 -rw-r--r-- 9 normal3
211
221
212
222
213 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
223 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
214 200 Script output follows
224 200 Script output follows
215
225
216
226
217 -rw-r--r-- 41 large4
227 -rw-r--r-- 41 large4
218 -rw-r--r-- 9 normal4
228 -rw-r--r-- 9 normal4
219
229
220
230
221 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
231 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
222 #endif
232 #endif
223
233
224 Test archiving the various revisions. These hit corner cases known with
234 Test archiving the various revisions. These hit corner cases known with
225 archiving.
235 archiving.
226
236
227 $ hg archive -r 0 ../archive0
237 $ hg archive -r 0 ../archive0
228 $ hg archive -r 1 ../archive1
238 $ hg archive -r 1 ../archive1
229 $ hg archive -r 2 ../archive2
239 $ hg archive -r 2 ../archive2
230 $ hg archive -r 3 ../archive3
240 $ hg archive -r 3 ../archive3
231 $ hg archive -r 4 ../archive4
241 $ hg archive -r 4 ../archive4
232 $ cd ../archive0
242 $ cd ../archive0
233 $ cat normal1
243 $ cat normal1
234 normal1
244 normal1
235 $ cat large1
245 $ cat large1
236 large1
246 large1
237 $ cat sub/normal2
247 $ cat sub/normal2
238 normal2
248 normal2
239 $ cat sub/large2
249 $ cat sub/large2
240 large2
250 large2
241 $ cd ../archive1
251 $ cd ../archive1
242 $ cat normal1
252 $ cat normal1
243 normal11
253 normal11
244 $ cat large1
254 $ cat large1
245 large11
255 large11
246 $ cat sub/normal2
256 $ cat sub/normal2
247 normal22
257 normal22
248 $ cat sub/large2
258 $ cat sub/large2
249 large22
259 large22
250 $ cd ../archive2
260 $ cd ../archive2
251 $ ls
261 $ ls
252 sub
262 sub
253 $ cat sub/normal2
263 $ cat sub/normal2
254 normal22
264 normal22
255 $ cat sub/large2
265 $ cat sub/large2
256 large22
266 large22
257 $ cd ../archive3
267 $ cd ../archive3
258 $ cat normal1
268 $ cat normal1
259 normal22
269 normal22
260 $ cat large1
270 $ cat large1
261 large22
271 large22
262 $ cat sub/normal2
272 $ cat sub/normal2
263 normal22
273 normal22
264 $ cat sub/large2
274 $ cat sub/large2
265 large22
275 large22
266 $ cd ../archive4
276 $ cd ../archive4
267 $ cat normal3
277 $ cat normal3
268 normal22
278 normal22
269 $ cat large3
279 $ cat large3
270 large22
280 large22
271 $ cat sub/normal4
281 $ cat sub/normal4
272 normal22
282 normal22
273 $ cat sub/large4
283 $ cat sub/large4
274 large22
284 large22
275
285
276 Commit corner case: specify files to commit.
286 Commit corner case: specify files to commit.
277
287
278 $ cd ../a
288 $ cd ../a
279 $ echo normal3 > normal3
289 $ echo normal3 > normal3
280 $ echo large3 > large3
290 $ echo large3 > large3
281 $ echo normal4 > sub/normal4
291 $ echo normal4 > sub/normal4
282 $ echo large4 > sub/large4
292 $ echo large4 > sub/large4
283 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
293 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
284 Invoking status precommit hook
294 Invoking status precommit hook
285 M large3
295 M large3
286 M normal3
296 M normal3
287 M sub/large4
297 M sub/large4
288 M sub/normal4
298 M sub/normal4
289 $ cat normal3
299 $ cat normal3
290 normal3
300 normal3
291 $ cat large3
301 $ cat large3
292 large3
302 large3
293 $ cat sub/normal4
303 $ cat sub/normal4
294 normal4
304 normal4
295 $ cat sub/large4
305 $ cat sub/large4
296 large4
306 large4
297
307
298 One more commit corner case: commit from a subdirectory.
308 One more commit corner case: commit from a subdirectory.
299
309
300 $ cd ../a
310 $ cd ../a
301 $ echo normal33 > normal3
311 $ echo normal33 > normal3
302 $ echo large33 > large3
312 $ echo large33 > large3
303 $ echo normal44 > sub/normal4
313 $ echo normal44 > sub/normal4
304 $ echo large44 > sub/large4
314 $ echo large44 > sub/large4
305 $ cd sub
315 $ cd sub
306 $ hg commit -m "edit files yet again"
316 $ hg commit -m "edit files yet again"
307 Invoking status precommit hook
317 Invoking status precommit hook
308 M large3
318 M large3
309 M normal3
319 M normal3
310 M sub/large4
320 M sub/large4
311 M sub/normal4
321 M sub/normal4
312 $ cat ../normal3
322 $ cat ../normal3
313 normal33
323 normal33
314 $ cat ../large3
324 $ cat ../large3
315 large33
325 large33
316 $ cat normal4
326 $ cat normal4
317 normal44
327 normal44
318 $ cat large4
328 $ cat large4
319 large44
329 large44
320
330
321 Committing standins is not allowed.
331 Committing standins is not allowed.
322
332
323 $ cd ..
333 $ cd ..
324 $ echo large3 > large3
334 $ echo large3 > large3
325 $ hg commit .hglf/large3 -m "try to commit standin"
335 $ hg commit .hglf/large3 -m "try to commit standin"
326 abort: file ".hglf/large3" is a largefile standin
336 abort: file ".hglf/large3" is a largefile standin
327 (commit the largefile itself instead)
337 (commit the largefile itself instead)
328 [255]
338 [255]
329
339
330 Corner cases for adding largefiles.
340 Corner cases for adding largefiles.
331
341
332 $ echo large5 > large5
342 $ echo large5 > large5
333 $ hg add --large large5
343 $ hg add --large large5
334 $ hg add --large large5
344 $ hg add --large large5
335 large5 already a largefile
345 large5 already a largefile
336 $ mkdir sub2
346 $ mkdir sub2
337 $ echo large6 > sub2/large6
347 $ echo large6 > sub2/large6
338 $ echo large7 > sub2/large7
348 $ echo large7 > sub2/large7
339 $ hg add --large sub2
349 $ hg add --large sub2
340 adding sub2/large6 as a largefile (glob)
350 adding sub2/large6 as a largefile (glob)
341 adding sub2/large7 as a largefile (glob)
351 adding sub2/large7 as a largefile (glob)
342 $ hg st
352 $ hg st
343 M large3
353 M large3
344 A large5
354 A large5
345 A sub2/large6
355 A sub2/large6
346 A sub2/large7
356 A sub2/large7
347
357
348 Committing directories containing only largefiles.
358 Committing directories containing only largefiles.
349
359
350 $ mkdir -p z/y/x/m
360 $ mkdir -p z/y/x/m
351 $ touch z/y/x/m/large1
361 $ touch z/y/x/m/large1
352 $ touch z/y/x/large2
362 $ touch z/y/x/large2
353 $ hg add --large z/y/x/m/large1 z/y/x/large2
363 $ hg add --large z/y/x/m/large1 z/y/x/large2
354 $ hg commit -m "Subdir with directory only containing largefiles" z
364 $ hg commit -m "Subdir with directory only containing largefiles" z
355 Invoking status precommit hook
365 Invoking status precommit hook
356 M large3
366 M large3
357 A large5
367 A large5
358 A sub2/large6
368 A sub2/large6
359 A sub2/large7
369 A sub2/large7
360 A z/y/x/large2
370 A z/y/x/large2
361 A z/y/x/m/large1
371 A z/y/x/m/large1
362 $ hg rollback --quiet
372 $ hg rollback --quiet
363 $ touch z/y/x/m/normal
373 $ touch z/y/x/m/normal
364 $ hg add z/y/x/m/normal
374 $ hg add z/y/x/m/normal
365 $ hg commit -m "Subdir with mixed contents" z
375 $ hg commit -m "Subdir with mixed contents" z
366 Invoking status precommit hook
376 Invoking status precommit hook
367 M large3
377 M large3
368 A large5
378 A large5
369 A sub2/large6
379 A sub2/large6
370 A sub2/large7
380 A sub2/large7
371 A z/y/x/large2
381 A z/y/x/large2
372 A z/y/x/m/large1
382 A z/y/x/m/large1
373 A z/y/x/m/normal
383 A z/y/x/m/normal
374 $ hg st
384 $ hg st
375 M large3
385 M large3
376 A large5
386 A large5
377 A sub2/large6
387 A sub2/large6
378 A sub2/large7
388 A sub2/large7
379 $ hg rollback --quiet
389 $ hg rollback --quiet
380 $ hg revert z/y/x/large2 z/y/x/m/large1
390 $ hg revert z/y/x/large2 z/y/x/m/large1
381 $ rm z/y/x/large2 z/y/x/m/large1
391 $ rm z/y/x/large2 z/y/x/m/large1
382 $ hg commit -m "Subdir with normal contents" z
392 $ hg commit -m "Subdir with normal contents" z
383 Invoking status precommit hook
393 Invoking status precommit hook
384 M large3
394 M large3
385 A large5
395 A large5
386 A sub2/large6
396 A sub2/large6
387 A sub2/large7
397 A sub2/large7
388 A z/y/x/m/normal
398 A z/y/x/m/normal
389 $ hg st
399 $ hg st
390 M large3
400 M large3
391 A large5
401 A large5
392 A sub2/large6
402 A sub2/large6
393 A sub2/large7
403 A sub2/large7
394 $ hg rollback --quiet
404 $ hg rollback --quiet
395 $ hg revert --quiet z
405 $ hg revert --quiet z
396 $ hg commit -m "Empty subdir" z
406 $ hg commit -m "Empty subdir" z
397 abort: z: no match under directory!
407 abort: z: no match under directory!
398 [255]
408 [255]
399 $ rm -rf z
409 $ rm -rf z
400 $ hg ci -m "standin" .hglf
410 $ hg ci -m "standin" .hglf
401 abort: file ".hglf" is a largefile standin
411 abort: file ".hglf" is a largefile standin
402 (commit the largefile itself instead)
412 (commit the largefile itself instead)
403 [255]
413 [255]
404
414
405 Test "hg status" with combination of 'file pattern' and 'directory
415 Test "hg status" with combination of 'file pattern' and 'directory
406 pattern' for largefiles:
416 pattern' for largefiles:
407
417
408 $ hg status sub2/large6 sub2
418 $ hg status sub2/large6 sub2
409 A sub2/large6
419 A sub2/large6
410 A sub2/large7
420 A sub2/large7
411
421
412 Config settings (pattern **.dat, minsize 2 MB) are respected.
422 Config settings (pattern **.dat, minsize 2 MB) are respected.
413
423
414 $ echo testdata > test.dat
424 $ echo testdata > test.dat
415 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
425 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
416 $ hg add
426 $ hg add
417 adding reallylarge as a largefile
427 adding reallylarge as a largefile
418 adding test.dat as a largefile
428 adding test.dat as a largefile
419
429
420 Test that minsize and --lfsize handle float values;
430 Test that minsize and --lfsize handle float values;
421 also tests that --lfsize overrides largefiles.minsize.
431 also tests that --lfsize overrides largefiles.minsize.
422 (0.250 MB = 256 kB = 262144 B)
432 (0.250 MB = 256 kB = 262144 B)
423
433
424 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
434 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
425 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
435 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
426 $ hg --config largefiles.minsize=.25 add
436 $ hg --config largefiles.minsize=.25 add
427 adding ratherlarge as a largefile
437 adding ratherlarge as a largefile
428 adding medium
438 adding medium
429 $ hg forget medium
439 $ hg forget medium
430 $ hg --config largefiles.minsize=.25 add --lfsize=.125
440 $ hg --config largefiles.minsize=.25 add --lfsize=.125
431 adding medium as a largefile
441 adding medium as a largefile
432 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
442 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
433 $ hg --config largefiles.minsize=.25 add --lfsize=.125
443 $ hg --config largefiles.minsize=.25 add --lfsize=.125
434 adding notlarge
444 adding notlarge
435 $ hg forget notlarge
445 $ hg forget notlarge
436
446
437 Test forget on largefiles.
447 Test forget on largefiles.
438
448
439 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
449 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
440 $ hg commit -m "add/edit more largefiles"
450 $ hg commit -m "add/edit more largefiles"
441 Invoking status precommit hook
451 Invoking status precommit hook
442 A sub2/large6
452 A sub2/large6
443 A sub2/large7
453 A sub2/large7
444 R large3
454 R large3
445 ? large5
455 ? large5
446 ? medium
456 ? medium
447 ? notlarge
457 ? notlarge
448 ? ratherlarge
458 ? ratherlarge
449 ? reallylarge
459 ? reallylarge
450 ? test.dat
460 ? test.dat
451 $ hg st
461 $ hg st
452 ? large3
462 ? large3
453 ? large5
463 ? large5
454 ? medium
464 ? medium
455 ? notlarge
465 ? notlarge
456 ? ratherlarge
466 ? ratherlarge
457 ? reallylarge
467 ? reallylarge
458 ? test.dat
468 ? test.dat
459
469
460 Purge with largefiles: verify that largefiles are still in the working
470 Purge with largefiles: verify that largefiles are still in the working
461 dir after a purge.
471 dir after a purge.
462
472
463 $ hg purge --all
473 $ hg purge --all
464 $ cat sub/large4
474 $ cat sub/large4
465 large44
475 large44
466 $ cat sub2/large6
476 $ cat sub2/large6
467 large6
477 large6
468 $ cat sub2/large7
478 $ cat sub2/large7
469 large7
479 large7
470
480
471 Test addremove: verify that files that should be added as largfiles are added as
481 Test addremove: verify that files that should be added as largfiles are added as
472 such and that already-existing largfiles are not added as normal files by
482 such and that already-existing largfiles are not added as normal files by
473 accident.
483 accident.
474
484
475 $ rm normal3
485 $ rm normal3
476 $ rm sub/large4
486 $ rm sub/large4
477 $ echo "testing addremove with patterns" > testaddremove.dat
487 $ echo "testing addremove with patterns" > testaddremove.dat
478 $ echo "normaladdremove" > normaladdremove
488 $ echo "normaladdremove" > normaladdremove
479 $ hg addremove
489 $ hg addremove
480 removing sub/large4
490 removing sub/large4
481 adding testaddremove.dat as a largefile
491 adding testaddremove.dat as a largefile
482 removing normal3
492 removing normal3
483 adding normaladdremove
493 adding normaladdremove
484
494
485 Test addremove with -R
495 Test addremove with -R
486
496
487 $ hg up -C
497 $ hg up -C
488 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
498 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 getting changed largefiles
499 getting changed largefiles
490 1 largefiles updated, 0 removed
500 1 largefiles updated, 0 removed
491 $ rm normal3
501 $ rm normal3
492 $ rm sub/large4
502 $ rm sub/large4
493 $ echo "testing addremove with patterns" > testaddremove.dat
503 $ echo "testing addremove with patterns" > testaddremove.dat
494 $ echo "normaladdremove" > normaladdremove
504 $ echo "normaladdremove" > normaladdremove
495 $ cd ..
505 $ cd ..
496 $ hg -R a addremove
506 $ hg -R a addremove
497 removing sub/large4
507 removing sub/large4
498 adding a/testaddremove.dat as a largefile (glob)
508 adding a/testaddremove.dat as a largefile (glob)
499 removing normal3
509 removing normal3
500 adding normaladdremove
510 adding normaladdremove
501 $ cd a
511 $ cd a
502
512
503 Test 3364
513 Test 3364
504 $ hg clone . ../addrm
514 $ hg clone . ../addrm
505 updating to branch default
515 updating to branch default
506 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
516 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
507 getting changed largefiles
517 getting changed largefiles
508 3 largefiles updated, 0 removed
518 3 largefiles updated, 0 removed
509 $ cd ../addrm
519 $ cd ../addrm
510 $ cat >> .hg/hgrc <<EOF
520 $ cat >> .hg/hgrc <<EOF
511 > [hooks]
521 > [hooks]
512 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
522 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
513 > EOF
523 > EOF
514 $ touch foo
524 $ touch foo
515 $ hg add --large foo
525 $ hg add --large foo
516 $ hg ci -m "add foo"
526 $ hg ci -m "add foo"
517 Invoking status precommit hook
527 Invoking status precommit hook
518 A foo
528 A foo
519 Invoking status postcommit hook
529 Invoking status postcommit hook
520 C foo
530 C foo
521 C normal3
531 C normal3
522 C sub/large4
532 C sub/large4
523 C sub/normal4
533 C sub/normal4
524 C sub2/large6
534 C sub2/large6
525 C sub2/large7
535 C sub2/large7
526 $ rm foo
536 $ rm foo
527 $ hg st
537 $ hg st
528 ! foo
538 ! foo
529 hmm.. no precommit invoked, but there is a postcommit??
539 hmm.. no precommit invoked, but there is a postcommit??
530 $ hg ci -m "will not checkin"
540 $ hg ci -m "will not checkin"
531 nothing changed
541 nothing changed
532 Invoking status postcommit hook
542 Invoking status postcommit hook
533 ! foo
543 ! foo
534 C normal3
544 C normal3
535 C sub/large4
545 C sub/large4
536 C sub/normal4
546 C sub/normal4
537 C sub2/large6
547 C sub2/large6
538 C sub2/large7
548 C sub2/large7
539 [1]
549 [1]
540 $ hg addremove
550 $ hg addremove
541 removing foo
551 removing foo
542 $ hg st
552 $ hg st
543 R foo
553 R foo
544 $ hg ci -m "used to say nothing changed"
554 $ hg ci -m "used to say nothing changed"
545 Invoking status precommit hook
555 Invoking status precommit hook
546 R foo
556 R foo
547 Invoking status postcommit hook
557 Invoking status postcommit hook
548 C normal3
558 C normal3
549 C sub/large4
559 C sub/large4
550 C sub/normal4
560 C sub/normal4
551 C sub2/large6
561 C sub2/large6
552 C sub2/large7
562 C sub2/large7
553 $ hg st
563 $ hg st
554
564
555 Test 3507 (both normal files and largefiles were a problem)
565 Test 3507 (both normal files and largefiles were a problem)
556
566
557 $ touch normal
567 $ touch normal
558 $ touch large
568 $ touch large
559 $ hg add normal
569 $ hg add normal
560 $ hg add --large large
570 $ hg add --large large
561 $ hg ci -m "added"
571 $ hg ci -m "added"
562 Invoking status precommit hook
572 Invoking status precommit hook
563 A large
573 A large
564 A normal
574 A normal
565 Invoking status postcommit hook
575 Invoking status postcommit hook
566 C large
576 C large
567 C normal
577 C normal
568 C normal3
578 C normal3
569 C sub/large4
579 C sub/large4
570 C sub/normal4
580 C sub/normal4
571 C sub2/large6
581 C sub2/large6
572 C sub2/large7
582 C sub2/large7
573 $ hg remove normal
583 $ hg remove normal
574 $ hg addremove --traceback
584 $ hg addremove --traceback
575 $ hg ci -m "addremoved normal"
585 $ hg ci -m "addremoved normal"
576 Invoking status precommit hook
586 Invoking status precommit hook
577 R normal
587 R normal
578 Invoking status postcommit hook
588 Invoking status postcommit hook
579 C large
589 C large
580 C normal3
590 C normal3
581 C sub/large4
591 C sub/large4
582 C sub/normal4
592 C sub/normal4
583 C sub2/large6
593 C sub2/large6
584 C sub2/large7
594 C sub2/large7
585 $ hg up -C '.^'
595 $ hg up -C '.^'
586 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
596 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
587 getting changed largefiles
597 getting changed largefiles
588 0 largefiles updated, 0 removed
598 0 largefiles updated, 0 removed
589 $ hg remove large
599 $ hg remove large
590 $ hg addremove --traceback
600 $ hg addremove --traceback
591 $ hg ci -m "removed large"
601 $ hg ci -m "removed large"
592 Invoking status precommit hook
602 Invoking status precommit hook
593 R large
603 R large
594 created new head
604 created new head
595 Invoking status postcommit hook
605 Invoking status postcommit hook
596 C normal
606 C normal
597 C normal3
607 C normal3
598 C sub/large4
608 C sub/large4
599 C sub/normal4
609 C sub/normal4
600 C sub2/large6
610 C sub2/large6
601 C sub2/large7
611 C sub2/large7
602
612
603 Test commit -A (issue 3542)
613 Test commit -A (issue 3542)
604 $ echo large8 > large8
614 $ echo large8 > large8
605 $ hg add --large large8
615 $ hg add --large large8
606 $ hg ci -Am 'this used to add large8 as normal and commit both'
616 $ hg ci -Am 'this used to add large8 as normal and commit both'
607 Invoking status precommit hook
617 Invoking status precommit hook
608 A large8
618 A large8
609 Invoking status postcommit hook
619 Invoking status postcommit hook
610 C large8
620 C large8
611 C normal
621 C normal
612 C normal3
622 C normal3
613 C sub/large4
623 C sub/large4
614 C sub/normal4
624 C sub/normal4
615 C sub2/large6
625 C sub2/large6
616 C sub2/large7
626 C sub2/large7
617 $ rm large8
627 $ rm large8
618 $ hg ci -Am 'this used to not notice the rm'
628 $ hg ci -Am 'this used to not notice the rm'
619 removing large8
629 removing large8
620 Invoking status precommit hook
630 Invoking status precommit hook
621 R large8
631 R large8
622 Invoking status postcommit hook
632 Invoking status postcommit hook
623 C normal
633 C normal
624 C normal3
634 C normal3
625 C sub/large4
635 C sub/large4
626 C sub/normal4
636 C sub/normal4
627 C sub2/large6
637 C sub2/large6
628 C sub2/large7
638 C sub2/large7
629
639
630 Test that a standin can't be added as a large file
640 Test that a standin can't be added as a large file
631
641
632 $ touch large
642 $ touch large
633 $ hg add --large large
643 $ hg add --large large
634 $ hg ci -m "add"
644 $ hg ci -m "add"
635 Invoking status precommit hook
645 Invoking status precommit hook
636 A large
646 A large
637 Invoking status postcommit hook
647 Invoking status postcommit hook
638 C large
648 C large
639 C normal
649 C normal
640 C normal3
650 C normal3
641 C sub/large4
651 C sub/large4
642 C sub/normal4
652 C sub/normal4
643 C sub2/large6
653 C sub2/large6
644 C sub2/large7
654 C sub2/large7
645 $ hg remove large
655 $ hg remove large
646 $ touch large
656 $ touch large
647 $ hg addremove --config largefiles.patterns=**large --traceback
657 $ hg addremove --config largefiles.patterns=**large --traceback
648 adding large as a largefile
658 adding large as a largefile
649
659
650 Test that outgoing --large works (with revsets too)
660 Test that outgoing --large works (with revsets too)
651 $ hg outgoing --rev '.^' --large
661 $ hg outgoing --rev '.^' --large
652 comparing with $TESTTMP/a (glob)
662 comparing with $TESTTMP/a (glob)
653 searching for changes
663 searching for changes
654 changeset: 8:c02fd3b77ec4
664 changeset: 8:c02fd3b77ec4
655 user: test
665 user: test
656 date: Thu Jan 01 00:00:00 1970 +0000
666 date: Thu Jan 01 00:00:00 1970 +0000
657 summary: add foo
667 summary: add foo
658
668
659 changeset: 9:289dd08c9bbb
669 changeset: 9:289dd08c9bbb
660 user: test
670 user: test
661 date: Thu Jan 01 00:00:00 1970 +0000
671 date: Thu Jan 01 00:00:00 1970 +0000
662 summary: used to say nothing changed
672 summary: used to say nothing changed
663
673
664 changeset: 10:34f23ac6ac12
674 changeset: 10:34f23ac6ac12
665 user: test
675 user: test
666 date: Thu Jan 01 00:00:00 1970 +0000
676 date: Thu Jan 01 00:00:00 1970 +0000
667 summary: added
677 summary: added
668
678
669 changeset: 12:710c1b2f523c
679 changeset: 12:710c1b2f523c
670 parent: 10:34f23ac6ac12
680 parent: 10:34f23ac6ac12
671 user: test
681 user: test
672 date: Thu Jan 01 00:00:00 1970 +0000
682 date: Thu Jan 01 00:00:00 1970 +0000
673 summary: removed large
683 summary: removed large
674
684
675 changeset: 13:0a3e75774479
685 changeset: 13:0a3e75774479
676 user: test
686 user: test
677 date: Thu Jan 01 00:00:00 1970 +0000
687 date: Thu Jan 01 00:00:00 1970 +0000
678 summary: this used to add large8 as normal and commit both
688 summary: this used to add large8 as normal and commit both
679
689
680 changeset: 14:84f3d378175c
690 changeset: 14:84f3d378175c
681 user: test
691 user: test
682 date: Thu Jan 01 00:00:00 1970 +0000
692 date: Thu Jan 01 00:00:00 1970 +0000
683 summary: this used to not notice the rm
693 summary: this used to not notice the rm
684
694
685 searching for changes
695 searching for changes
686 largefiles to upload:
696 largefiles to upload:
687 large8
697 large8
688 large
698 large
689 foo
699 foo
690
700
691 $ cd ../a
701 $ cd ../a
692
702
693 Clone a largefiles repo.
703 Clone a largefiles repo.
694
704
695 $ hg clone . ../b
705 $ hg clone . ../b
696 updating to branch default
706 updating to branch default
697 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
707 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
698 getting changed largefiles
708 getting changed largefiles
699 3 largefiles updated, 0 removed
709 3 largefiles updated, 0 removed
700 $ cd ../b
710 $ cd ../b
701 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
711 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
702 7:daea875e9014 add/edit more largefiles
712 7:daea875e9014 add/edit more largefiles
703 6:4355d653f84f edit files yet again
713 6:4355d653f84f edit files yet again
704 5:9d5af5072dbd edit files again
714 5:9d5af5072dbd edit files again
705 4:74c02385b94c move files
715 4:74c02385b94c move files
706 3:9e8fbc4bce62 copy files
716 3:9e8fbc4bce62 copy files
707 2:51a0ae4d5864 remove files
717 2:51a0ae4d5864 remove files
708 1:ce8896473775 edit files
718 1:ce8896473775 edit files
709 0:30d30fe6a5be add files
719 0:30d30fe6a5be add files
710 $ cat normal3
720 $ cat normal3
711 normal33
721 normal33
712 $ cat sub/normal4
722 $ cat sub/normal4
713 normal44
723 normal44
714 $ cat sub/large4
724 $ cat sub/large4
715 large44
725 large44
716 $ cat sub2/large6
726 $ cat sub2/large6
717 large6
727 large6
718 $ cat sub2/large7
728 $ cat sub2/large7
719 large7
729 large7
720 $ cd ..
730 $ cd ..
721 $ hg clone a -r 3 c
731 $ hg clone a -r 3 c
722 adding changesets
732 adding changesets
723 adding manifests
733 adding manifests
724 adding file changes
734 adding file changes
725 added 4 changesets with 10 changes to 4 files
735 added 4 changesets with 10 changes to 4 files
726 updating to branch default
736 updating to branch default
727 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
737 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
728 getting changed largefiles
738 getting changed largefiles
729 2 largefiles updated, 0 removed
739 2 largefiles updated, 0 removed
730 $ cd c
740 $ cd c
731 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
741 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
732 3:9e8fbc4bce62 copy files
742 3:9e8fbc4bce62 copy files
733 2:51a0ae4d5864 remove files
743 2:51a0ae4d5864 remove files
734 1:ce8896473775 edit files
744 1:ce8896473775 edit files
735 0:30d30fe6a5be add files
745 0:30d30fe6a5be add files
736 $ cat normal1
746 $ cat normal1
737 normal22
747 normal22
738 $ cat large1
748 $ cat large1
739 large22
749 large22
740 $ cat sub/normal2
750 $ cat sub/normal2
741 normal22
751 normal22
742 $ cat sub/large2
752 $ cat sub/large2
743 large22
753 large22
744
754
745 Old revisions of a clone have correct largefiles content (this also
755 Old revisions of a clone have correct largefiles content (this also
746 tests update).
756 tests update).
747
757
748 $ hg update -r 1
758 $ hg update -r 1
749 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
759 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
750 getting changed largefiles
760 getting changed largefiles
751 1 largefiles updated, 0 removed
761 1 largefiles updated, 0 removed
752 $ cat large1
762 $ cat large1
753 large11
763 large11
754 $ cat sub/large2
764 $ cat sub/large2
755 large22
765 large22
756 $ cd ..
766 $ cd ..
757
767
758 Test cloning with --all-largefiles flag
768 Test cloning with --all-largefiles flag
759
769
760 $ rm "${USERCACHE}"/*
770 $ rm "${USERCACHE}"/*
761 $ hg clone --all-largefiles a a-backup
771 $ hg clone --all-largefiles a a-backup
762 updating to branch default
772 updating to branch default
763 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
773 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
764 getting changed largefiles
774 getting changed largefiles
765 3 largefiles updated, 0 removed
775 3 largefiles updated, 0 removed
766 8 additional largefiles cached
776 8 additional largefiles cached
767
777
768 $ rm "${USERCACHE}"/*
778 $ rm "${USERCACHE}"/*
769 $ hg clone --all-largefiles -u 0 a a-clone0
779 $ hg clone --all-largefiles -u 0 a a-clone0
770 updating to branch default
780 updating to branch default
771 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
781 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
772 getting changed largefiles
782 getting changed largefiles
773 2 largefiles updated, 0 removed
783 2 largefiles updated, 0 removed
774 9 additional largefiles cached
784 9 additional largefiles cached
775 $ hg -R a-clone0 sum
785 $ hg -R a-clone0 sum
776 parent: 0:30d30fe6a5be
786 parent: 0:30d30fe6a5be
777 add files
787 add files
778 branch: default
788 branch: default
779 commit: (clean)
789 commit: (clean)
780 update: 7 new changesets (update)
790 update: 7 new changesets (update)
781
791
782 $ rm "${USERCACHE}"/*
792 $ rm "${USERCACHE}"/*
783 $ hg clone --all-largefiles -u 1 a a-clone1
793 $ hg clone --all-largefiles -u 1 a a-clone1
784 updating to branch default
794 updating to branch default
785 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
795 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
786 getting changed largefiles
796 getting changed largefiles
787 2 largefiles updated, 0 removed
797 2 largefiles updated, 0 removed
788 8 additional largefiles cached
798 8 additional largefiles cached
789 $ hg -R a-clone1 sum
799 $ hg -R a-clone1 sum
790 parent: 1:ce8896473775
800 parent: 1:ce8896473775
791 edit files
801 edit files
792 branch: default
802 branch: default
793 commit: (clean)
803 commit: (clean)
794 update: 6 new changesets (update)
804 update: 6 new changesets (update)
795
805
796 $ rm "${USERCACHE}"/*
806 $ rm "${USERCACHE}"/*
797 $ hg clone --all-largefiles -U a a-clone-u
807 $ hg clone --all-largefiles -U a a-clone-u
798 11 additional largefiles cached
808 11 additional largefiles cached
799 $ hg -R a-clone-u sum
809 $ hg -R a-clone-u sum
800 parent: -1:000000000000 (no revision checked out)
810 parent: -1:000000000000 (no revision checked out)
801 branch: default
811 branch: default
802 commit: (clean)
812 commit: (clean)
803 update: 8 new changesets (update)
813 update: 8 new changesets (update)
804
814
805 $ mkdir xyz
815 $ mkdir xyz
806 $ cd xyz
816 $ cd xyz
807 $ hg clone ../a
817 $ hg clone ../a
808 destination directory: a
818 destination directory: a
809 updating to branch default
819 updating to branch default
810 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
820 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 getting changed largefiles
821 getting changed largefiles
812 3 largefiles updated, 0 removed
822 3 largefiles updated, 0 removed
813 $ cd ..
823 $ cd ..
814
824
815 Ensure base clone command argument validation
825 Ensure base clone command argument validation
816
826
817 $ hg clone -U -u 0 a a-clone-failure
827 $ hg clone -U -u 0 a a-clone-failure
818 abort: cannot specify both --noupdate and --updaterev
828 abort: cannot specify both --noupdate and --updaterev
819 [255]
829 [255]
820
830
821 $ hg clone --all-largefiles a ssh://localhost/a
831 $ hg clone --all-largefiles a ssh://localhost/a
822 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
832 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
823 [255]
833 [255]
824
834
825 Test pulling with --all-largefiles flag. Also test that the largefiles are
835 Test pulling with --all-largefiles flag. Also test that the largefiles are
826 downloaded from 'default' instead of 'default-push' when no source is specified
836 downloaded from 'default' instead of 'default-push' when no source is specified
827 (issue3584)
837 (issue3584)
828
838
829 $ rm -Rf a-backup
839 $ rm -Rf a-backup
830 $ hg clone -r 1 a a-backup
840 $ hg clone -r 1 a a-backup
831 adding changesets
841 adding changesets
832 adding manifests
842 adding manifests
833 adding file changes
843 adding file changes
834 added 2 changesets with 8 changes to 4 files
844 added 2 changesets with 8 changes to 4 files
835 updating to branch default
845 updating to branch default
836 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
846 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
837 getting changed largefiles
847 getting changed largefiles
838 2 largefiles updated, 0 removed
848 2 largefiles updated, 0 removed
839 $ rm "${USERCACHE}"/*
849 $ rm "${USERCACHE}"/*
840 $ cd a-backup
850 $ cd a-backup
841 $ hg pull --all-largefiles --config paths.default-push=bogus/path
851 $ hg pull --all-largefiles --config paths.default-push=bogus/path
842 pulling from $TESTTMP/a (glob)
852 pulling from $TESTTMP/a (glob)
843 searching for changes
853 searching for changes
844 adding changesets
854 adding changesets
845 adding manifests
855 adding manifests
846 adding file changes
856 adding file changes
847 added 6 changesets with 16 changes to 8 files
857 added 6 changesets with 16 changes to 8 files
848 (run 'hg update' to get a working copy)
858 (run 'hg update' to get a working copy)
849 caching new largefiles
859 caching new largefiles
850 3 largefiles cached
860 3 largefiles cached
851 3 additional largefiles cached
861 3 additional largefiles cached
852 $ cd ..
862 $ cd ..
853
863
854 Rebasing between two repositories does not revert largefiles to old
864 Rebasing between two repositories does not revert largefiles to old
855 revisions (this was a very bad bug that took a lot of work to fix).
865 revisions (this was a very bad bug that took a lot of work to fix).
856
866
857 $ hg clone a d
867 $ hg clone a d
858 updating to branch default
868 updating to branch default
859 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
869 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
860 getting changed largefiles
870 getting changed largefiles
861 3 largefiles updated, 0 removed
871 3 largefiles updated, 0 removed
862 $ cd b
872 $ cd b
863 $ echo large4-modified > sub/large4
873 $ echo large4-modified > sub/large4
864 $ echo normal3-modified > normal3
874 $ echo normal3-modified > normal3
865 $ hg commit -m "modify normal file and largefile in repo b"
875 $ hg commit -m "modify normal file and largefile in repo b"
866 Invoking status precommit hook
876 Invoking status precommit hook
867 M normal3
877 M normal3
868 M sub/large4
878 M sub/large4
869 $ cd ../d
879 $ cd ../d
870 $ echo large6-modified > sub2/large6
880 $ echo large6-modified > sub2/large6
871 $ echo normal4-modified > sub/normal4
881 $ echo normal4-modified > sub/normal4
872 $ hg commit -m "modify normal file largefile in repo d"
882 $ hg commit -m "modify normal file largefile in repo d"
873 Invoking status precommit hook
883 Invoking status precommit hook
874 M sub/normal4
884 M sub/normal4
875 M sub2/large6
885 M sub2/large6
876 $ cd ..
886 $ cd ..
877 $ hg clone d e
887 $ hg clone d e
878 updating to branch default
888 updating to branch default
879 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
889 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
880 getting changed largefiles
890 getting changed largefiles
881 3 largefiles updated, 0 removed
891 3 largefiles updated, 0 removed
882 $ cd d
892 $ cd d
883
893
884 More rebase testing, but also test that the largefiles are downloaded from
894 More rebase testing, but also test that the largefiles are downloaded from
885 'default' instead of 'default-push' when no source is specified (issue3584).
895 'default' instead of 'default-push' when no source is specified (issue3584).
886 The error messages go away if repo 'b' is created with --all-largefiles.
896 The error messages go away if repo 'b' is created with --all-largefiles.
887 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
897 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
888 pulling from $TESTTMP/b (glob)
898 pulling from $TESTTMP/b (glob)
889 searching for changes
899 searching for changes
890 adding changesets
900 adding changesets
891 adding manifests
901 adding manifests
892 adding file changes
902 adding file changes
893 added 1 changesets with 2 changes to 2 files (+1 heads)
903 added 1 changesets with 2 changes to 2 files (+1 heads)
894 Invoking status precommit hook
904 Invoking status precommit hook
895 M sub/normal4
905 M sub/normal4
896 M sub2/large6
906 M sub2/large6
897 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
907 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
898 large3: can't get file locally
908 large3: can't get file locally
899 (no default or default-push path set in hgrc)
909 (no default or default-push path set in hgrc)
900 sub/large4: can't get file locally
910 sub/large4: can't get file locally
901 (no default or default-push path set in hgrc)
911 (no default or default-push path set in hgrc)
902 large1: can't get file locally
912 large1: can't get file locally
903 (no default or default-push path set in hgrc)
913 (no default or default-push path set in hgrc)
904 sub/large2: can't get file locally
914 sub/large2: can't get file locally
905 (no default or default-push path set in hgrc)
915 (no default or default-push path set in hgrc)
906 sub/large2: can't get file locally
916 sub/large2: can't get file locally
907 (no default or default-push path set in hgrc)
917 (no default or default-push path set in hgrc)
908 large1: can't get file locally
918 large1: can't get file locally
909 (no default or default-push path set in hgrc)
919 (no default or default-push path set in hgrc)
910 sub/large2: can't get file locally
920 sub/large2: can't get file locally
911 (no default or default-push path set in hgrc)
921 (no default or default-push path set in hgrc)
912 large1: can't get file locally
922 large1: can't get file locally
913 (no default or default-push path set in hgrc)
923 (no default or default-push path set in hgrc)
914 sub/large2: can't get file locally
924 sub/large2: can't get file locally
915 (no default or default-push path set in hgrc)
925 (no default or default-push path set in hgrc)
916 0 additional largefiles cached
926 0 additional largefiles cached
917 9 largefiles failed to download
927 9 largefiles failed to download
918 nothing to rebase
928 nothing to rebase
919 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
929 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
920 9:598410d3eb9a modify normal file largefile in repo d
930 9:598410d3eb9a modify normal file largefile in repo d
921 8:a381d2c8c80e modify normal file and largefile in repo b
931 8:a381d2c8c80e modify normal file and largefile in repo b
922 7:daea875e9014 add/edit more largefiles
932 7:daea875e9014 add/edit more largefiles
923 6:4355d653f84f edit files yet again
933 6:4355d653f84f edit files yet again
924 5:9d5af5072dbd edit files again
934 5:9d5af5072dbd edit files again
925 4:74c02385b94c move files
935 4:74c02385b94c move files
926 3:9e8fbc4bce62 copy files
936 3:9e8fbc4bce62 copy files
927 2:51a0ae4d5864 remove files
937 2:51a0ae4d5864 remove files
928 1:ce8896473775 edit files
938 1:ce8896473775 edit files
929 0:30d30fe6a5be add files
939 0:30d30fe6a5be add files
930 $ cat normal3
940 $ cat normal3
931 normal3-modified
941 normal3-modified
932 $ cat sub/normal4
942 $ cat sub/normal4
933 normal4-modified
943 normal4-modified
934 $ cat sub/large4
944 $ cat sub/large4
935 large4-modified
945 large4-modified
936 $ cat sub2/large6
946 $ cat sub2/large6
937 large6-modified
947 large6-modified
938 $ cat sub2/large7
948 $ cat sub2/large7
939 large7
949 large7
940 $ cd ../e
950 $ cd ../e
941 $ hg pull ../b
951 $ hg pull ../b
942 pulling from ../b
952 pulling from ../b
943 searching for changes
953 searching for changes
944 adding changesets
954 adding changesets
945 adding manifests
955 adding manifests
946 adding file changes
956 adding file changes
947 added 1 changesets with 2 changes to 2 files (+1 heads)
957 added 1 changesets with 2 changes to 2 files (+1 heads)
948 (run 'hg heads' to see heads, 'hg merge' to merge)
958 (run 'hg heads' to see heads, 'hg merge' to merge)
949 caching new largefiles
959 caching new largefiles
950 0 largefiles cached
960 0 largefiles cached
951 $ hg rebase
961 $ hg rebase
952 Invoking status precommit hook
962 Invoking status precommit hook
953 M sub/normal4
963 M sub/normal4
954 M sub2/large6
964 M sub2/large6
955 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
965 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
956 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
966 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
957 9:598410d3eb9a modify normal file largefile in repo d
967 9:598410d3eb9a modify normal file largefile in repo d
958 8:a381d2c8c80e modify normal file and largefile in repo b
968 8:a381d2c8c80e modify normal file and largefile in repo b
959 7:daea875e9014 add/edit more largefiles
969 7:daea875e9014 add/edit more largefiles
960 6:4355d653f84f edit files yet again
970 6:4355d653f84f edit files yet again
961 5:9d5af5072dbd edit files again
971 5:9d5af5072dbd edit files again
962 4:74c02385b94c move files
972 4:74c02385b94c move files
963 3:9e8fbc4bce62 copy files
973 3:9e8fbc4bce62 copy files
964 2:51a0ae4d5864 remove files
974 2:51a0ae4d5864 remove files
965 1:ce8896473775 edit files
975 1:ce8896473775 edit files
966 0:30d30fe6a5be add files
976 0:30d30fe6a5be add files
967 $ cat normal3
977 $ cat normal3
968 normal3-modified
978 normal3-modified
969 $ cat sub/normal4
979 $ cat sub/normal4
970 normal4-modified
980 normal4-modified
971 $ cat sub/large4
981 $ cat sub/large4
972 large4-modified
982 large4-modified
973 $ cat sub2/large6
983 $ cat sub2/large6
974 large6-modified
984 large6-modified
975 $ cat sub2/large7
985 $ cat sub2/large7
976 large7
986 large7
977
987
978 Rollback on largefiles.
988 Rollback on largefiles.
979
989
980 $ echo large4-modified-again > sub/large4
990 $ echo large4-modified-again > sub/large4
981 $ hg commit -m "Modify large4 again"
991 $ hg commit -m "Modify large4 again"
982 Invoking status precommit hook
992 Invoking status precommit hook
983 M sub/large4
993 M sub/large4
984 $ hg rollback
994 $ hg rollback
985 repository tip rolled back to revision 9 (undo commit)
995 repository tip rolled back to revision 9 (undo commit)
986 working directory now based on revision 9
996 working directory now based on revision 9
987 $ hg st
997 $ hg st
988 M sub/large4
998 M sub/large4
989 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
999 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
990 9:598410d3eb9a modify normal file largefile in repo d
1000 9:598410d3eb9a modify normal file largefile in repo d
991 8:a381d2c8c80e modify normal file and largefile in repo b
1001 8:a381d2c8c80e modify normal file and largefile in repo b
992 7:daea875e9014 add/edit more largefiles
1002 7:daea875e9014 add/edit more largefiles
993 6:4355d653f84f edit files yet again
1003 6:4355d653f84f edit files yet again
994 5:9d5af5072dbd edit files again
1004 5:9d5af5072dbd edit files again
995 4:74c02385b94c move files
1005 4:74c02385b94c move files
996 3:9e8fbc4bce62 copy files
1006 3:9e8fbc4bce62 copy files
997 2:51a0ae4d5864 remove files
1007 2:51a0ae4d5864 remove files
998 1:ce8896473775 edit files
1008 1:ce8896473775 edit files
999 0:30d30fe6a5be add files
1009 0:30d30fe6a5be add files
1000 $ cat sub/large4
1010 $ cat sub/large4
1001 large4-modified-again
1011 large4-modified-again
1002
1012
1003 "update --check" refuses to update with uncommitted changes.
1013 "update --check" refuses to update with uncommitted changes.
1004 $ hg update --check 8
1014 $ hg update --check 8
1005 abort: uncommitted local changes
1015 abort: uncommitted local changes
1006 [255]
1016 [255]
1007
1017
1008 "update --clean" leaves correct largefiles in working copy.
1018 "update --clean" leaves correct largefiles in working copy.
1009
1019
1010 $ hg update --clean
1020 $ hg update --clean
1011 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1021 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1012 getting changed largefiles
1022 getting changed largefiles
1013 1 largefiles updated, 0 removed
1023 1 largefiles updated, 0 removed
1014 $ cat normal3
1024 $ cat normal3
1015 normal3-modified
1025 normal3-modified
1016 $ cat sub/normal4
1026 $ cat sub/normal4
1017 normal4-modified
1027 normal4-modified
1018 $ cat sub/large4
1028 $ cat sub/large4
1019 large4-modified
1029 large4-modified
1020 $ cat sub2/large6
1030 $ cat sub2/large6
1021 large6-modified
1031 large6-modified
1022 $ cat sub2/large7
1032 $ cat sub2/large7
1023 large7
1033 large7
1024
1034
1025 Now "update check" is happy.
1035 Now "update check" is happy.
1026 $ hg update --check 8
1036 $ hg update --check 8
1027 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1037 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1028 getting changed largefiles
1038 getting changed largefiles
1029 1 largefiles updated, 0 removed
1039 1 largefiles updated, 0 removed
1030 $ hg update --check
1040 $ hg update --check
1031 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1041 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1032 getting changed largefiles
1042 getting changed largefiles
1033 1 largefiles updated, 0 removed
1043 1 largefiles updated, 0 removed
1034
1044
1035 Test removing empty largefiles directories on update
1045 Test removing empty largefiles directories on update
1036 $ test -d sub2 && echo "sub2 exists"
1046 $ test -d sub2 && echo "sub2 exists"
1037 sub2 exists
1047 sub2 exists
1038 $ hg update -q null
1048 $ hg update -q null
1039 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1049 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1040 [1]
1050 [1]
1041 $ hg update -q
1051 $ hg update -q
1042
1052
1043 Test hg remove removes empty largefiles directories
1053 Test hg remove removes empty largefiles directories
1044 $ test -d sub2 && echo "sub2 exists"
1054 $ test -d sub2 && echo "sub2 exists"
1045 sub2 exists
1055 sub2 exists
1046 $ hg remove sub2/*
1056 $ hg remove sub2/*
1047 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1057 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1048 [1]
1058 [1]
1049 $ hg revert sub2/large6 sub2/large7
1059 $ hg revert sub2/large6 sub2/large7
1050
1060
1051 "revert" works on largefiles (and normal files too).
1061 "revert" works on largefiles (and normal files too).
1052 $ echo hack3 >> normal3
1062 $ echo hack3 >> normal3
1053 $ echo hack4 >> sub/normal4
1063 $ echo hack4 >> sub/normal4
1054 $ echo hack4 >> sub/large4
1064 $ echo hack4 >> sub/large4
1055 $ rm sub2/large6
1065 $ rm sub2/large6
1056 $ hg revert sub2/large6
1066 $ hg revert sub2/large6
1057 $ hg rm sub2/large6
1067 $ hg rm sub2/large6
1058 $ echo new >> sub2/large8
1068 $ echo new >> sub2/large8
1059 $ hg add --large sub2/large8
1069 $ hg add --large sub2/large8
1060 # XXX we don't really want to report that we're reverting the standin;
1070 # XXX we don't really want to report that we're reverting the standin;
1061 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1071 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1062 $ hg revert sub
1072 $ hg revert sub
1063 reverting .hglf/sub/large4 (glob)
1073 reverting .hglf/sub/large4 (glob)
1064 reverting sub/normal4 (glob)
1074 reverting sub/normal4 (glob)
1065 $ hg status
1075 $ hg status
1066 M normal3
1076 M normal3
1067 A sub2/large8
1077 A sub2/large8
1068 R sub2/large6
1078 R sub2/large6
1069 ? sub/large4.orig
1079 ? sub/large4.orig
1070 ? sub/normal4.orig
1080 ? sub/normal4.orig
1071 $ cat sub/normal4
1081 $ cat sub/normal4
1072 normal4-modified
1082 normal4-modified
1073 $ cat sub/large4
1083 $ cat sub/large4
1074 large4-modified
1084 large4-modified
1075 $ hg revert -a --no-backup
1085 $ hg revert -a --no-backup
1076 undeleting .hglf/sub2/large6 (glob)
1086 undeleting .hglf/sub2/large6 (glob)
1077 forgetting .hglf/sub2/large8 (glob)
1087 forgetting .hglf/sub2/large8 (glob)
1078 reverting normal3
1088 reverting normal3
1079 $ hg status
1089 $ hg status
1080 ? sub/large4.orig
1090 ? sub/large4.orig
1081 ? sub/normal4.orig
1091 ? sub/normal4.orig
1082 ? sub2/large8
1092 ? sub2/large8
1083 $ cat normal3
1093 $ cat normal3
1084 normal3-modified
1094 normal3-modified
1085 $ cat sub2/large6
1095 $ cat sub2/large6
1086 large6-modified
1096 large6-modified
1087 $ rm sub/*.orig sub2/large8
1097 $ rm sub/*.orig sub2/large8
1088
1098
1089 revert some files to an older revision
1099 revert some files to an older revision
1090 $ hg revert --no-backup -r 8 sub2
1100 $ hg revert --no-backup -r 8 sub2
1091 reverting .hglf/sub2/large6 (glob)
1101 reverting .hglf/sub2/large6 (glob)
1092 $ cat sub2/large6
1102 $ cat sub2/large6
1093 large6
1103 large6
1094 $ hg revert --no-backup -C -r '.^' sub2
1104 $ hg revert --no-backup -C -r '.^' sub2
1095 reverting .hglf/sub2/large6 (glob)
1105 reverting .hglf/sub2/large6 (glob)
1096 $ hg revert --no-backup sub2
1106 $ hg revert --no-backup sub2
1097 reverting .hglf/sub2/large6 (glob)
1107 reverting .hglf/sub2/large6 (glob)
1098 $ hg status
1108 $ hg status
1099
1109
1100 "verify --large" actually verifies largefiles
1110 "verify --large" actually verifies largefiles
1101
1111
1102 $ hg verify --large
1112 $ hg verify --large
1103 checking changesets
1113 checking changesets
1104 checking manifests
1114 checking manifests
1105 crosschecking files in changesets and manifests
1115 crosschecking files in changesets and manifests
1106 checking files
1116 checking files
1107 10 files, 10 changesets, 28 total revisions
1117 10 files, 10 changesets, 28 total revisions
1108 searching 1 changesets for largefiles
1118 searching 1 changesets for largefiles
1109 verified existence of 3 revisions of 3 largefiles
1119 verified existence of 3 revisions of 3 largefiles
1110
1120
1111 Merging does not revert to old versions of largefiles and also check
1121 Merging does not revert to old versions of largefiles and also check
1112 that merging after having pulled from a non-default remote works
1122 that merging after having pulled from a non-default remote works
1113 correctly.
1123 correctly.
1114
1124
1115 $ cd ..
1125 $ cd ..
1116 $ hg clone -r 7 e temp
1126 $ hg clone -r 7 e temp
1117 adding changesets
1127 adding changesets
1118 adding manifests
1128 adding manifests
1119 adding file changes
1129 adding file changes
1120 added 8 changesets with 24 changes to 10 files
1130 added 8 changesets with 24 changes to 10 files
1121 updating to branch default
1131 updating to branch default
1122 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1132 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1123 getting changed largefiles
1133 getting changed largefiles
1124 3 largefiles updated, 0 removed
1134 3 largefiles updated, 0 removed
1125 $ hg clone temp f
1135 $ hg clone temp f
1126 updating to branch default
1136 updating to branch default
1127 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1137 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1128 getting changed largefiles
1138 getting changed largefiles
1129 3 largefiles updated, 0 removed
1139 3 largefiles updated, 0 removed
1130 # Delete the largefiles in the largefiles system cache so that we have an
1140 # Delete the largefiles in the largefiles system cache so that we have an
1131 # opportunity to test that caching after a pull works.
1141 # opportunity to test that caching after a pull works.
1132 $ rm "${USERCACHE}"/*
1142 $ rm "${USERCACHE}"/*
1133 $ cd f
1143 $ cd f
1134 $ echo "large4-merge-test" > sub/large4
1144 $ echo "large4-merge-test" > sub/large4
1135 $ hg commit -m "Modify large4 to test merge"
1145 $ hg commit -m "Modify large4 to test merge"
1136 Invoking status precommit hook
1146 Invoking status precommit hook
1137 M sub/large4
1147 M sub/large4
1138 $ hg pull ../e
1148 $ hg pull ../e
1139 pulling from ../e
1149 pulling from ../e
1140 searching for changes
1150 searching for changes
1141 adding changesets
1151 adding changesets
1142 adding manifests
1152 adding manifests
1143 adding file changes
1153 adding file changes
1144 added 2 changesets with 4 changes to 4 files (+1 heads)
1154 added 2 changesets with 4 changes to 4 files (+1 heads)
1145 (run 'hg heads' to see heads, 'hg merge' to merge)
1155 (run 'hg heads' to see heads, 'hg merge' to merge)
1146 caching new largefiles
1156 caching new largefiles
1147 2 largefiles cached
1157 2 largefiles cached
1148 $ hg merge
1158 $ hg merge
1149 merging sub/large4
1159 merging sub/large4
1150 largefile sub/large4 has a merge conflict
1160 largefile sub/large4 has a merge conflict
1151 keep (l)ocal or take (o)ther? l
1161 keep (l)ocal or take (o)ther? l
1152 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1162 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1153 (branch merge, don't forget to commit)
1163 (branch merge, don't forget to commit)
1154 getting changed largefiles
1164 getting changed largefiles
1155 1 largefiles updated, 0 removed
1165 1 largefiles updated, 0 removed
1156 $ hg commit -m "Merge repos e and f"
1166 $ hg commit -m "Merge repos e and f"
1157 Invoking status precommit hook
1167 Invoking status precommit hook
1158 M normal3
1168 M normal3
1159 M sub/normal4
1169 M sub/normal4
1160 M sub2/large6
1170 M sub2/large6
1161 $ cat normal3
1171 $ cat normal3
1162 normal3-modified
1172 normal3-modified
1163 $ cat sub/normal4
1173 $ cat sub/normal4
1164 normal4-modified
1174 normal4-modified
1165 $ cat sub/large4
1175 $ cat sub/large4
1166 large4-merge-test
1176 large4-merge-test
1167 $ cat sub2/large6
1177 $ cat sub2/large6
1168 large6-modified
1178 large6-modified
1169 $ cat sub2/large7
1179 $ cat sub2/large7
1170 large7
1180 large7
1171
1181
1172 Test status after merging with a branch that introduces a new largefile:
1182 Test status after merging with a branch that introduces a new largefile:
1173
1183
1174 $ echo large > large
1184 $ echo large > large
1175 $ hg add --large large
1185 $ hg add --large large
1176 $ hg commit -m 'add largefile'
1186 $ hg commit -m 'add largefile'
1177 Invoking status precommit hook
1187 Invoking status precommit hook
1178 A large
1188 A large
1179 $ hg update -q ".^"
1189 $ hg update -q ".^"
1180 $ echo change >> normal3
1190 $ echo change >> normal3
1181 $ hg commit -m 'some change'
1191 $ hg commit -m 'some change'
1182 Invoking status precommit hook
1192 Invoking status precommit hook
1183 M normal3
1193 M normal3
1184 created new head
1194 created new head
1185 $ hg merge
1195 $ hg merge
1186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1196 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1187 (branch merge, don't forget to commit)
1197 (branch merge, don't forget to commit)
1188 getting changed largefiles
1198 getting changed largefiles
1189 1 largefiles updated, 0 removed
1199 1 largefiles updated, 0 removed
1190 $ hg status
1200 $ hg status
1191 M large
1201 M large
1192
1202
1193 Test that a normal file and a largefile with the same name and path cannot
1203 Test that a normal file and a largefile with the same name and path cannot
1194 coexist.
1204 coexist.
1195
1205
1196 $ rm sub2/large7
1206 $ rm sub2/large7
1197 $ echo "largeasnormal" > sub2/large7
1207 $ echo "largeasnormal" > sub2/large7
1198 $ hg add sub2/large7
1208 $ hg add sub2/large7
1199 sub2/large7 already a largefile
1209 sub2/large7 already a largefile
1200
1210
1201 Test that transplanting a largefile change works correctly.
1211 Test that transplanting a largefile change works correctly.
1202
1212
1203 $ cd ..
1213 $ cd ..
1204 $ hg clone -r 8 d g
1214 $ hg clone -r 8 d g
1205 adding changesets
1215 adding changesets
1206 adding manifests
1216 adding manifests
1207 adding file changes
1217 adding file changes
1208 added 9 changesets with 26 changes to 10 files
1218 added 9 changesets with 26 changes to 10 files
1209 updating to branch default
1219 updating to branch default
1210 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1220 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1211 getting changed largefiles
1221 getting changed largefiles
1212 3 largefiles updated, 0 removed
1222 3 largefiles updated, 0 removed
1213 $ cd g
1223 $ cd g
1214 $ hg transplant -s ../d 598410d3eb9a
1224 $ hg transplant -s ../d 598410d3eb9a
1215 searching for changes
1225 searching for changes
1216 searching for changes
1226 searching for changes
1217 adding changesets
1227 adding changesets
1218 adding manifests
1228 adding manifests
1219 adding file changes
1229 adding file changes
1220 added 1 changesets with 2 changes to 2 files
1230 added 1 changesets with 2 changes to 2 files
1221 getting changed largefiles
1231 getting changed largefiles
1222 1 largefiles updated, 0 removed
1232 1 largefiles updated, 0 removed
1223 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1233 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1224 9:598410d3eb9a modify normal file largefile in repo d
1234 9:598410d3eb9a modify normal file largefile in repo d
1225 8:a381d2c8c80e modify normal file and largefile in repo b
1235 8:a381d2c8c80e modify normal file and largefile in repo b
1226 7:daea875e9014 add/edit more largefiles
1236 7:daea875e9014 add/edit more largefiles
1227 6:4355d653f84f edit files yet again
1237 6:4355d653f84f edit files yet again
1228 5:9d5af5072dbd edit files again
1238 5:9d5af5072dbd edit files again
1229 4:74c02385b94c move files
1239 4:74c02385b94c move files
1230 3:9e8fbc4bce62 copy files
1240 3:9e8fbc4bce62 copy files
1231 2:51a0ae4d5864 remove files
1241 2:51a0ae4d5864 remove files
1232 1:ce8896473775 edit files
1242 1:ce8896473775 edit files
1233 0:30d30fe6a5be add files
1243 0:30d30fe6a5be add files
1234 $ cat normal3
1244 $ cat normal3
1235 normal3-modified
1245 normal3-modified
1236 $ cat sub/normal4
1246 $ cat sub/normal4
1237 normal4-modified
1247 normal4-modified
1238 $ cat sub/large4
1248 $ cat sub/large4
1239 large4-modified
1249 large4-modified
1240 $ cat sub2/large6
1250 $ cat sub2/large6
1241 large6-modified
1251 large6-modified
1242 $ cat sub2/large7
1252 $ cat sub2/large7
1243 large7
1253 large7
1244
1254
1245 Cat a largefile
1255 Cat a largefile
1246 $ hg cat normal3
1256 $ hg cat normal3
1247 normal3-modified
1257 normal3-modified
1248 $ hg cat sub/large4
1258 $ hg cat sub/large4
1249 large4-modified
1259 large4-modified
1250 $ rm "${USERCACHE}"/*
1260 $ rm "${USERCACHE}"/*
1251 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1261 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1252 $ cat cat.out
1262 $ cat cat.out
1253 large4-modified
1263 large4-modified
1254 $ rm cat.out
1264 $ rm cat.out
1255 $ hg cat -r a381d2c8c80e normal3
1265 $ hg cat -r a381d2c8c80e normal3
1256 normal3-modified
1266 normal3-modified
1257 $ hg cat -r '.^' normal3
1267 $ hg cat -r '.^' normal3
1258 normal3-modified
1268 normal3-modified
1259 $ hg cat -r '.^' sub/large4
1269 $ hg cat -r '.^' sub/large4
1260 large4-modified
1270 large4-modified
1261
1271
1262 Test that renaming a largefile results in correct output for status
1272 Test that renaming a largefile results in correct output for status
1263
1273
1264 $ hg rename sub/large4 large4-renamed
1274 $ hg rename sub/large4 large4-renamed
1265 $ hg commit -m "test rename output"
1275 $ hg commit -m "test rename output"
1266 Invoking status precommit hook
1276 Invoking status precommit hook
1267 A large4-renamed
1277 A large4-renamed
1268 R sub/large4
1278 R sub/large4
1269 $ cat large4-renamed
1279 $ cat large4-renamed
1270 large4-modified
1280 large4-modified
1271 $ cd sub2
1281 $ cd sub2
1272 $ hg rename large6 large6-renamed
1282 $ hg rename large6 large6-renamed
1273 $ hg st
1283 $ hg st
1274 A sub2/large6-renamed
1284 A sub2/large6-renamed
1275 R sub2/large6
1285 R sub2/large6
1276 $ cd ..
1286 $ cd ..
1277
1287
1278 Test --normal flag
1288 Test --normal flag
1279
1289
1280 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1290 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1281 $ hg add --normal --large new-largefile
1291 $ hg add --normal --large new-largefile
1282 abort: --normal cannot be used with --large
1292 abort: --normal cannot be used with --large
1283 [255]
1293 [255]
1284 $ hg add --normal new-largefile
1294 $ hg add --normal new-largefile
1285 new-largefile: up to 69 MB of RAM may be required to manage this file
1295 new-largefile: up to 69 MB of RAM may be required to manage this file
1286 (use 'hg revert new-largefile' to cancel the pending addition)
1296 (use 'hg revert new-largefile' to cancel the pending addition)
1287 $ cd ..
1297 $ cd ..
1288
1298
1289 #if serve
1299 #if serve
1290 vanilla clients not locked out from largefiles servers on vanilla repos
1300 vanilla clients not locked out from largefiles servers on vanilla repos
1291 $ mkdir r1
1301 $ mkdir r1
1292 $ cd r1
1302 $ cd r1
1293 $ hg init
1303 $ hg init
1294 $ echo c1 > f1
1304 $ echo c1 > f1
1295 $ hg add f1
1305 $ hg add f1
1296 $ hg commit -m "m1"
1306 $ hg commit -m "m1"
1297 Invoking status precommit hook
1307 Invoking status precommit hook
1298 A f1
1308 A f1
1299 $ cd ..
1309 $ cd ..
1300 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1310 $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid
1301 $ cat hg.pid >> $DAEMON_PIDS
1311 $ cat hg.pid >> $DAEMON_PIDS
1302 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1312 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2
1303 requesting all changes
1313 requesting all changes
1304 adding changesets
1314 adding changesets
1305 adding manifests
1315 adding manifests
1306 adding file changes
1316 adding file changes
1307 added 1 changesets with 1 changes to 1 files
1317 added 1 changesets with 1 changes to 1 files
1308 updating to branch default
1318 updating to branch default
1309 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1319 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1310
1320
1311 largefiles clients still work with vanilla servers
1321 largefiles clients still work with vanilla servers
1312 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1322 $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid
1313 $ cat hg.pid >> $DAEMON_PIDS
1323 $ cat hg.pid >> $DAEMON_PIDS
1314 $ hg clone http://localhost:$HGPORT1 r3
1324 $ hg clone http://localhost:$HGPORT1 r3
1315 requesting all changes
1325 requesting all changes
1316 adding changesets
1326 adding changesets
1317 adding manifests
1327 adding manifests
1318 adding file changes
1328 adding file changes
1319 added 1 changesets with 1 changes to 1 files
1329 added 1 changesets with 1 changes to 1 files
1320 updating to branch default
1330 updating to branch default
1321 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1322 #endif
1332 #endif
1323
1333
1324
1334
1325 vanilla clients locked out from largefiles http repos
1335 vanilla clients locked out from largefiles http repos
1326 $ mkdir r4
1336 $ mkdir r4
1327 $ cd r4
1337 $ cd r4
1328 $ hg init
1338 $ hg init
1329 $ echo c1 > f1
1339 $ echo c1 > f1
1330 $ hg add --large f1
1340 $ hg add --large f1
1331 $ hg commit -m "m1"
1341 $ hg commit -m "m1"
1332 Invoking status precommit hook
1342 Invoking status precommit hook
1333 A f1
1343 A f1
1334 $ cd ..
1344 $ cd ..
1335
1345
1336 largefiles can be pushed locally (issue3583)
1346 largefiles can be pushed locally (issue3583)
1337 $ hg init dest
1347 $ hg init dest
1338 $ cd r4
1348 $ cd r4
1339 $ hg outgoing ../dest
1349 $ hg outgoing ../dest
1340 comparing with ../dest
1350 comparing with ../dest
1341 searching for changes
1351 searching for changes
1342 changeset: 0:639881c12b4c
1352 changeset: 0:639881c12b4c
1343 tag: tip
1353 tag: tip
1344 user: test
1354 user: test
1345 date: Thu Jan 01 00:00:00 1970 +0000
1355 date: Thu Jan 01 00:00:00 1970 +0000
1346 summary: m1
1356 summary: m1
1347
1357
1348 $ hg push ../dest
1358 $ hg push ../dest
1349 pushing to ../dest
1359 pushing to ../dest
1350 searching for changes
1360 searching for changes
1351 searching for changes
1361 searching for changes
1352 adding changesets
1362 adding changesets
1353 adding manifests
1363 adding manifests
1354 adding file changes
1364 adding file changes
1355 added 1 changesets with 1 changes to 1 files
1365 added 1 changesets with 1 changes to 1 files
1356
1366
1357 exit code with nothing outgoing (issue3611)
1367 exit code with nothing outgoing (issue3611)
1358 $ hg outgoing ../dest
1368 $ hg outgoing ../dest
1359 comparing with ../dest
1369 comparing with ../dest
1360 searching for changes
1370 searching for changes
1361 no changes found
1371 no changes found
1362 [1]
1372 [1]
1363 $ cd ..
1373 $ cd ..
1364
1374
1365 #if serve
1375 #if serve
1366 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1376 $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
1367 $ cat hg.pid >> $DAEMON_PIDS
1377 $ cat hg.pid >> $DAEMON_PIDS
1368 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1378 $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5
1369 abort: remote error:
1379 abort: remote error:
1370
1380
1371 This repository uses the largefiles extension.
1381 This repository uses the largefiles extension.
1372
1382
1373 Please enable it in your Mercurial config file.
1383 Please enable it in your Mercurial config file.
1374 [255]
1384 [255]
1375
1385
1376 used all HGPORTs, kill all daemons
1386 used all HGPORTs, kill all daemons
1377 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1387 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1378 #endif
1388 #endif
1379
1389
1380 vanilla clients locked out from largefiles ssh repos
1390 vanilla clients locked out from largefiles ssh repos
1381 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1391 $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5
1382 abort: remote error:
1392 abort: remote error:
1383
1393
1384 This repository uses the largefiles extension.
1394 This repository uses the largefiles extension.
1385
1395
1386 Please enable it in your Mercurial config file.
1396 Please enable it in your Mercurial config file.
1387 [255]
1397 [255]
1388
1398
1389 #if serve
1399 #if serve
1390
1400
1391 largefiles clients refuse to push largefiles repos to vanilla servers
1401 largefiles clients refuse to push largefiles repos to vanilla servers
1392 $ mkdir r6
1402 $ mkdir r6
1393 $ cd r6
1403 $ cd r6
1394 $ hg init
1404 $ hg init
1395 $ echo c1 > f1
1405 $ echo c1 > f1
1396 $ hg add f1
1406 $ hg add f1
1397 $ hg commit -m "m1"
1407 $ hg commit -m "m1"
1398 Invoking status precommit hook
1408 Invoking status precommit hook
1399 A f1
1409 A f1
1400 $ cat >> .hg/hgrc <<!
1410 $ cat >> .hg/hgrc <<!
1401 > [web]
1411 > [web]
1402 > push_ssl = false
1412 > push_ssl = false
1403 > allow_push = *
1413 > allow_push = *
1404 > !
1414 > !
1405 $ cd ..
1415 $ cd ..
1406 $ hg clone r6 r7
1416 $ hg clone r6 r7
1407 updating to branch default
1417 updating to branch default
1408 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1418 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1409 $ cd r7
1419 $ cd r7
1410 $ echo c2 > f2
1420 $ echo c2 > f2
1411 $ hg add --large f2
1421 $ hg add --large f2
1412 $ hg commit -m "m2"
1422 $ hg commit -m "m2"
1413 Invoking status precommit hook
1423 Invoking status precommit hook
1414 A f2
1424 A f2
1415 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1425 $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid
1416 $ cat ../hg.pid >> $DAEMON_PIDS
1426 $ cat ../hg.pid >> $DAEMON_PIDS
1417 $ hg push http://localhost:$HGPORT
1427 $ hg push http://localhost:$HGPORT
1418 pushing to http://localhost:$HGPORT/
1428 pushing to http://localhost:$HGPORT/
1419 searching for changes
1429 searching for changes
1420 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1430 abort: http://localhost:$HGPORT/ does not appear to be a largefile store
1421 [255]
1431 [255]
1422 $ cd ..
1432 $ cd ..
1423
1433
1424 putlfile errors are shown (issue3123)
1434 putlfile errors are shown (issue3123)
1425 Corrupt the cached largefile in r7 and in the usercache (required for testing on vfat)
1435 Corrupt the cached largefile in r7 and in the usercache (required for testing on vfat)
1426 $ echo corruption > "$TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8"
1436 $ echo corruption > "$TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8"
1427 $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1437 $ echo corruption > "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8"
1428 $ hg init empty
1438 $ hg init empty
1429 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1439 $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \
1430 > --config 'web.allow_push=*' --config web.push_ssl=False
1440 > --config 'web.allow_push=*' --config web.push_ssl=False
1431 $ cat hg.pid >> $DAEMON_PIDS
1441 $ cat hg.pid >> $DAEMON_PIDS
1432 $ hg push -R r7 http://localhost:$HGPORT1
1442 $ hg push -R r7 http://localhost:$HGPORT1
1433 pushing to http://localhost:$HGPORT1/
1443 pushing to http://localhost:$HGPORT1/
1434 searching for changes
1444 searching for changes
1435 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1445 remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
1436 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1446 abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
1437 [255]
1447 [255]
1438 $ rm -rf empty
1448 $ rm -rf empty
1439
1449
1440 Push a largefiles repository to a served empty repository
1450 Push a largefiles repository to a served empty repository
1441 $ hg init r8
1451 $ hg init r8
1442 $ echo c3 > r8/f1
1452 $ echo c3 > r8/f1
1443 $ hg add --large r8/f1 -R r8
1453 $ hg add --large r8/f1 -R r8
1444 $ hg commit -m "m1" -R r8
1454 $ hg commit -m "m1" -R r8
1445 Invoking status precommit hook
1455 Invoking status precommit hook
1446 A f1
1456 A f1
1447 $ hg init empty
1457 $ hg init empty
1448 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1458 $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
1449 > --config 'web.allow_push=*' --config web.push_ssl=False
1459 > --config 'web.allow_push=*' --config web.push_ssl=False
1450 $ cat hg.pid >> $DAEMON_PIDS
1460 $ cat hg.pid >> $DAEMON_PIDS
1451 $ rm "${USERCACHE}"/*
1461 $ rm "${USERCACHE}"/*
1452 $ hg push -R r8 http://localhost:$HGPORT2
1462 $ hg push -R r8 http://localhost:$HGPORT2
1453 pushing to http://localhost:$HGPORT2/
1463 pushing to http://localhost:$HGPORT2/
1454 searching for changes
1464 searching for changes
1455 searching for changes
1465 searching for changes
1456 remote: adding changesets
1466 remote: adding changesets
1457 remote: adding manifests
1467 remote: adding manifests
1458 remote: adding file changes
1468 remote: adding file changes
1459 remote: added 1 changesets with 1 changes to 1 files
1469 remote: added 1 changesets with 1 changes to 1 files
1460 $ rm -rf empty
1470 $ rm -rf empty
1461
1471
1462 used all HGPORTs, kill all daemons
1472 used all HGPORTs, kill all daemons
1463 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1473 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1464
1474
1465 #endif
1475 #endif
1466
1476
1467
1477
1468 #if unix-permissions
1478 #if unix-permissions
1469
1479
1470 Clone a local repository owned by another user
1480 Clone a local repository owned by another user
1471 We have to simulate that here by setting $HOME and removing write permissions
1481 We have to simulate that here by setting $HOME and removing write permissions
1472 $ ORIGHOME="$HOME"
1482 $ ORIGHOME="$HOME"
1473 $ mkdir alice
1483 $ mkdir alice
1474 $ HOME="`pwd`/alice"
1484 $ HOME="`pwd`/alice"
1475 $ cd alice
1485 $ cd alice
1476 $ hg init pubrepo
1486 $ hg init pubrepo
1477 $ cd pubrepo
1487 $ cd pubrepo
1478 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1488 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
1479 $ hg add --large a-large-file
1489 $ hg add --large a-large-file
1480 $ hg commit -m "Add a large file"
1490 $ hg commit -m "Add a large file"
1481 Invoking status precommit hook
1491 Invoking status precommit hook
1482 A a-large-file
1492 A a-large-file
1483 $ cd ..
1493 $ cd ..
1484 $ chmod -R a-w pubrepo
1494 $ chmod -R a-w pubrepo
1485 $ cd ..
1495 $ cd ..
1486 $ mkdir bob
1496 $ mkdir bob
1487 $ HOME="`pwd`/bob"
1497 $ HOME="`pwd`/bob"
1488 $ cd bob
1498 $ cd bob
1489 $ hg clone --pull ../alice/pubrepo pubrepo
1499 $ hg clone --pull ../alice/pubrepo pubrepo
1490 requesting all changes
1500 requesting all changes
1491 adding changesets
1501 adding changesets
1492 adding manifests
1502 adding manifests
1493 adding file changes
1503 adding file changes
1494 added 1 changesets with 1 changes to 1 files
1504 added 1 changesets with 1 changes to 1 files
1495 updating to branch default
1505 updating to branch default
1496 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1506 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1497 getting changed largefiles
1507 getting changed largefiles
1498 1 largefiles updated, 0 removed
1508 1 largefiles updated, 0 removed
1499 $ cd ..
1509 $ cd ..
1500 $ chmod -R u+w alice/pubrepo
1510 $ chmod -R u+w alice/pubrepo
1501 $ HOME="$ORIGHOME"
1511 $ HOME="$ORIGHOME"
1502
1512
1503 #endif
1513 #endif
1504
1514
1505 #if symlink
1515 #if symlink
1506
1516
1507 Symlink to a large largefile should behave the same as a symlink to a normal file
1517 Symlink to a large largefile should behave the same as a symlink to a normal file
1508 $ hg init largesymlink
1518 $ hg init largesymlink
1509 $ cd largesymlink
1519 $ cd largesymlink
1510 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1520 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
1511 $ hg add --large largefile
1521 $ hg add --large largefile
1512 $ hg commit -m "commit a large file"
1522 $ hg commit -m "commit a large file"
1513 Invoking status precommit hook
1523 Invoking status precommit hook
1514 A largefile
1524 A largefile
1515 $ ln -s largefile largelink
1525 $ ln -s largefile largelink
1516 $ hg add largelink
1526 $ hg add largelink
1517 $ hg commit -m "commit a large symlink"
1527 $ hg commit -m "commit a large symlink"
1518 Invoking status precommit hook
1528 Invoking status precommit hook
1519 A largelink
1529 A largelink
1520 $ rm -f largelink
1530 $ rm -f largelink
1521 $ hg up >/dev/null
1531 $ hg up >/dev/null
1522 $ test -f largelink
1532 $ test -f largelink
1523 [1]
1533 [1]
1524 $ test -L largelink
1534 $ test -L largelink
1525 [1]
1535 [1]
1526 $ rm -f largelink # make next part of the test independent of the previous
1536 $ rm -f largelink # make next part of the test independent of the previous
1527 $ hg up -C >/dev/null
1537 $ hg up -C >/dev/null
1528 $ test -f largelink
1538 $ test -f largelink
1529 $ test -L largelink
1539 $ test -L largelink
1530 $ cd ..
1540 $ cd ..
1531
1541
1532 #endif
1542 #endif
1533
1543
1534 test for pattern matching on 'hg status':
1544 test for pattern matching on 'hg status':
1535 to boost performance, largefiles checks whether specified patterns are
1545 to boost performance, largefiles checks whether specified patterns are
1536 related to largefiles in working directory (NOT to STANDIN) or not.
1546 related to largefiles in working directory (NOT to STANDIN) or not.
1537
1547
1538 $ hg init statusmatch
1548 $ hg init statusmatch
1539 $ cd statusmatch
1549 $ cd statusmatch
1540
1550
1541 $ mkdir -p a/b/c/d
1551 $ mkdir -p a/b/c/d
1542 $ echo normal > a/b/c/d/e.normal.txt
1552 $ echo normal > a/b/c/d/e.normal.txt
1543 $ hg add a/b/c/d/e.normal.txt
1553 $ hg add a/b/c/d/e.normal.txt
1544 $ echo large > a/b/c/d/e.large.txt
1554 $ echo large > a/b/c/d/e.large.txt
1545 $ hg add --large a/b/c/d/e.large.txt
1555 $ hg add --large a/b/c/d/e.large.txt
1546 $ mkdir -p a/b/c/x
1556 $ mkdir -p a/b/c/x
1547 $ echo normal > a/b/c/x/y.normal.txt
1557 $ echo normal > a/b/c/x/y.normal.txt
1548 $ hg add a/b/c/x/y.normal.txt
1558 $ hg add a/b/c/x/y.normal.txt
1549 $ hg commit -m 'add files'
1559 $ hg commit -m 'add files'
1550 Invoking status precommit hook
1560 Invoking status precommit hook
1551 A a/b/c/d/e.large.txt
1561 A a/b/c/d/e.large.txt
1552 A a/b/c/d/e.normal.txt
1562 A a/b/c/d/e.normal.txt
1553 A a/b/c/x/y.normal.txt
1563 A a/b/c/x/y.normal.txt
1554
1564
1555 (1) no pattern: no performance boost
1565 (1) no pattern: no performance boost
1556 $ hg status -A
1566 $ hg status -A
1557 C a/b/c/d/e.large.txt
1567 C a/b/c/d/e.large.txt
1558 C a/b/c/d/e.normal.txt
1568 C a/b/c/d/e.normal.txt
1559 C a/b/c/x/y.normal.txt
1569 C a/b/c/x/y.normal.txt
1560
1570
1561 (2) pattern not related to largefiles: performance boost
1571 (2) pattern not related to largefiles: performance boost
1562 $ hg status -A a/b/c/x
1572 $ hg status -A a/b/c/x
1563 C a/b/c/x/y.normal.txt
1573 C a/b/c/x/y.normal.txt
1564
1574
1565 (3) pattern related to largefiles: no performance boost
1575 (3) pattern related to largefiles: no performance boost
1566 $ hg status -A a/b/c/d
1576 $ hg status -A a/b/c/d
1567 C a/b/c/d/e.large.txt
1577 C a/b/c/d/e.large.txt
1568 C a/b/c/d/e.normal.txt
1578 C a/b/c/d/e.normal.txt
1569
1579
1570 (4) pattern related to STANDIN (not to largefiles): performance boost
1580 (4) pattern related to STANDIN (not to largefiles): performance boost
1571 $ hg status -A .hglf/a
1581 $ hg status -A .hglf/a
1572 C .hglf/a/b/c/d/e.large.txt
1582 C .hglf/a/b/c/d/e.large.txt
1573
1583
1574 (5) mixed case: no performance boost
1584 (5) mixed case: no performance boost
1575 $ hg status -A a/b/c/x a/b/c/d
1585 $ hg status -A a/b/c/x a/b/c/d
1576 C a/b/c/d/e.large.txt
1586 C a/b/c/d/e.large.txt
1577 C a/b/c/d/e.normal.txt
1587 C a/b/c/d/e.normal.txt
1578 C a/b/c/x/y.normal.txt
1588 C a/b/c/x/y.normal.txt
1579
1589
1580 verify that largefiles doesn't break filesets
1590 verify that largefiles doesn't break filesets
1581
1591
1582 $ hg log --rev . --exclude "set:binary()"
1592 $ hg log --rev . --exclude "set:binary()"
1583 changeset: 0:41bd42f10efa
1593 changeset: 0:41bd42f10efa
1584 tag: tip
1594 tag: tip
1585 user: test
1595 user: test
1586 date: Thu Jan 01 00:00:00 1970 +0000
1596 date: Thu Jan 01 00:00:00 1970 +0000
1587 summary: add files
1597 summary: add files
1588
1598
1589 verify that large files in subrepos handled properly
1599 verify that large files in subrepos handled properly
1590 $ hg init subrepo
1600 $ hg init subrepo
1591 $ echo "subrepo = subrepo" > .hgsub
1601 $ echo "subrepo = subrepo" > .hgsub
1592 $ hg add .hgsub
1602 $ hg add .hgsub
1593 $ hg ci -m "add subrepo"
1603 $ hg ci -m "add subrepo"
1594 Invoking status precommit hook
1604 Invoking status precommit hook
1595 A .hgsub
1605 A .hgsub
1596 ? .hgsubstate
1606 ? .hgsubstate
1597 $ echo "rev 1" > subrepo/large.txt
1607 $ echo "rev 1" > subrepo/large.txt
1598 $ hg -R subrepo add --large subrepo/large.txt
1608 $ hg -R subrepo add --large subrepo/large.txt
1599 $ hg sum
1609 $ hg sum
1600 parent: 1:8ee150ea2e9c tip
1610 parent: 1:8ee150ea2e9c tip
1601 add subrepo
1611 add subrepo
1602 branch: default
1612 branch: default
1603 commit: 1 subrepos
1613 commit: 1 subrepos
1604 update: (current)
1614 update: (current)
1605 $ hg st
1615 $ hg st
1606 $ hg st -S
1616 $ hg st -S
1607 A subrepo/large.txt
1617 A subrepo/large.txt
1608 $ hg ci -S -m "commit top repo"
1618 $ hg ci -S -m "commit top repo"
1609 committing subrepository subrepo
1619 committing subrepository subrepo
1610 Invoking status precommit hook
1620 Invoking status precommit hook
1611 A large.txt
1621 A large.txt
1612 Invoking status precommit hook
1622 Invoking status precommit hook
1613 M .hgsubstate
1623 M .hgsubstate
1614 # No differences
1624 # No differences
1615 $ hg st -S
1625 $ hg st -S
1616 $ hg sum
1626 $ hg sum
1617 parent: 2:ce4cd0c527a6 tip
1627 parent: 2:ce4cd0c527a6 tip
1618 commit top repo
1628 commit top repo
1619 branch: default
1629 branch: default
1620 commit: (clean)
1630 commit: (clean)
1621 update: (current)
1631 update: (current)
1622 $ echo "rev 2" > subrepo/large.txt
1632 $ echo "rev 2" > subrepo/large.txt
1623 $ hg st -S
1633 $ hg st -S
1624 M subrepo/large.txt
1634 M subrepo/large.txt
1625 $ hg sum
1635 $ hg sum
1626 parent: 2:ce4cd0c527a6 tip
1636 parent: 2:ce4cd0c527a6 tip
1627 commit top repo
1637 commit top repo
1628 branch: default
1638 branch: default
1629 commit: 1 subrepos
1639 commit: 1 subrepos
1630 update: (current)
1640 update: (current)
1631 $ hg ci -m "this commit should fail without -S"
1641 $ hg ci -m "this commit should fail without -S"
1632 abort: uncommitted changes in subrepo subrepo
1642 abort: uncommitted changes in subrepo subrepo
1633 (use --subrepos for recursive commit)
1643 (use --subrepos for recursive commit)
1634 [255]
1644 [255]
1635
1645
1636 Add a normal file to the subrepo, then test archiving
1646 Add a normal file to the subrepo, then test archiving
1637
1647
1638 $ echo 'normal file' > subrepo/normal.txt
1648 $ echo 'normal file' > subrepo/normal.txt
1639 $ hg -R subrepo add subrepo/normal.txt
1649 $ hg -R subrepo add subrepo/normal.txt
1640
1650
1641 Lock in subrepo, otherwise the change isn't archived
1651 Lock in subrepo, otherwise the change isn't archived
1642
1652
1643 $ hg ci -S -m "add normal file to top level"
1653 $ hg ci -S -m "add normal file to top level"
1644 committing subrepository subrepo
1654 committing subrepository subrepo
1645 Invoking status precommit hook
1655 Invoking status precommit hook
1646 M large.txt
1656 M large.txt
1647 A normal.txt
1657 A normal.txt
1648 Invoking status precommit hook
1658 Invoking status precommit hook
1649 M .hgsubstate
1659 M .hgsubstate
1650 $ hg archive -S lf_subrepo_archive
1660 $ hg archive -S lf_subrepo_archive
1651 $ find lf_subrepo_archive | sort
1661 $ find lf_subrepo_archive | sort
1652 lf_subrepo_archive
1662 lf_subrepo_archive
1653 lf_subrepo_archive/.hg_archival.txt
1663 lf_subrepo_archive/.hg_archival.txt
1654 lf_subrepo_archive/.hgsub
1664 lf_subrepo_archive/.hgsub
1655 lf_subrepo_archive/.hgsubstate
1665 lf_subrepo_archive/.hgsubstate
1656 lf_subrepo_archive/a
1666 lf_subrepo_archive/a
1657 lf_subrepo_archive/a/b
1667 lf_subrepo_archive/a/b
1658 lf_subrepo_archive/a/b/c
1668 lf_subrepo_archive/a/b/c
1659 lf_subrepo_archive/a/b/c/d
1669 lf_subrepo_archive/a/b/c/d
1660 lf_subrepo_archive/a/b/c/d/e.large.txt
1670 lf_subrepo_archive/a/b/c/d/e.large.txt
1661 lf_subrepo_archive/a/b/c/d/e.normal.txt
1671 lf_subrepo_archive/a/b/c/d/e.normal.txt
1662 lf_subrepo_archive/a/b/c/x
1672 lf_subrepo_archive/a/b/c/x
1663 lf_subrepo_archive/a/b/c/x/y.normal.txt
1673 lf_subrepo_archive/a/b/c/x/y.normal.txt
1664 lf_subrepo_archive/subrepo
1674 lf_subrepo_archive/subrepo
1665 lf_subrepo_archive/subrepo/large.txt
1675 lf_subrepo_archive/subrepo/large.txt
1666 lf_subrepo_archive/subrepo/normal.txt
1676 lf_subrepo_archive/subrepo/normal.txt
1667
1677
1668 Test archiving a revision that references a subrepo that is not yet
1678 Test archiving a revision that references a subrepo that is not yet
1669 cloned (see test-subrepo-recursion.t):
1679 cloned (see test-subrepo-recursion.t):
1670
1680
1671 $ hg clone -U . ../empty
1681 $ hg clone -U . ../empty
1672 $ cd ../empty
1682 $ cd ../empty
1673 $ hg archive --subrepos -r tip ../archive.tar.gz
1683 $ hg archive --subrepos -r tip ../archive.tar.gz
1674 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
1684 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
1675 $ cd ..
1685 $ cd ..
1676
1686
1677 Test that addremove picks up largefiles prior to the initial commit (issue3541)
1687 Test that addremove picks up largefiles prior to the initial commit (issue3541)
1678
1688
1679 $ hg init addrm2
1689 $ hg init addrm2
1680 $ cd addrm2
1690 $ cd addrm2
1681 $ touch large.dat
1691 $ touch large.dat
1682 $ touch large2.dat
1692 $ touch large2.dat
1683 $ touch normal
1693 $ touch normal
1684 $ hg add --large large.dat
1694 $ hg add --large large.dat
1685 $ hg addremove -v
1695 $ hg addremove -v
1686 adding large2.dat as a largefile
1696 adding large2.dat as a largefile
1687 adding normal
1697 adding normal
1688
1698
1689 Test that forgetting all largefiles reverts to islfilesrepo() == False
1699 Test that forgetting all largefiles reverts to islfilesrepo() == False
1690 (addremove will add *.dat as normal files now)
1700 (addremove will add *.dat as normal files now)
1691 $ hg forget large.dat
1701 $ hg forget large.dat
1692 $ hg forget large2.dat
1702 $ hg forget large2.dat
1693 $ hg addremove -v
1703 $ hg addremove -v
1694 adding large.dat
1704 adding large.dat
1695 adding large2.dat
1705 adding large2.dat
1696
1706
1697 Test commit's addremove option prior to the first commit
1707 Test commit's addremove option prior to the first commit
1698 $ hg forget large.dat
1708 $ hg forget large.dat
1699 $ hg forget large2.dat
1709 $ hg forget large2.dat
1700 $ hg add --large large.dat
1710 $ hg add --large large.dat
1701 $ hg ci -Am "commit"
1711 $ hg ci -Am "commit"
1702 adding large2.dat as a largefile
1712 adding large2.dat as a largefile
1703 Invoking status precommit hook
1713 Invoking status precommit hook
1704 A large.dat
1714 A large.dat
1705 A large2.dat
1715 A large2.dat
1706 A normal
1716 A normal
1707 $ find .hglf | sort
1717 $ find .hglf | sort
1708 .hglf
1718 .hglf
1709 .hglf/large.dat
1719 .hglf/large.dat
1710 .hglf/large2.dat
1720 .hglf/large2.dat
1711
1721
1712 $ cd ..
1722 $ cd ..
1713
1723
1714 issue3651: summary/outgoing with largefiles shows "no remote repo"
1724 issue3651: summary/outgoing with largefiles shows "no remote repo"
1715 unexpectedly
1725 unexpectedly
1716
1726
1717 $ mkdir issue3651
1727 $ mkdir issue3651
1718 $ cd issue3651
1728 $ cd issue3651
1719
1729
1720 $ hg init src
1730 $ hg init src
1721 $ echo a > src/a
1731 $ echo a > src/a
1722 $ hg -R src add --large src/a
1732 $ hg -R src add --large src/a
1723 $ hg -R src commit -m '#0'
1733 $ hg -R src commit -m '#0'
1724 Invoking status precommit hook
1734 Invoking status precommit hook
1725 A a
1735 A a
1726
1736
1727 check messages when no remote repository is specified:
1737 check messages when no remote repository is specified:
1728 "no remote repo" route for "hg outgoing --large" is not tested here,
1738 "no remote repo" route for "hg outgoing --large" is not tested here,
1729 because it can't be reproduced easily.
1739 because it can't be reproduced easily.
1730
1740
1731 $ hg init clone1
1741 $ hg init clone1
1732 $ hg -R clone1 -q pull src
1742 $ hg -R clone1 -q pull src
1733 $ hg -R clone1 -q update
1743 $ hg -R clone1 -q update
1734 $ hg -R clone1 paths | grep default
1744 $ hg -R clone1 paths | grep default
1735 [1]
1745 [1]
1736
1746
1737 $ hg -R clone1 summary --large
1747 $ hg -R clone1 summary --large
1738 parent: 0:fc0bd45326d3 tip
1748 parent: 0:fc0bd45326d3 tip
1739 #0
1749 #0
1740 branch: default
1750 branch: default
1741 commit: (clean)
1751 commit: (clean)
1742 update: (current)
1752 update: (current)
1743 largefiles: (no remote repo)
1753 largefiles: (no remote repo)
1744
1754
1745 check messages when there is no files to upload:
1755 check messages when there is no files to upload:
1746
1756
1747 $ hg -q clone src clone2
1757 $ hg -q clone src clone2
1748 $ hg -R clone2 paths | grep default
1758 $ hg -R clone2 paths | grep default
1749 default = $TESTTMP/issue3651/src (glob)
1759 default = $TESTTMP/issue3651/src (glob)
1750
1760
1751 $ hg -R clone2 summary --large
1761 $ hg -R clone2 summary --large
1752 parent: 0:fc0bd45326d3 tip
1762 parent: 0:fc0bd45326d3 tip
1753 #0
1763 #0
1754 branch: default
1764 branch: default
1755 commit: (clean)
1765 commit: (clean)
1756 update: (current)
1766 update: (current)
1757 searching for changes
1767 searching for changes
1758 largefiles: (no files to upload)
1768 largefiles: (no files to upload)
1759 $ hg -R clone2 outgoing --large
1769 $ hg -R clone2 outgoing --large
1760 comparing with $TESTTMP/issue3651/src (glob)
1770 comparing with $TESTTMP/issue3651/src (glob)
1761 searching for changes
1771 searching for changes
1762 no changes found
1772 no changes found
1763 searching for changes
1773 searching for changes
1764 largefiles: no files to upload
1774 largefiles: no files to upload
1765 [1]
1775 [1]
1766
1776
1767 check messages when there are files to upload:
1777 check messages when there are files to upload:
1768
1778
1769 $ echo b > clone2/b
1779 $ echo b > clone2/b
1770 $ hg -R clone2 add --large clone2/b
1780 $ hg -R clone2 add --large clone2/b
1771 $ hg -R clone2 commit -m '#1'
1781 $ hg -R clone2 commit -m '#1'
1772 Invoking status precommit hook
1782 Invoking status precommit hook
1773 A b
1783 A b
1774 $ hg -R clone2 summary --large
1784 $ hg -R clone2 summary --large
1775 parent: 1:1acbe71ce432 tip
1785 parent: 1:1acbe71ce432 tip
1776 #1
1786 #1
1777 branch: default
1787 branch: default
1778 commit: (clean)
1788 commit: (clean)
1779 update: (current)
1789 update: (current)
1780 searching for changes
1790 searching for changes
1781 largefiles: 1 to upload
1791 largefiles: 1 to upload
1782 $ hg -R clone2 outgoing --large
1792 $ hg -R clone2 outgoing --large
1783 comparing with $TESTTMP/issue3651/src (glob)
1793 comparing with $TESTTMP/issue3651/src (glob)
1784 searching for changes
1794 searching for changes
1785 changeset: 1:1acbe71ce432
1795 changeset: 1:1acbe71ce432
1786 tag: tip
1796 tag: tip
1787 user: test
1797 user: test
1788 date: Thu Jan 01 00:00:00 1970 +0000
1798 date: Thu Jan 01 00:00:00 1970 +0000
1789 summary: #1
1799 summary: #1
1790
1800
1791 searching for changes
1801 searching for changes
1792 largefiles to upload:
1802 largefiles to upload:
1793 b
1803 b
1794
1804
1795
1805
1796 $ cd ..
1806 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now