[PATCH 08 of 16 V3] largefiles: access status fields by name rather than index
Martin von Zweigbergk
martinvonz at gmail.com
Fri Oct 10 17:20:40 CDT 2014
# HG changeset patch
# User Martin von Zweigbergk <martinvonz at gmail.com>
# Date 1412399408 25200
# Fri Oct 03 22:10:08 2014 -0700
# Node ID 413124c790d27e6939750e44bc369ba5141e2d8a
# Parent 97e53fae6d7e14b280507299a585487f777f2db7
largefiles: access status fields by name rather than index
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -137,7 +137,7 @@
def lfdirstatestatus(lfdirstate, repo, rev):
match = match_.always(repo.root, repo.getcwd())
unsure, s = lfdirstate.status(match, [], False, False, False)
- modified, _added, _removed, _missing, _unknown, _ignored, clean = s
+ modified, clean = s.modified, s.clean
for lfile in unsure:
try:
fctx = repo[rev][standin(lfile)]
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -154,7 +154,8 @@
manifest = repo[None].manifest()
modified, added, deleted, clean = [[f for f in list
if lfutil.standin(f) in manifest]
- for list in [s[0], s[1], s[3], s[6]]]
+ for list in (s.modified, s.added,
+ s.deleted, s.clean)]
def warn(files, msg):
for f in files:
@@ -354,10 +355,9 @@
lfdirstate = lfutil.openlfdirstate(ui, repo)
unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
[], False, False, False)
- modified = s[0]
if opts['check']:
- mod = len(modified) > 0
+ mod = len(s.modified) > 0
for lfile in unsure:
standin = lfutil.standin(lfile)
if repo['.'][standin].data().strip() != \
@@ -661,12 +661,11 @@
wlock = repo.wlock()
try:
lfdirstate = lfutil.openlfdirstate(ui, repo)
- (modified, added, removed, missing, unknown, ignored, clean) = \
- lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
+ s = lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
lfdirstate.write()
- for lfile in modified:
+ for lfile in s.modified:
lfutil.updatestandin(repo, lfutil.standin(lfile))
- for lfile in missing:
+ for lfile in s.deleted:
if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
os.unlink(repo.wjoin(lfutil.standin(lfile)))
@@ -955,17 +954,17 @@
def overridebailifchanged(orig, repo):
orig(repo)
repo.lfstatus = True
- modified, added, removed, deleted = repo.status()[:4]
+ s = repo.status()
repo.lfstatus = False
- if modified or added or removed or deleted:
+ if s.modified or s.added or s.removed or s.deleted:
raise util.Abort(_('uncommitted changes'))
# Fetch doesn't use cmdutil.bailifchanged so override it to add the check
def overridefetch(orig, ui, repo, *pats, **opts):
repo.lfstatus = True
- modified, added, removed, deleted = repo.status()[:4]
+ s = repo.status()
repo.lfstatus = False
- if modified or added or removed or deleted:
+ if s.modified or s.added or s.removed or s.deleted:
raise util.Abort(_('uncommitted changes'))
return orig(ui, repo, *pats, **opts)
@@ -980,7 +979,7 @@
s = repo.status(match=m, clean=True)
finally:
repo.lfstatus = False
- forget = sorted(s[0] + s[1] + s[3] + s[6])
+ forget = sorted(s.modified + s.added + s.deleted + s.clean)
forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
for f in forget:
@@ -1113,14 +1112,13 @@
lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [],
False, False, False)
- missing = s[3]
# Call into the normal remove code, but the removing of the standin, we want
# to have handled by original addremove. Monkey patching here makes sure
# we don't remove the standin in the largefiles code, preventing a very
# confused state later.
- if missing:
- m = [repo.wjoin(f) for f in missing]
+ if s.deleted:
+ m = [repo.wjoin(f) for f in s.deleted]
repo._isaddremove = True
removelargefiles(repo.ui, repo, *m, **opts)
repo._isaddremove = False
@@ -1147,11 +1145,10 @@
r = oldstatus(node1, node2, match, ignored, clean, unknown,
listsubrepos)
lfdirstate = lfutil.openlfdirstate(ui, repo)
- modified, added, removed, deleted, unknown, ignored, clean = r
- unknown = [f for f in unknown if lfdirstate[f] == '?']
- ignored = [f for f in ignored if lfdirstate[f] == '?']
- return dirstate.status(modified, added, removed, deleted, unknown,
- ignored, clean)
+ unknown = [f for f in r.unknown if lfdirstate[f] == '?']
+ ignored = [f for f in r.ignored if lfdirstate[f] == '?']
+ return dirstate.status(r.modified, r.added, r.removed, r.deleted,
+ unknown, ignored, r.clean)
repo.status = overridestatus
orig(ui, repo, *dirs, **opts)
repo.status = oldstatus
@@ -1293,8 +1290,7 @@
unsure, s = lfdirstate.status(match_.always(repo.root,
repo.getcwd()),
[], False, False, False)
- modified, added = s[:2]
- for lfile in unsure + modified + added:
+ for lfile in unsure + s.modified + s.added:
lfutil.updatestandin(repo, lfutil.standin(lfile))
if linearmerge:
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -162,8 +162,8 @@
# files from lfdirstate
unsure, s = lfdirstate.status(match, [], False, listclean,
False)
- (modified, added, removed, missing, _unknown, _ignored,
- clean) = s
+ (modified, added, removed, clean) = (s.modified, s.added,
+ s.removed, s.clean)
if parentworking:
for lfile in unsure:
standin = lfutil.standin(lfile)
@@ -223,7 +223,7 @@
normals = [[fn for fn in filelist
if not lfutil.isstandin(fn)]
for filelist in result]
- lfstatus = (modified, added, removed, missing, [], [],
+ lfstatus = (modified, added, removed, s.deleted, [], [],
clean)
result = [sorted(list1 + list2)
for (list1, list2) in zip(normals, lfstatus)]
@@ -299,8 +299,7 @@
dirtymatch = match_.always(self.root, self.getcwd())
unsure, s = lfdirstate.status(dirtymatch, [], False, False,
False)
- modified, added, removed = s[:3]
- modifiedfiles = unsure + modified + added + removed
+ modifiedfiles = unsure + s.modified + s.added + s.removed
lfiles = lfutil.listlfiles(self)
# this only loops through largefiles that exist (not
# removed/renamed)
More information about the Mercurial-devel
mailing list