##// 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 386 elif state == '?':
387 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 401 def getlfilestoupdate(oldstandins, newstandins):
390 402 changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
391 403 filelist = []
@@ -243,9 +243,14 b' def reposetup(ui, repo):'
243 243
244 244 # As part of committing, copy all of the largefiles into the
245 245 # cache.
246 def commitctx(self, *args, **kwargs):
247 node = super(lfilesrepo, self).commitctx(*args, **kwargs)
246 def commitctx(self, ctx, *args, **kwargs):
247 node = super(lfilesrepo, self).commitctx(ctx, *args, **kwargs)
248 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 254 return node
250 255
251 256 # Before commit, largefile standins have not had their
@@ -270,16 +275,6 b' def reposetup(ui, repo):'
270 275 getattr(self, "_istransplanting", False):
271 276 result = orig(text=text, user=user, date=date, match=match,
272 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 278 return result
284 279 # Case 1: user calls commit with no specific files or
285 280 # include/exclude patterns: refresh and commit all files that
@@ -308,22 +303,10 b' def reposetup(ui, repo):'
308 303 if os.path.exists(self.wjoin(lfile)):
309 304 lfutil.updatestandin(self,
310 305 lfutil.standin(lfile))
311 lfdirstate.normal(lfile)
312 306
313 307 result = orig(text=text, user=user, date=date, match=match,
314 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 310 return result
328 311
329 312 lfiles = lfutil.listlfiles(self)
@@ -350,9 +333,6 b' def reposetup(ui, repo):'
350 333 lfile = lfutil.splitstandin(standin)
351 334 if lfdirstate[lfile] != 'r':
352 335 lfutil.updatestandin(self, standin)
353 lfdirstate.normal(lfile)
354 else:
355 lfdirstate.drop(lfile)
356 336
357 337 # Cook up a new matcher that only matches regular files or
358 338 # standins corresponding to the big files requested by the
@@ -386,9 +366,6 b' def reposetup(ui, repo):'
386 366 match.matchfn = matchfn
387 367 result = orig(text=text, user=user, date=date, match=match,
388 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 369 return result
393 370 finally:
394 371 wlock.release()
General Comments 0
You need to be logged in to leave comments. Login now