Patchwork [2,of,4] serve: add chdir command for --daemon-postexec

login
register
mail settings
Submitter Jun Wu
Date March 9, 2016, 2:23 a.m.
Message ID <671eb2d843fbac71cbaa.1457490204@x1c>
Download mbox | patch
Permalink /patch/13699/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - March 9, 2016, 2:23 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1457486222 0
#      Wed Mar 09 01:17:02 2016 +0000
# Node ID 671eb2d843fbac71cbaaaae875985941e920ed2a
# Parent  05d74711cf855d7a5c1ab35d5eca6425f963dbfd
serve: add chdir command for --daemon-postexec

For chgserver, it probably needs a chdir to /. This patch adds chdir command
support for --daemon-postexec so chg client can make use of it.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -835,6 +835,8 @@ 
             if inst.startswith('unlink:'):
                 lockpath = inst[7:]
                 os.unlink(lockpath)
+            elif inst.startswith('chdir:'):
+                os.chdir(inst[6:])
             elif inst != 'none':
                 raise error.Abort(_('invalid value for --daemon-postexec: %s')
                                   % inst)