merge with stable
authorMatt Mackall <mpm@selenic.com>
Fri, 15 Jul 2011 12:56:58 -0500
changeset 14883 9b9424540a9f
parent 14879 743cc738f704 (current diff)
parent 14882 bb2cffe81a94 (diff)
child 14885 50b67d5c4073
merge with stable
--- 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
 
--- 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){
--- 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)
--- 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