Mercurial > hg
changeset 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 | 205599e31870 |
children | 3cec5134e9c4 |
files | mercurial/dirstate.py tests/test-rebase-scenario-global.t |
diffstat | 2 files changed, 30 insertions(+), 1 deletions(-) [+] |
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:\'
--- a/tests/test-rebase-scenario-global.t Fri Jan 31 14:52:53 2014 -0800 +++ b/tests/test-rebase-scenario-global.t Fri Jan 31 15:13:15 2014 -0800 @@ -649,3 +649,28 @@ |/ o 0: 'A' + +Test that rebase is not confused by $CWD disapearing during rebase (issue 4121) + + $ cd .. + $ hg init cwd-vanish + $ cd cwd-vanish + $ touch initial-file + $ hg add initial-file + $ hg commit -m 'initial commit' + $ touch dest-file + $ hg add dest-file + $ hg commit -m 'dest commit' + $ hg up 0 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ touch other-file + $ hg add other-file + $ hg commit -m 'first source commit' + created new head + $ mkdir subdir + $ cd subdir + $ touch subfile + $ hg add subfile + $ hg commit -m 'second source with subdir' + $ hg rebase -b . -d 1 --traceback + saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-backup.hg (glob)