Run commit message editor in the repo root (like hooks).
This makes the hgeditor script work with hg commit -R path/to/repo
--- a/hgeditor
+++ b/hgeditor
@@ -34,7 +34,6 @@ HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$
}
(
- cd "`hg root`"
grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
hg diff "$changed" >> "$HGTMP/diff"
done
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -445,7 +445,11 @@ class localrepository(object):
edittext += "".join(["HG: removed %s\n" % f for f in remove])
if not changed and not remove:
edittext += "HG: no files changed\n"
+ # run editor in the repository root
+ olddir = os.getcwd()
+ os.chdir(self.root)
edittext = self.ui.edit(edittext)
+ os.chdir(olddir)
if not edittext.rstrip():
return None
text = edittext