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

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 4, 2018, 1:24 p.m.
Message ID <6dc23c03f0639d051bae.1543929860@mimosa>
Download mbox | patch
Permalink /patch/36953/
State Accepted
Headers show

Comments

Yuya Nishihara - Dec. 4, 2018, 1:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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

Patch

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