From patchwork Mon Jul 19 10:41:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D11136: dirstate: use `reset_state` in `update_file_p1` From: phabricator X-Patchwork-Id: 49448 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Mon, 19 Jul 2021 10:41:44 +0000 marmoute created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Going through the same API is more consistent and allow us to push implementation lower down the call stack. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11136 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS To: marmoute, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -521,22 +521,38 @@ wc_tracked = False else: wc_tracked = entry.tracked + possibly_dirty = False if p1_tracked and wc_tracked: # the underlying reference might have changed, we will have to # check it. - self.normallookup(filename) + possibly_dirty = True elif not (p1_tracked or wc_tracked): # the file is no longer relevant to anyone self._drop(filename) elif (not p1_tracked) and wc_tracked: - if not entry.added: - self._add(filename) + if entry is not None and entry.added: + return # avoid dropping copy information (maybe?) elif p1_tracked and not wc_tracked: - if entry is None or not entry.removed: - self._remove(filename) + pass else: assert False, 'unreachable' + # this mean we are doing call for file we do not really care about the + # data (eg: added or removed), however this should be a minor overhead + # compared to the overall update process calling this. + parentfiledata = None + if wc_tracked: + parentfiledata = self._get_filedata(filename) + + self._updatedfiles.add(filename) + self._map.reset_state( + filename, + wc_tracked, + p1_tracked, + possibly_dirty=possibly_dirty, + parentfiledata=parentfiledata, + ) + @requires_parents_change def update_file( self,