diff hgext/largefiles/lfutil.py @ 23184:3100d1cbce32

largefiles: factor out procedures to update lfdirstate for post-committing Before this patch, procedures to update lfdirstate for post-committing are scattered in "lfilesrepo.commit". In the case of "hg commit" with patterns for target files ("Case 2"), lfdirstate is updated BEFORE real committing. This patch factors out procedures to update lfdirstate for post-committing into "lfutil.markcommitted", and makes it callable via "markcommitted" of the context passed to "lfilesrepo.commitctx". "markcommitted" of the context is called, only when it is committed successfully. Passing original "markcommitted" of the context is meaningless in this patch, but required in subsequent one to prepare something before invocation of it.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 05 Nov 2014 23:24:47 +0900
parents 1350b9170089
children 9870173e0b48
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Wed Nov 05 23:24:47 2014 +0900
+++ b/hgext/largefiles/lfutil.py	Wed Nov 05 23:24:47 2014 +0900
@@ -386,6 +386,18 @@
     elif state == '?':
         lfdirstate.drop(lfile)
 
+def markcommitted(orig, ctx, node):
+    repo = ctx._repo
+
+    orig(node)
+
+    lfdirstate = openlfdirstate(repo.ui, repo)
+    for f in ctx.files():
+        if isstandin(f):
+            lfile = splitstandin(f)
+            synclfdirstate(repo, lfdirstate, lfile, False)
+    lfdirstate.write()
+
 def getlfilestoupdate(oldstandins, newstandins):
     changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
     filelist = []