--- a/hgext/record.py Fri Jan 31 15:25:31 2014 -0200
+++ b/hgext/record.py Sat Feb 01 14:53:52 2014 -0600
@@ -601,12 +601,8 @@
# it is important to first chdir to repo root -- we'll call
# a highlevel command with list of pathnames relative to
# repo root
- cwd = os.getcwd()
- os.chdir(repo.root)
- try:
- commitfunc(ui, repo, *newfiles, **opts)
- finally:
- os.chdir(cwd)
+ newfiles = [repo.wjoin(nf) for nf in newfiles]
+ commitfunc(ui, repo, *newfiles, **opts)
return 0
finally:
--- a/mercurial/dirstate.py Fri Jan 31 15:25:31 2014 -0200
+++ b/mercurial/dirstate.py Sat Feb 01 14:53:52 2014 -0600
@@ -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/mercurial/help/config.txt Fri Jan 31 15:25:31 2014 -0200
+++ b/mercurial/help/config.txt Sat Feb 01 14:53:52 2014 -0600
@@ -946,13 +946,16 @@
Default: draft
``checksubrepos``
+ Check the phase of the current revision of each subrepository. Allowed
+ values are "ignore", "follow" and "abort". For settings other than
+ "ignore", the phase of the current revision of each subrepository is
+ checked before committing the parent repository. If any of those phases is
+ greater than the phase of the parent repository (e.g. if a subrepo is in a
+ "secret" phase while the parent repo is in "draft" phase), the commit is
+ either aborted (if checksubrepos is set to "abort") or the higher phase is
+ used for the parent repository commit (if set to "follow").
+ Default: "follow"
- Check phase of state in each subrepositories, allowed values are
- "ignore", "follow" or "abort". For settings other than "ignore",
- the phase of each subrepository commit is checked before committing
- in the parent repository. If there is any greater phase than the parent
- ("secret" vs "draft", for example), the commit is either aborted
- with "abort" or the higher phase is used with "follow". Default: "follow".
``profiling``
-------------
--- a/tests/test-rebase-scenario-global.t Fri Jan 31 15:25:31 2014 -0200
+++ b/tests/test-rebase-scenario-global.t Sat Feb 01 14:53:52 2014 -0600
@@ -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)