Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/narrowspec.py @ 50251:2fbc109fd58a
narrow: read pending file when applicable
Now that this is part of the transaction, this is necessary to make sure we read
the right data in hooks (if any).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Mar 2023 04:16:47 +0100 |
parents | 6794f927bc48 |
children | 18c8c18993f0 |
comparison
equal
deleted
inserted
replaced
50250:57133107ab4d | 50251:2fbc109fd58a |
---|---|
14 match as matchmod, | 14 match as matchmod, |
15 merge, | 15 merge, |
16 mergestate as mergestatemod, | 16 mergestate as mergestatemod, |
17 scmutil, | 17 scmutil, |
18 sparse, | 18 sparse, |
19 txnutil, | |
19 util, | 20 util, |
20 ) | 21 ) |
21 | 22 |
22 # The file in .hg/store/ that indicates which paths exit in the store | 23 # The file in .hg/store/ that indicates which paths exit in the store |
23 FILENAME = b'narrowspec' | 24 FILENAME = b'narrowspec' |
167 | 168 |
168 | 169 |
169 def load(repo): | 170 def load(repo): |
170 # Treat "narrowspec does not exist" the same as "narrowspec file exists | 171 # Treat "narrowspec does not exist" the same as "narrowspec file exists |
171 # and is empty". | 172 # and is empty". |
172 spec = repo.svfs.tryread(FILENAME) | 173 spec = None |
174 if txnutil.mayhavepending(repo.root): | |
175 pending_path = b"%s.pending" % FILENAME | |
176 if repo.svfs.exists(pending_path): | |
177 spec = repo.svfs.tryread(FILENAME) | |
178 if spec is None: | |
179 spec = repo.svfs.tryread(FILENAME) | |
173 return parseconfig(repo.ui, spec) | 180 return parseconfig(repo.ui, spec) |
174 | 181 |
175 | 182 |
176 def save(repo, includepats, excludepats): | 183 def save(repo, includepats, excludepats): |
177 repo = repo.unfiltered() | 184 repo = repo.unfiltered() |