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

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2019, 1:54 p.m.
Message ID <980d124ea76f59f2546b4216215692d8@localhost.localdomain>
Download mbox | patch
Permalink /patch/38669/
State Not Applicable
Headers show

Comments

phabricator - Feb. 11, 2019, 1:54 p.m.
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




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

Patch

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):