[PATCH 2 of 5 STABLE] largefiles: factor out synchronization of lfdirstate for future use
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Mon Aug 11 08:39:40 CDT 2014
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1407763783 -32400
# Mon Aug 11 22:29:43 2014 +0900
# Branch stable
# Node ID 8d8e4507d8f80e22cab6f2091d1af9cac02462b4
# Parent 1165734dd845bfb6cf93c8f6f7adad454be566c4
largefiles: factor out synchronization of lfdirstate for future use
diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -510,26 +510,7 @@
updated += update1
- standin = lfutil.standin(lfile)
- if standin in repo.dirstate:
- stat = repo.dirstate._map[standin]
- state, mtime = stat[0], stat[3]
- else:
- state, mtime = '?', -1
- if state == 'n':
- if normallookup or mtime < 0:
- # state 'n' doesn't ensure 'clean' in this case
- lfdirstate.normallookup(lfile)
- else:
- lfdirstate.normal(lfile)
- elif state == 'm':
- lfdirstate.normallookup(lfile)
- elif state == 'r':
- lfdirstate.remove(lfile)
- elif state == 'a':
- lfdirstate.add(lfile)
- elif state == '?':
- lfdirstate.drop(lfile)
+ lfutil.synclfdirstate(repo, lfdirstate, lfile, normallookup)
lfdirstate.write()
if printmessage and lfiles:
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -363,6 +363,28 @@
standins.append((lfile, hash))
return standins
+def synclfdirstate(repo, lfdirstate, lfile, normallookup):
+ lfstandin = standin(lfile)
+ if lfstandin in repo.dirstate:
+ stat = repo.dirstate._map[lfstandin]
+ state, mtime = stat[0], stat[3]
+ else:
+ state, mtime = '?', -1
+ if state == 'n':
+ if normallookup or mtime < 0:
+ # state 'n' doesn't ensure 'clean' in this case
+ lfdirstate.normallookup(lfile)
+ else:
+ lfdirstate.normal(lfile)
+ elif state == 'm':
+ lfdirstate.normallookup(lfile)
+ elif state == 'r':
+ lfdirstate.remove(lfile)
+ elif state == 'a':
+ lfdirstate.add(lfile)
+ elif state == '?':
+ lfdirstate.drop(lfile)
+
def getlfilestoupdate(oldstandins, newstandins):
changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
filelist = []
More information about the Mercurial-devel
mailing list