Run commit message editor in the repo root (like hooks).
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 09 Feb 2006 07:01:23 +0100
changeset 1706 20b621154e17
parent 1705 4b5725a4a0a6
child 1707 33d09f4a6fef
Run commit message editor in the repo root (like hooks). This makes the hgeditor script work with hg commit -R path/to/repo
hgeditor
mercurial/localrepo.py
--- a/hgeditor	Tue Feb 07 23:01:11 2006 -0600
+++ b/hgeditor	Thu Feb 09 07:01:23 2006 +0100
@@ -34,7 +34,6 @@
 }
 
 (
-    cd "`hg root`"
     grep '^HG: changed' "$1" | cut -b 13- | while read changed; do
         hg diff "$changed" >> "$HGTMP/diff"
     done
--- a/mercurial/localrepo.py	Tue Feb 07 23:01:11 2006 -0600
+++ b/mercurial/localrepo.py	Thu Feb 09 07:01:23 2006 +0100
@@ -445,7 +445,11 @@
             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