hgext/largefiles/lfcommands.py
branchstable
changeset 15663 9036c7d106bf
parent 15579 6c5e6ebe0812
child 15793 3ef07ecdb0d5
child 15900 29defa7d20f6
--- a/hgext/largefiles/lfcommands.py	Wed Dec 14 15:41:08 2011 +0100
+++ b/hgext/largefiles/lfcommands.py	Fri Dec 09 17:35:00 2011 +0100
@@ -446,7 +446,11 @@
             os.chmod(abslfile, mode)
             ret = 1
     else:
-        if os.path.exists(abslfile):
+        # Remove lfiles for which the standin is deleted, unless the
+        # lfile is added to the repository again. This happens when a
+        # largefile is converted back to a normal file: the standin
+        # disappears, but a new (normal) file appears as the lfile.
+        if os.path.exists(abslfile) and lfile not in repo[None]:
             os.unlink(abslfile)
             ret = -1
     state = repo.dirstate[lfutil.standin(lfile)]