D5928: dirstate: call and cache os.getcwd() in constructor

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Feb 11 08:54:17 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe178b131906a: dirstate: call and cache os.getcwd() in constructor (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5928?vs=14016&id=14024

REVISION DETAIL
  https://phab.mercurial-scm.org/D5928

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -81,6 +81,10 @@
         self._origpl = None
         self._updatedfiles = set()
         self._mapcls = dirstatemap
+        # Access and cache cwd early, so we don't access it for the first time
+        # after a working-copy update caused it to not exist (accessing it then
+        # raises an exception).
+        self._cwd
 
     @contextlib.contextmanager
     def parentchange(self):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list