Mercurial > hg
comparison hgext/largefiles/overrides.py @ 22911:509e2cbee679
dirstate: separate 'lookup' status field from others
The status tuple returned from dirstate.status() has an additional
field compared to the other status tuples: lookup/unsure. This field
is just an optimization and not something most callers care about
(they want the resolved value of 'modified' or 'clean'). To prepare
for a single future status type, let's separate out the 'lookup' field
from the rest by having dirstate.status() return a pair: (lookup,
status).
author | Martin von Zweigbergk <martinvonz@gmail.com> |
---|---|
date | Fri, 03 Oct 2014 21:44:10 -0700 |
parents | 0290982e5ac7 |
children | c95db3208a33 |
comparison
equal
deleted
inserted
replaced
22910:4f2a5c7cdf78 | 22911:509e2cbee679 |
---|---|
349 # Need to lock between the standins getting updated and their | 349 # Need to lock between the standins getting updated and their |
350 # largefiles getting updated | 350 # largefiles getting updated |
351 wlock = repo.wlock() | 351 wlock = repo.wlock() |
352 try: | 352 try: |
353 lfdirstate = lfutil.openlfdirstate(ui, repo) | 353 lfdirstate = lfutil.openlfdirstate(ui, repo) |
354 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), | 354 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), |
355 [], False, False, False) | 355 [], False, False, False) |
356 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s | 356 modified = s[0] |
357 | 357 |
358 if opts['check']: | 358 if opts['check']: |
359 mod = len(modified) > 0 | 359 mod = len(modified) > 0 |
360 for lfile in unsure: | 360 for lfile in unsure: |
361 standin = lfutil.standin(lfile) | 361 standin = lfutil.standin(lfile) |
1108 similarity=None): | 1108 similarity=None): |
1109 if not lfutil.islfilesrepo(repo): | 1109 if not lfutil.islfilesrepo(repo): |
1110 return orig(repo, pats, opts, dry_run, similarity) | 1110 return orig(repo, pats, opts, dry_run, similarity) |
1111 # Get the list of missing largefiles so we can remove them | 1111 # Get the list of missing largefiles so we can remove them |
1112 lfdirstate = lfutil.openlfdirstate(repo.ui, repo) | 1112 lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
1113 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, | 1113 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], |
1114 False, False) | 1114 False, False, False) |
1115 (unsure, modified, added, removed, missing, unknown, ignored, clean) = s | 1115 missing = s[3] |
1116 | 1116 |
1117 # Call into the normal remove code, but the removing of the standin, we want | 1117 # 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 | 1118 # 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 | 1119 # we don't remove the standin in the largefiles code, preventing a very |
1120 # confused state later. | 1120 # confused state later. |
1286 | 1286 |
1287 if linearmerge or (branchmerge and force and not partial): | 1287 if linearmerge or (branchmerge and force and not partial): |
1288 # update standins for linear-merge or force-branch-merge, | 1288 # update standins for linear-merge or force-branch-merge, |
1289 # because largefiles in the working directory may be modified | 1289 # because largefiles in the working directory may be modified |
1290 lfdirstate = lfutil.openlfdirstate(repo.ui, repo) | 1290 lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
1291 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), | 1291 unsure, s = lfdirstate.status(match_.always(repo.root, |
1292 [], False, False, False) | 1292 repo.getcwd()), |
1293 unsure, modified, added = s[:3] | 1293 [], False, False, False) |
1294 modified, added = s[:2] | |
1294 for lfile in unsure + modified + added: | 1295 for lfile in unsure + modified + added: |
1295 lfutil.updatestandin(repo, lfutil.standin(lfile)) | 1296 lfutil.updatestandin(repo, lfutil.standin(lfile)) |
1296 | 1297 |
1297 if linearmerge: | 1298 if linearmerge: |
1298 # Only call updatelfiles on the standins that have changed | 1299 # Only call updatelfiles on the standins that have changed |