# HG changeset patch # User Matt Mackall # Date 1310752618 18000 # Node ID 9b9424540a9f299a5902f1731b3dab9fa3fa265a # Parent 743cc738f7040f2f6daa574deb2e2b8d9b5b03a4# Parent bb2cffe81a9406971eafb93e8e33498d7f7dd7b7 merge with stable diff -r 743cc738f704 -r 9b9424540a9f mercurial/commandserver.py --- a/mercurial/commandserver.py Thu Jul 14 12:39:39 2011 -0500 +++ b/mercurial/commandserver.py Fri Jul 15 12:56:58 2011 -0500 @@ -132,7 +132,6 @@ """ def __init__(self, ui, repo, mode): self.cwd = os.getcwd() - self.ui = ui logpath = ui.config("cmdserver", "log", None) if logpath: @@ -143,6 +142,9 @@ else: logfile = open(logpath, 'a') + # the ui here is really the repo ui so take its baseui so we don't end up + # with its local configuration + self.ui = repo.baseui self.repo = repo self.repoui = repo.ui diff -r 743cc738f704 -r 9b9424540a9f mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js Thu Jul 14 12:39:39 2011 -0500 +++ b/mercurial/templates/static/mercurial.js Fri Jul 15 12:56:58 2011 -0500 @@ -160,13 +160,31 @@ if (count > 1){ ret = ret + 's'; } + return ret; + } + + function shortdate(date){ + var ret = date.getFullYear() + '-'; + // getMonth() gives a 0-11 result + var month = date.getMonth() + 1; + if (month <= 9){ + ret += '0' + month; + } else { + ret += month; + } + ret += '-'; + var day = date.getDate(); + if (day <= 9){ + ret += '0' + day; + } else { + ret += day; + } return ret; } - function age(datestr){ - var now = new Date(); - var once = new Date(datestr); - + function age(datestr){ + var now = new Date(); + var once = new Date(datestr); if (isNaN(once.getTime())){ // parsing error return datestr; @@ -184,7 +202,7 @@ } if (delta > (2 * scales.year)){ - return once.getFullYear() + '-' + once.getMonth() + '-' + once.getDate(); + return shortdate(once); } for (unit in scales){ diff -r 743cc738f704 -r 9b9424540a9f tests/test-commandserver.py --- a/tests/test-commandserver.py Thu Jul 14 12:39:39 2011 -0500 +++ b/tests/test-commandserver.py Fri Jul 15 12:56:58 2011 -0500 @@ -1,4 +1,4 @@ -import sys, os, struct, subprocess, cStringIO, re +import sys, os, struct, subprocess, cStringIO, re, shutil def connect(path=None): cmdline = ['hg', 'serve', '--cmdserver', 'pipe'] @@ -124,11 +124,26 @@ """ check that --cwd doesn't persist between requests """ readchannel(server) os.mkdir('foo') - open('foo/bar', 'w').write('a') + f = open('foo/bar', 'w') + f.write('a') + f.close() runcommand(server, ['--cwd', 'foo', 'st', 'bar']) runcommand(server, ['st', 'foo/bar']) os.remove('foo/bar') +def localhgrc(server): + """ check that local configs for the cached repo aren't inherited when -R + is used """ + readchannel(server) + + # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it + runcommand(server, ['showconfig']) + + # but not for this repo + runcommand(server, ['init', 'foo']) + runcommand(server, ['-R', 'foo', 'showconfig']) + shutil.rmtree('foo') + if __name__ == '__main__': os.system('hg init') @@ -138,3 +153,8 @@ check(inputeof) check(serverinput) check(cwd) + + hgrc = open('.hg/hgrc', 'a') + hgrc.write('[ui]\nfoo=bar\n') + hgrc.close() + check(localhgrc) diff -r 743cc738f704 -r 9b9424540a9f tests/test-commandserver.py.out --- a/tests/test-commandserver.py.out Thu Jul 14 12:39:39 2011 -0500 +++ b/tests/test-commandserver.py.out Fri Jul 15 12:56:58 2011 -0500 @@ -38,3 +38,14 @@ ? bar ? foo/bar +bundle.mainreporoot=$TESTTMP +defaults.backout=-d "0 0" +defaults.commit=-d "0 0" +defaults.tag=-d "0 0" +ui.slash=True +ui.foo=bar +bundle.mainreporoot=$TESTTMP/foo +defaults.backout=-d "0 0" +defaults.commit=-d "0 0" +defaults.tag=-d "0 0" +ui.slash=True