Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG35bc4b6e132d: fix: correctly set wdirwritten given that the dict item is deleted
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/fix.py (4 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Danny Hooper | Aug 6 2018, 7:00 PM |
# We have to hold on to the data for each successor revision in memory | # We have to hold on to the data for each successor revision in memory | ||||
# until all its parents are committed. We ensure this by committing and | # until all its parents are committed. We ensure this by committing and | ||||
# freeing memory for the revisions in some topological order. This | # freeing memory for the revisions in some topological order. This | ||||
# leaves a little bit of memory efficiency on the table, but also makes | # leaves a little bit of memory efficiency on the table, but also makes | ||||
# the tests deterministic. It might also be considered a feature since | # the tests deterministic. It might also be considered a feature since | ||||
# it makes the results more easily reproducible. | # it makes the results more easily reproducible. | ||||
filedata = collections.defaultdict(dict) | filedata = collections.defaultdict(dict) | ||||
replacements = {} | replacements = {} | ||||
wdirwritten = False | |||||
commitorder = sorted(revstofix, reverse=True) | commitorder = sorted(revstofix, reverse=True) | ||||
with ui.makeprogress(topic=_('fixing'), unit=_('files'), | with ui.makeprogress(topic=_('fixing'), unit=_('files'), | ||||
total=sum(numitems.values())) as progress: | total=sum(numitems.values())) as progress: | ||||
for rev, path, newdata in results: | for rev, path, newdata in results: | ||||
progress.increment(item=path) | progress.increment(item=path) | ||||
if newdata is not None: | if newdata is not None: | ||||
filedata[rev][path] = newdata | filedata[rev][path] = newdata | ||||
numitems[rev] -= 1 | numitems[rev] -= 1 | ||||
# Apply the fixes for this and any other revisions that are | # Apply the fixes for this and any other revisions that are | ||||
# ready and sitting at the front of the queue. Using a loop here | # ready and sitting at the front of the queue. Using a loop here | ||||
# prevents the queue from being blocked by the first revision to | # prevents the queue from being blocked by the first revision to | ||||
# be ready out of order. | # be ready out of order. | ||||
while commitorder and not numitems[commitorder[-1]]: | while commitorder and not numitems[commitorder[-1]]: | ||||
rev = commitorder.pop() | rev = commitorder.pop() | ||||
ctx = repo[rev] | ctx = repo[rev] | ||||
if rev == wdirrev: | if rev == wdirrev: | ||||
writeworkingdir(repo, ctx, filedata[rev], replacements) | writeworkingdir(repo, ctx, filedata[rev], replacements) | ||||
wdirwritten = bool(filedata[rev]) | |||||
else: | else: | ||||
replacerev(ui, repo, ctx, filedata[rev], replacements) | replacerev(ui, repo, ctx, filedata[rev], replacements) | ||||
del filedata[rev] | del filedata[rev] | ||||
cleanup(repo, replacements, bool(filedata[wdirrev])) | cleanup(repo, replacements, wdirwritten) | ||||
def cleanup(repo, replacements, wdirwritten): | def cleanup(repo, replacements, wdirwritten): | ||||
"""Calls scmutil.cleanupnodes() with the given replacements. | """Calls scmutil.cleanupnodes() with the given replacements. | ||||
"replacements" is a dict from nodeid to nodeid, with one key and one value | "replacements" is a dict from nodeid to nodeid, with one key and one value | ||||
for every revision that was affected by fixing. This is slightly different | for every revision that was affected by fixing. This is slightly different | ||||
from cleanupnodes(). | from cleanupnodes(). | ||||