Page MenuHomePhabricator

dirstate: perform transactions with _map using single call, where possible
ClosedPublic

Authored by mbolin on Sep 9 2017, 12:30 AM.

Details

Summary

This is in the same style as https://phab.mercurial-scm.org/D493.

In general, this replaces patterns such as:

f in self._map:
    entry = self._map[f]

with:

entry = self._map.get(f):
if entry is not None:
    # use entry
Test Plan

make tests

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mbolin created this revision.Sep 9 2017, 12:30 AM
phillco accepted this revision.Sep 10 2017, 9:02 PM
phillco added a subscriber: phillco.

These look good to me.

mercurial/dirstate.py
585–588

Possibly move this comment to just above line 590?

yuja requested changes to this revision.Sep 13 2017, 11:10 AM
yuja added a subscriber: yuja.
yuja added inline comments.
mercurial/dirstate.py
554

test-add.t fails here. It was self[d], not self._map[d].

This revision now requires changes to proceed.Sep 13 2017, 11:10 AM
mbolin updated this revision to Diff 1817.Sep 14 2017, 12:41 PM
mbolin added inline comments.Sep 14 2017, 12:42 PM
mercurial/dirstate.py
554

My bad: fixed without bringing the extra lookup back.

yuja accepted this revision.Sep 15 2017, 9:44 AM

Queued, thanks.

This revision is now accepted and ready to land.Sep 15 2017, 9:44 AM
This revision was automatically updated to reflect the committed changes.