Mercurial > hg
comparison hgext/largefiles/lfutil.py @ 48106:82e142b9ad18
dirstate-item: use item's property instead of `state` in largefile
Differential Revision: https://phab.mercurial-scm.org/D11543
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 29 Sep 2021 18:39:02 +0200 |
parents | 9e9c82d6f96f |
children | 6f54afb094bd |
comparison
equal
deleted
inserted
replaced
48105:207df24a31f6 | 48106:82e142b9ad18 |
---|---|
267 | 267 |
268 # ignore unknown files in working directory | 268 # ignore unknown files in working directory |
269 return [ | 269 return [ |
270 splitstandin(f) | 270 splitstandin(f) |
271 for f in repo[rev].walk(matcher) | 271 for f in repo[rev].walk(matcher) |
272 if rev is not None or repo.dirstate[f] != b'?' | 272 if rev is not None or repo.dirstate.get_entry(f).any_tracked |
273 ] | 273 ] |
274 | 274 |
275 | 275 |
276 def instore(repo, hash, forcelocal=False): | 276 def instore(repo, hash, forcelocal=False): |
277 '''Return true if a largefile with the given hash exists in the store''' | 277 '''Return true if a largefile with the given hash exists in the store''' |
556 def synclfdirstate(repo, lfdirstate, lfile, normallookup): | 556 def synclfdirstate(repo, lfdirstate, lfile, normallookup): |
557 lfstandin = standin(lfile) | 557 lfstandin = standin(lfile) |
558 if lfstandin not in repo.dirstate: | 558 if lfstandin not in repo.dirstate: |
559 lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=False) | 559 lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=False) |
560 else: | 560 else: |
561 stat = repo.dirstate._map[lfstandin] | 561 stat = repo.dirstate.get_entry(lfstandin) |
562 state, mtime = stat.state, stat.mtime | 562 state, mtime = stat.state, stat.mtime |
563 if state == b'n': | 563 if state == b'n': |
564 if normallookup or mtime < 0 or not repo.wvfs.exists(lfile): | 564 if normallookup or mtime < 0 or not repo.wvfs.exists(lfile): |
565 # state 'n' doesn't ensure 'clean' in this case | 565 # state 'n' doesn't ensure 'clean' in this case |
566 lfdirstate.update_file( | 566 lfdirstate.update_file( |
711 # asked to commit them, so sooner or later we're going to | 711 # asked to commit them, so sooner or later we're going to |
712 # refresh the standins. Might as well leave them refreshed. | 712 # refresh the standins. Might as well leave them refreshed. |
713 lfdirstate = openlfdirstate(ui, repo) | 713 lfdirstate = openlfdirstate(ui, repo) |
714 for fstandin in standins: | 714 for fstandin in standins: |
715 lfile = splitstandin(fstandin) | 715 lfile = splitstandin(fstandin) |
716 if lfdirstate[lfile] != b'r': | 716 if lfdirstate.get_entry(lfile).tracked: |
717 updatestandin(repo, lfile, fstandin) | 717 updatestandin(repo, lfile, fstandin) |
718 | 718 |
719 # Cook up a new matcher that only matches regular files or | 719 # Cook up a new matcher that only matches regular files or |
720 # standins corresponding to the big files requested by the | 720 # standins corresponding to the big files requested by the |
721 # user. Have to modify _files to prevent commit() from | 721 # user. Have to modify _files to prevent commit() from |
735 # For largefiles, only one of the normal and standin should be | 735 # For largefiles, only one of the normal and standin should be |
736 # committed (except if one of them is a remove). In the case of a | 736 # committed (except if one of them is a remove). In the case of a |
737 # standin removal, drop the normal file if it is unknown to dirstate. | 737 # standin removal, drop the normal file if it is unknown to dirstate. |
738 # Thus, skip plain largefile names but keep the standin. | 738 # Thus, skip plain largefile names but keep the standin. |
739 if f in lfiles or fstandin in standins: | 739 if f in lfiles or fstandin in standins: |
740 if repo.dirstate[fstandin] != b'r': | 740 if not repo.dirstate.get_entry(fstandin).removed: |
741 if repo.dirstate[f] != b'r': | 741 if not repo.dirstate.get_entry(f).removed: |
742 continue | 742 continue |
743 elif repo.dirstate[f] == b'?': | 743 elif not repo.dirstate.get_entry(f).any_tracked: |
744 continue | 744 continue |
745 | 745 |
746 actualfiles.append(f) | 746 actualfiles.append(f) |
747 match._files = actualfiles | 747 match._files = actualfiles |
748 | 748 |