diff mercurial/dirstate.py @ 20335:e40520642e64 stable

rebase: do not crash in panic when cwd disapear in the process (issue4121) Before this patch rebase crashed badly when it happend. (not abort, crash). Fix courtesy of Matt Mackall.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 31 Jan 2014 15:13:15 -0800
parents f962870712da
children e993f065e17c
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Jan 31 14:52:53 2014 -0800
+++ b/mercurial/dirstate.py	Fri Jan 31 15:13:15 2014 -0800
@@ -162,8 +162,12 @@
         else:
             return fallback
 
+    @propertycache
+    def _cwd(self):
+        return os.getcwd()
+
     def getcwd(self):
-        cwd = os.getcwd()
+        cwd = self._cwd
         if cwd == self._root:
             return ''
         # self._root ends with a path separator if self._root is '/' or 'C:\'