commandserver: expand log path for convenience
authorYuya Nishihara <yuya@tcha.org>
Sat, 10 Nov 2018 19:27:47 +0900
changeset 53591 1617aa916d8851a344a870bda273928a11b01541
parent 53590 eaabcb689747c7fc99628ec8847a77d217d124f7
child 53592 d23fd01cc1156fcb856299e009796066fbde15db
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
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
mercurial/commandserver.py
tests/test-chg.t
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -362,17 +362,17 @@ def setuplogging(ui, repo=None, fp=None)
         return
     tracked = {b'chgserver', b'cmdserver'}
 
     if logpath == b'-' and fp:
         logger = loggingutil.fileobjectlogger(fp, tracked)
     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)
 
     targetuis = {ui}
     if repo:
         targetuis.add(repo.baseui)
         targetuis.add(repo.ui)
     for u in targetuis:
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -1,11 +1,11 @@
 #require chg
 
-  $ cat <<EOF >> $HGRCPATH
+  $ cat <<'EOF' >> $HGRCPATH
   > [cmdserver]
   > log = $TESTTMP/server.log
   > EOF
   $ cp $HGRCPATH $HGRCPATH.orig
 
   $ filterlog () {
   >   sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' \
   >       -e 's!\(setprocname\|received fds\|setenv\): .*!\1: ...!' \