##// END OF EJS Templates
largefiles: access status fields by name rather than index
Martin von Zweigbergk -
r22919:1982bdb7 default
parent child Browse files
Show More
@@ -137,7 +137,7 b' def openlfdirstate(ui, repo, create=True'
137 def lfdirstatestatus(lfdirstate, repo, rev):
137 def lfdirstatestatus(lfdirstate, repo, rev):
138 match = match_.always(repo.root, repo.getcwd())
138 match = match_.always(repo.root, repo.getcwd())
139 unsure, s = lfdirstate.status(match, [], False, False, False)
139 unsure, s = lfdirstate.status(match, [], False, False, False)
140 modified, _added, _removed, _missing, _unknown, _ignored, clean = s
140 modified, clean = s.modified, s.clean
141 for lfile in unsure:
141 for lfile in unsure:
142 try:
142 try:
143 fctx = repo[rev][standin(lfile)]
143 fctx = repo[rev][standin(lfile)]
@@ -153,7 +153,8 b' def removelargefiles(ui, repo, *pats, **'
153 manifest = repo[None].manifest()
153 manifest = repo[None].manifest()
154 modified, added, deleted, clean = [[f for f in list
154 modified, added, deleted, clean = [[f for f in list
155 if lfutil.standin(f) in manifest]
155 if lfutil.standin(f) in manifest]
156 for list in [s[0], s[1], s[3], s[6]]]
156 for list in (s.modified, s.added,
157 s.deleted, s.clean)]
157
158
158 def warn(files, msg):
159 def warn(files, msg):
159 for f in files:
160 for f in files:
@@ -353,10 +354,9 b' def overrideupdate(orig, ui, repo, *pats'
353 lfdirstate = lfutil.openlfdirstate(ui, repo)
354 lfdirstate = lfutil.openlfdirstate(ui, repo)
354 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
355 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
355 [], False, False, False)
356 [], False, False, False)
356 modified = s[0]
357
357
358 if opts['check']:
358 if opts['check']:
359 mod = len(modified) > 0
359 mod = len(s.modified) > 0
360 for lfile in unsure:
360 for lfile in unsure:
361 standin = lfutil.standin(lfile)
361 standin = lfutil.standin(lfile)
362 if repo['.'][standin].data().strip() != \
362 if repo['.'][standin].data().strip() != \
@@ -660,12 +660,11 b' def overriderevert(orig, ui, repo, *pats'
660 wlock = repo.wlock()
660 wlock = repo.wlock()
661 try:
661 try:
662 lfdirstate = lfutil.openlfdirstate(ui, repo)
662 lfdirstate = lfutil.openlfdirstate(ui, repo)
663 (modified, added, removed, missing, unknown, ignored, clean) = \
663 s = lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
664 lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev())
665 lfdirstate.write()
664 lfdirstate.write()
666 for lfile in modified:
665 for lfile in s.modified:
667 lfutil.updatestandin(repo, lfutil.standin(lfile))
666 lfutil.updatestandin(repo, lfutil.standin(lfile))
668 for lfile in missing:
667 for lfile in s.deleted:
669 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
668 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
670 os.unlink(repo.wjoin(lfutil.standin(lfile)))
669 os.unlink(repo.wjoin(lfutil.standin(lfile)))
671
670
@@ -954,17 +953,17 b' def hgsubrepoarchive(orig, repo, ui, arc'
954 def overridebailifchanged(orig, repo):
953 def overridebailifchanged(orig, repo):
955 orig(repo)
954 orig(repo)
956 repo.lfstatus = True
955 repo.lfstatus = True
957 modified, added, removed, deleted = repo.status()[:4]
956 s = repo.status()
958 repo.lfstatus = False
957 repo.lfstatus = False
959 if modified or added or removed or deleted:
958 if s.modified or s.added or s.removed or s.deleted:
960 raise util.Abort(_('uncommitted changes'))
959 raise util.Abort(_('uncommitted changes'))
961
960
962 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
961 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
963 def overridefetch(orig, ui, repo, *pats, **opts):
962 def overridefetch(orig, ui, repo, *pats, **opts):
964 repo.lfstatus = True
963 repo.lfstatus = True
965 modified, added, removed, deleted = repo.status()[:4]
964 s = repo.status()
966 repo.lfstatus = False
965 repo.lfstatus = False
967 if modified or added or removed or deleted:
966 if s.modified or s.added or s.removed or s.deleted:
968 raise util.Abort(_('uncommitted changes'))
967 raise util.Abort(_('uncommitted changes'))
969 return orig(ui, repo, *pats, **opts)
968 return orig(ui, repo, *pats, **opts)
970
969
@@ -979,7 +978,7 b' def overrideforget(orig, ui, repo, *pats'
979 s = repo.status(match=m, clean=True)
978 s = repo.status(match=m, clean=True)
980 finally:
979 finally:
981 repo.lfstatus = False
980 repo.lfstatus = False
982 forget = sorted(s[0] + s[1] + s[3] + s[6])
981 forget = sorted(s.modified + s.added + s.deleted + s.clean)
983 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
982 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
984
983
985 for f in forget:
984 for f in forget:
@@ -1112,14 +1111,13 b' def scmutiladdremove(orig, repo, pats=[]'
1112 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1111 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1113 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [],
1112 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [],
1114 False, False, False)
1113 False, False, False)
1115 missing = s[3]
1116
1114
1117 # Call into the normal remove code, but the removing of the standin, we want
1115 # Call into the normal remove code, but the removing of the standin, we want
1118 # to have handled by original addremove. Monkey patching here makes sure
1116 # to have handled by original addremove. Monkey patching here makes sure
1119 # we don't remove the standin in the largefiles code, preventing a very
1117 # we don't remove the standin in the largefiles code, preventing a very
1120 # confused state later.
1118 # confused state later.
1121 if missing:
1119 if s.deleted:
1122 m = [repo.wjoin(f) for f in missing]
1120 m = [repo.wjoin(f) for f in s.deleted]
1123 repo._isaddremove = True
1121 repo._isaddremove = True
1124 removelargefiles(repo.ui, repo, *m, **opts)
1122 removelargefiles(repo.ui, repo, *m, **opts)
1125 repo._isaddremove = False
1123 repo._isaddremove = False
@@ -1146,15 +1144,13 b' def overridepurge(orig, ui, repo, *dirs,'
1146 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1144 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1147 listsubrepos)
1145 listsubrepos)
1148 lfdirstate = lfutil.openlfdirstate(ui, repo)
1146 lfdirstate = lfutil.openlfdirstate(ui, repo)
1149 modified, added, removed, deleted, unknown, ignored, clean = r
1147 unknown = [f for f in r.unknown if lfdirstate[f] == '?']
1150 unknown = [f for f in unknown if lfdirstate[f] == '?']
1148 ignored = [f for f in r.ignored if lfdirstate[f] == '?']
1151 ignored = [f for f in ignored if lfdirstate[f] == '?']
1149 return scmutil.status(r.modified, r.added, r.removed, r.deleted,
1152 return scmutil.status(modified, added, removed, deleted,
1150 unknown, ignored, r.clean)
1153 unknown, ignored, clean)
1154 repo.status = overridestatus
1151 repo.status = overridestatus
1155 orig(ui, repo, *dirs, **opts)
1152 orig(ui, repo, *dirs, **opts)
1156 repo.status = oldstatus
1153 repo.status = oldstatus
1157
1158 def overriderollback(orig, ui, repo, **opts):
1154 def overriderollback(orig, ui, repo, **opts):
1159 wlock = repo.wlock()
1155 wlock = repo.wlock()
1160 try:
1156 try:
@@ -1292,8 +1288,7 b' def mergeupdate(orig, repo, node, branch'
1292 unsure, s = lfdirstate.status(match_.always(repo.root,
1288 unsure, s = lfdirstate.status(match_.always(repo.root,
1293 repo.getcwd()),
1289 repo.getcwd()),
1294 [], False, False, False)
1290 [], False, False, False)
1295 modified, added = s[:2]
1291 for lfile in unsure + s.modified + s.added:
1296 for lfile in unsure + modified + added:
1297 lfutil.updatestandin(repo, lfutil.standin(lfile))
1292 lfutil.updatestandin(repo, lfutil.standin(lfile))
1298
1293
1299 if linearmerge:
1294 if linearmerge:
@@ -161,8 +161,8 b' def reposetup(ui, repo):'
161 # files from lfdirstate
161 # files from lfdirstate
162 unsure, s = lfdirstate.status(match, [], False, listclean,
162 unsure, s = lfdirstate.status(match, [], False, listclean,
163 False)
163 False)
164 (modified, added, removed, missing, _unknown, _ignored,
164 (modified, added, removed, clean) = (s.modified, s.added,
165 clean) = s
165 s.removed, s.clean)
166 if parentworking:
166 if parentworking:
167 for lfile in unsure:
167 for lfile in unsure:
168 standin = lfutil.standin(lfile)
168 standin = lfutil.standin(lfile)
@@ -222,7 +222,7 b' def reposetup(ui, repo):'
222 normals = [[fn for fn in filelist
222 normals = [[fn for fn in filelist
223 if not lfutil.isstandin(fn)]
223 if not lfutil.isstandin(fn)]
224 for filelist in result]
224 for filelist in result]
225 lfstatus = (modified, added, removed, missing, [], [],
225 lfstatus = (modified, added, removed, s.deleted, [], [],
226 clean)
226 clean)
227 result = [sorted(list1 + list2)
227 result = [sorted(list1 + list2)
228 for (list1, list2) in zip(normals, lfstatus)]
228 for (list1, list2) in zip(normals, lfstatus)]
@@ -298,8 +298,7 b' def reposetup(ui, repo):'
298 dirtymatch = match_.always(self.root, self.getcwd())
298 dirtymatch = match_.always(self.root, self.getcwd())
299 unsure, s = lfdirstate.status(dirtymatch, [], False, False,
299 unsure, s = lfdirstate.status(dirtymatch, [], False, False,
300 False)
300 False)
301 modified, added, removed = s[:3]
301 modifiedfiles = unsure + s.modified + s.added + s.removed
302 modifiedfiles = unsure + modified + added + removed
303 lfiles = lfutil.listlfiles(self)
302 lfiles = lfutil.listlfiles(self)
304 # this only loops through largefiles that exist (not
303 # this only loops through largefiles that exist (not
305 # removed/renamed)
304 # removed/renamed)
General Comments 0
You need to be logged in to leave comments. Login now