--- 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)]