##// END OF EJS Templates
largefiles: pass a matcher instead of a raw file list to removelargefiles()...
Matt Harbison -
r23741:f2893cd8 default
parent child Browse files
Show More
@@ -152,13 +152,12 b' def addlargefiles(ui, repo, matcher, **o'
152 152 wlock.release()
153 153 return bad
154 154
155 def removelargefiles(ui, repo, isaddremove, *pats, **opts):
155 def removelargefiles(ui, repo, isaddremove, matcher, **opts):
156 156 after = opts.get('after')
157 m = composelargefilematcher(scmutil.match(repo[None], pats, opts),
158 repo[None].manifest())
157 m = composelargefilematcher(matcher, repo[None].manifest())
159 158 try:
160 159 repo.lfstatus = True
161 s = repo.status(match=m, clean=True)
160 s = repo.status(match=m, clean=not isaddremove)
162 161 finally:
163 162 repo.lfstatus = False
164 163 manifest = repo[None].manifest()
@@ -250,7 +249,8 b' def overrideremove(orig, ui, repo, *pats'
250 249 installnormalfilesmatchfn(repo[None].manifest())
251 250 result = orig(ui, repo, *pats, **opts)
252 251 restorematchfn()
253 return removelargefiles(ui, repo, False, *pats, **opts) or result
252 matcher = scmutil.match(repo[None], pats, opts)
253 return removelargefiles(ui, repo, False, matcher, **opts) or result
254 254
255 255 def overridestatusfn(orig, repo, rev2, **opts):
256 256 try:
@@ -1109,8 +1109,16 b' def scmutiladdremove(orig, repo, matcher'
1109 1109 # we don't remove the standin in the largefiles code, preventing a very
1110 1110 # confused state later.
1111 1111 if s.deleted:
1112 m = [repo.wjoin(f) for f in s.deleted]
1113 removelargefiles(repo.ui, repo, True, *m, **opts)
1112 m = copy.copy(matcher)
1113
1114 # The m._files and m._map attributes are not changed to the deleted list
1115 # because that affects the m.exact() test, which in turn governs whether
1116 # or not the file name is printed, and how. Simply limit the original
1117 # matches to those in the deleted status list.
1118 matchfn = m.matchfn
1119 m.matchfn = lambda f: f in s.deleted and matchfn(f)
1120
1121 removelargefiles(repo.ui, repo, True, m, **opts)
1114 1122 # Call into the normal add code, and any files that *should* be added as
1115 1123 # largefiles will be
1116 1124 addlargefiles(repo.ui, repo, matcher, **opts)
@@ -269,11 +269,13 b' Add a normal file to the subrepo, then t'
269 269 $ mv subrepo/renamed-large.txt subrepo/large.txt
270 270 $ hg -R subrepo add subrepo/normal.txt
271 271
272 $ hg addremove
272 $ hg addremove subrepo
273 $ hg addremove -S
273 274 adding large.dat as a largefile
274 275 $ rm large.dat
275 276
276 $ hg addremove
277 $ hg addremove subrepo
278 $ hg addremove -S
277 279 removing large.dat
278 280
279 281 Lock in subrepo, otherwise the change isn't archived
General Comments 0
You need to be logged in to leave comments. Login now