diff hgext/largefiles/reposetup.py @ 17230:fc4c155658b7 stable

largefiles: defer lfdirstate.drop() until after commit (issue3364) The example in comment #9 of the bug writeup must be run exactly- it was the commit after the rm and prior to the addremove that screwed things up, because that commit noticed that the largefile was missing, called drop(), and then the original commit function did nothing (due to the file in the '!' state). The addremove command properly put it into the 'R' state, but it remained stuck in that state (because commit insisted 'nothing changed'). Without the commit prior to addremove, the problem didn't occur. Maybe this is an indication that lfdirstate needs to take a few more hints from the regular dirstate, regardless of what _it_ thinks the state is- similar inconsistency is probably still possible with this patch if the original commit succeeds but the lfdirstate write fails.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 19 Jul 2012 10:00:15 -0400
parents dcfc70aab372
children e7cfe3587ea4
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Thu Jul 19 06:30:59 2012 -0400
+++ b/hgext/largefiles/reposetup.py	Thu Jul 19 10:00:15 2012 -0400
@@ -338,15 +338,18 @@
                                     lfutil.updatestandin(self,
                                         lfutil.standin(lfile))
                                     lfdirstate.normal(lfile)
-                    for lfile in lfdirstate:
-                        if lfile in modifiedfiles:
-                            if (not os.path.exists(repo.wjoin(
-                               lfutil.standin(lfile)))) or \
-                               (not os.path.exists(repo.wjoin(lfile))):
-                                lfdirstate.drop(lfile)
 
                     result = orig(text=text, user=user, date=date, match=match,
                                     force=force, editor=editor, extra=extra)
+
+                    if result is not None:
+                        for lfile in lfdirstate:
+                            if lfile in modifiedfiles:
+                                if (not os.path.exists(repo.wjoin(
+                                   lfutil.standin(lfile)))) or \
+                                   (not os.path.exists(repo.wjoin(lfile))):
+                                    lfdirstate.drop(lfile)
+
                     # This needs to be after commit; otherwise precommit hooks
                     # get the wrong status
                     lfdirstate.write()