##// END OF EJS Templates
largefiles: factor out procedures to update lfdirstate for post-committing...
FUJIWARA Katsunori -
r23184:3100d1cb default
parent child Browse files
Show More
@@ -386,6 +386,18 b' def synclfdirstate(repo, lfdirstate, lfi'
386 elif state == '?':
386 elif state == '?':
387 lfdirstate.drop(lfile)
387 lfdirstate.drop(lfile)
388
388
389 def markcommitted(orig, ctx, node):
390 repo = ctx._repo
391
392 orig(node)
393
394 lfdirstate = openlfdirstate(repo.ui, repo)
395 for f in ctx.files():
396 if isstandin(f):
397 lfile = splitstandin(f)
398 synclfdirstate(repo, lfdirstate, lfile, False)
399 lfdirstate.write()
400
389 def getlfilestoupdate(oldstandins, newstandins):
401 def getlfilestoupdate(oldstandins, newstandins):
390 changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
402 changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
391 filelist = []
403 filelist = []
@@ -243,9 +243,14 b' def reposetup(ui, repo):'
243
243
244 # As part of committing, copy all of the largefiles into the
244 # As part of committing, copy all of the largefiles into the
245 # cache.
245 # cache.
246 def commitctx(self, *args, **kwargs):
246 def commitctx(self, ctx, *args, **kwargs):
247 node = super(lfilesrepo, self).commitctx(*args, **kwargs)
247 node = super(lfilesrepo, self).commitctx(ctx, *args, **kwargs)
248 lfutil.copyalltostore(self, node)
248 lfutil.copyalltostore(self, node)
249 class lfilesctx(ctx.__class__):
250 def markcommitted(self, node):
251 orig = super(lfilesctx, self).markcommitted
252 return lfutil.markcommitted(orig, self, node)
253 ctx.__class__ = lfilesctx
249 return node
254 return node
250
255
251 # Before commit, largefile standins have not had their
256 # Before commit, largefile standins have not had their
@@ -270,16 +275,6 b' def reposetup(ui, repo):'
270 getattr(self, "_istransplanting", False):
275 getattr(self, "_istransplanting", False):
271 result = orig(text=text, user=user, date=date, match=match,
276 result = orig(text=text, user=user, date=date, match=match,
272 force=force, editor=editor, extra=extra)
277 force=force, editor=editor, extra=extra)
273
274 if result:
275 lfdirstate = lfutil.openlfdirstate(ui, self)
276 for f in self[result].files():
277 if lfutil.isstandin(f):
278 lfile = lfutil.splitstandin(f)
279 lfutil.synclfdirstate(self, lfdirstate, lfile,
280 False)
281 lfdirstate.write()
282
283 return result
278 return result
284 # Case 1: user calls commit with no specific files or
279 # Case 1: user calls commit with no specific files or
285 # include/exclude patterns: refresh and commit all files that
280 # include/exclude patterns: refresh and commit all files that
@@ -308,22 +303,10 b' def reposetup(ui, repo):'
308 if os.path.exists(self.wjoin(lfile)):
303 if os.path.exists(self.wjoin(lfile)):
309 lfutil.updatestandin(self,
304 lfutil.updatestandin(self,
310 lfutil.standin(lfile))
305 lfutil.standin(lfile))
311 lfdirstate.normal(lfile)
312
306
313 result = orig(text=text, user=user, date=date, match=match,
307 result = orig(text=text, user=user, date=date, match=match,
314 force=force, editor=editor, extra=extra)
308 force=force, editor=editor, extra=extra)
315
309
316 if result is not None:
317 for lfile in lfdirstate:
318 if lfile in modifiedfiles:
319 if (not os.path.exists(self.wjoin(
320 lfutil.standin(lfile)))) or \
321 (not os.path.exists(self.wjoin(lfile))):
322 lfdirstate.drop(lfile)
323
324 # This needs to be after commit; otherwise precommit hooks
325 # get the wrong status
326 lfdirstate.write()
327 return result
310 return result
328
311
329 lfiles = lfutil.listlfiles(self)
312 lfiles = lfutil.listlfiles(self)
@@ -350,9 +333,6 b' def reposetup(ui, repo):'
350 lfile = lfutil.splitstandin(standin)
333 lfile = lfutil.splitstandin(standin)
351 if lfdirstate[lfile] != 'r':
334 if lfdirstate[lfile] != 'r':
352 lfutil.updatestandin(self, standin)
335 lfutil.updatestandin(self, standin)
353 lfdirstate.normal(lfile)
354 else:
355 lfdirstate.drop(lfile)
356
336
357 # Cook up a new matcher that only matches regular files or
337 # Cook up a new matcher that only matches regular files or
358 # standins corresponding to the big files requested by the
338 # standins corresponding to the big files requested by the
@@ -386,9 +366,6 b' def reposetup(ui, repo):'
386 match.matchfn = matchfn
366 match.matchfn = matchfn
387 result = orig(text=text, user=user, date=date, match=match,
367 result = orig(text=text, user=user, date=date, match=match,
388 force=force, editor=editor, extra=extra)
368 force=force, editor=editor, extra=extra)
389 # This needs to be after commit; otherwise precommit hooks
390 # get the wrong status
391 lfdirstate.write()
392 return result
369 return result
393 finally:
370 finally:
394 wlock.release()
371 wlock.release()
General Comments 0
You need to be logged in to leave comments. Login now