view mercurial/scmposix.py @ 24717:90f2b9de30f2

changegroup: flush the ui stdio buffers after adding a changegroup This eliminates the following test failure on Windows, as well as a similar one in evolve's test-wireproto.t. See the previous patch for details on the problem. --- e:/Projects/hg/tests/test-init.t +++ e:/Projects/hg/tests/test-init.t.err @@ -216,10 +216,10 @@ * test 0:08b9e9f63b32 $ hg clone -e "python \"$TESTDIR/dummyssh\"" local ssh://user@dummy/remote-bookmarks searching for changes + exporting bookmark test remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files - exporting bookmark test $ hg -R remote-bookmarks bookmarks test 0:08b9e9f63b32
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 10 Apr 2015 23:34:06 -0400
parents 23c995ed466b
children 39087ee88835
line wrap: on
line source

import sys, os
import osutil

def _rcfiles(path):
    rcs = [os.path.join(path, 'hgrc')]
    rcdir = os.path.join(path, 'hgrc.d')
    try:
        rcs.extend([os.path.join(rcdir, f)
                    for f, kind in osutil.listdir(rcdir)
                    if f.endswith(".rc")])
    except OSError:
        pass
    return rcs

def systemrcpath():
    path = []
    if sys.platform == 'plan9':
        root = 'lib/mercurial'
    else:
        root = 'etc/mercurial'
    # old mod_python does not set sys.argv
    if len(getattr(sys, 'argv', [])) > 0:
        p = os.path.dirname(os.path.dirname(sys.argv[0]))
        if p != '/':
            path.extend(_rcfiles(os.path.join(p, root)))
    path.extend(_rcfiles('/' + root))
    return path

def userrcpath():
    if sys.platform == 'plan9':
        return [os.environ['home'] + '/lib/hgrc']
    else:
        return [os.path.expanduser('~/.hgrc')]