[PATCH 6 of 8] commandserver: expand log path for convenience

Yuya Nishihara yuya at tcha.org
Tue Dec 4 08:24:20 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1541845667 -32400
#      Sat Nov 10 19:27:47 2018 +0900
# Node ID 6dc23c03f0639d051baeb7c4a8889f59b0217025
# Parent  e0e021cac8647338c003145389534f857b851040
commandserver: expand log path for convenience

This allows us to set the log path relative to $XDG_RUNTIME_DIR, for instance.

  [cmdserver]
  log = $XDG_RUNTIME_DIR/chg/server.log

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -367,7 +367,7 @@ def setuplogging(ui, repo=None, fp=None)
     elif logpath == b'-':
         logger = loggingutil.fileobjectlogger(ui.ferr, tracked)
     else:
-        logpath = os.path.abspath(logpath)
+        logpath = os.path.abspath(util.expandpath(logpath))
         vfs = vfsmod.vfs(os.path.dirname(logpath))
         logger = loggingutil.filelogger(vfs, os.path.basename(logpath), tracked)
 
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -1,6 +1,6 @@
 #require chg
 
-  $ cat <<EOF >> $HGRCPATH
+  $ cat <<'EOF' >> $HGRCPATH
   > [cmdserver]
   > log = $TESTTMP/server.log
   > EOF


More information about the Mercurial-devel mailing list