changeset 18667:f12804d3ff80

Merge
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 11 Feb 2013 14:50:54 -0800
parents fb9d1c2805ff (diff) 5e63a85299ba (current diff)
children 4034b8d551b1 56f8522c3591
files
diffstat 10 files changed, 103 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Feb 11 16:57:46 2013 +0100
+++ b/hgext/mq.py	Mon Feb 11 14:50:54 2013 -0800
@@ -3454,6 +3454,12 @@
                              % short(mqtags[-1][0]))
                 return result
 
+            # do not add fake tags for filtered revisions
+            included = self.changelog.hasnode
+            mqtags = [mqt for mqt in mqtags if included(mqt[0])]
+            if not mqtags:
+                return result
+
             mqtags.append((mqtags[-1][0], 'qtip'))
             mqtags.append((mqtags[0][0], 'qbase'))
             mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent'))
--- a/mercurial/context.py	Mon Feb 11 16:57:46 2013 +0100
+++ b/mercurial/context.py	Mon Feb 11 14:50:54 2013 -0800
@@ -1138,6 +1138,22 @@
             finally:
                 wlock.release()
 
+    def markcommitted(self, node):
+        """Perform post-commit cleanup necessary after commiting this workingctx
+
+        Specifically, this updates backing stores this working context
+        wraps to reflect the fact that the changes reflected by this
+        workingctx have been committed.  For example, it marks
+        modified and added files as normal in the dirstate.
+
+        """
+
+        for f in self.modified() + self.added():
+            self._repo.dirstate.normal(f)
+        for f in self.removed():
+            self._repo.dirstate.drop(f)
+        self._repo.dirstate.setparents(node)
+
     def dirs(self):
         return set(self._repo.dirstate.dirs())
 
--- a/mercurial/dirstate.py	Mon Feb 11 16:57:46 2013 +0100
+++ b/mercurial/dirstate.py	Mon Feb 11 14:50:54 2013 -0800
@@ -703,7 +703,11 @@
                     # Report ignored items in the dmap as long as they are not
                     # under a symlink directory.
                     if ignore(nf) and audit_path.check(nf):
-                        results[nf] = util.statfiles([join(nf)])[0]
+                        try:
+                            results[nf] = lstat(join(nf))
+                        except OSError:
+                            # file doesn't exist
+                            results[nf] = None
                     else:
                         # It's either missing or under a symlink directory
                         results[nf] = None
--- a/mercurial/localrepo.py	Mon Feb 11 16:57:46 2013 +0100
+++ b/mercurial/localrepo.py	Mon Feb 11 14:50:54 2013 -0800
@@ -1230,12 +1230,14 @@
                     elif f not in self.dirstate:
                         fail(f, _("file not tracked!"))
 
+            cctx = context.workingctx(self, text, user, date, extra, changes)
+
             if (not force and not extra.get("close") and not merge
-                and not (changes[0] or changes[1] or changes[2])
+                and not cctx.files()
                 and wctx.branch() == wctx.p1().branch()):
                 return None
 
-            if merge and changes[3]:
+            if merge and cctx.deleted():
                 raise util.Abort(_("cannot commit merge with missing files"))
 
             ms = mergemod.mergestate(self)
@@ -1244,7 +1246,6 @@
                     raise util.Abort(_("unresolved merge conflicts "
                                        "(see hg help resolve)"))
 
-            cctx = context.workingctx(self, text, user, date, extra, changes)
             if editor:
                 cctx._text = editor(self, cctx, subs)
             edited = (text != cctx._text)
@@ -1278,11 +1279,7 @@
 
             # update bookmarks, dirstate and mergestate
             bookmarks.update(self, [p1, p2], ret)
-            for f in changes[0] + changes[1]:
-                self.dirstate.normal(f)
-            for f in changes[2]:
-                self.dirstate.drop(f)
-            self.dirstate.setparents(ret)
+            cctx.markcommitted(ret)
             ms.reset()
         finally:
             wlock.release()
--- a/mercurial/templates/static/style-coal.css	Mon Feb 11 16:57:46 2013 +0100
+++ b/mercurial/templates/static/style-coal.css	Mon Feb 11 14:50:54 2013 -0800
@@ -191,7 +191,7 @@
 }
 .bigtable tr { border: none; }
 .bigtable .age { width: 6em; }
-.bigtable .author { width: 12em; }
+.bigtable .author { width: 15em; }
 .bigtable .description { }
 .bigtable .description .base { font-size: 70%; float: right; line-height: 1.66; }
 .bigtable .node { width: 5em; font-family: monospace;}
--- a/mercurial/templates/static/style-paper.css	Mon Feb 11 16:57:46 2013 +0100
+++ b/mercurial/templates/static/style-paper.css	Mon Feb 11 14:50:54 2013 -0800
@@ -188,7 +188,7 @@
 }
 .bigtable tr { border: none; }
 .bigtable .age { width: 7em; }
-.bigtable .author { width: 12em; }
+.bigtable .author { width: 15em; }
 .bigtable .description { }
 .bigtable .description .base { font-size: 70%; float: right; line-height: 1.66; }
 .bigtable .node { width: 5em; font-family: monospace;}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/silenttestrunner.py	Mon Feb 11 14:50:54 2013 -0800
@@ -0,0 +1,18 @@
+import unittest, sys
+
+def main(modulename):
+    '''run the tests found in module, printing nothing when all tests pass'''
+    module = sys.modules[modulename]
+    suite = unittest.defaultTestLoader.loadTestsFromModule(module)
+    results = unittest.TestResult()
+    suite.run(results)
+    if results.errors or results.failures:
+        for tc, exc in results.errors:
+            print 'ERROR:', tc
+            print
+            sys.stdout.write(exc)
+        for tc, exc in results.failures:
+            print 'FAIL:', tc
+            print
+            sys.stdout.write(exc)
+        sys.exit(1)
--- a/tests/test-atomictempfile.py	Mon Feb 11 16:57:46 2013 +0100
+++ b/tests/test-atomictempfile.py	Mon Feb 11 14:50:54 2013 -0800
@@ -1,48 +1,42 @@
 import os
 import glob
+import unittest
+import silenttestrunner
+
 from mercurial.util import atomictempfile
 
-# basic usage
-def test1_simple():
-    if os.path.exists('foo'):
-        os.remove('foo')
-    file = atomictempfile('foo')
-    (dir, basename) = os.path.split(file._tempname)
-    assert not os.path.isfile('foo')
-    assert basename in glob.glob('.foo-*')
+class testatomictempfile(unittest.TestCase):
+    def test1_simple(self):
+        if os.path.exists('foo'):
+            os.remove('foo')
+        file = atomictempfile('foo')
+        (dir, basename) = os.path.split(file._tempname)
+        self.assertFalse(os.path.isfile('foo'))
+        self.assertTrue(basename in glob.glob('.foo-*'))
 
-    file.write('argh\n')
-    file.close()
+        file.write('argh\n')
+        file.close()
 
-    assert os.path.isfile('foo')
-    assert basename not in glob.glob('.foo-*')
-    print 'OK'
+        self.assertTrue(os.path.isfile('foo'))
+        self.assertTrue(basename not in glob.glob('.foo-*'))
 
-# discard() removes the temp file without making the write permanent
-def test2_discard():
-    if os.path.exists('foo'):
-        os.remove('foo')
-    file = atomictempfile('foo')
-    (dir, basename) = os.path.split(file._tempname)
-
-    file.write('yo\n')
-    file.discard()
+    # discard() removes the temp file without making the write permanent
+    def test2_discard(self):
+        if os.path.exists('foo'):
+            os.remove('foo')
+        file = atomictempfile('foo')
+        (dir, basename) = os.path.split(file._tempname)
 
-    assert not os.path.isfile('foo')
-    assert basename not in os.listdir('.')
-    print 'OK'
+        file.write('yo\n')
+        file.discard()
 
-# if a programmer screws up and passes bad args to atomictempfile, they
-# get a plain ordinary TypeError, not infinite recursion
-def test3_oops():
-    try:
-        file = atomictempfile()
-    except TypeError:
-        print "OK"
-    else:
-        print "expected TypeError"
+        self.assertFalse(os.path.isfile('foo'))
+        self.assertTrue(basename not in os.listdir('.'))
+
+    # if a programmer screws up and passes bad args to atomictempfile, they
+    # get a plain ordinary TypeError, not infinite recursion
+    def test3_oops(self):
+        self.assertRaises(TypeError, atomictempfile)
 
 if __name__ == '__main__':
-    test1_simple()
-    test2_discard()
-    test3_oops()
+    silenttestrunner.main(__name__)
--- a/tests/test-atomictempfile.py.out	Mon Feb 11 16:57:46 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-OK
-OK
-OK
--- a/tests/test-mq.t	Mon Feb 11 16:57:46 2013 +0100
+++ b/tests/test-mq.t	Mon Feb 11 14:50:54 2013 -0800
@@ -1555,4 +1555,24 @@
   1: secret
   2: secret
 
+Test that secret mq patch does not break hgweb
+
+  $ cat > hgweb.cgi <<HGWEB
+  > from mercurial import demandimport; demandimport.enable()
+  > from mercurial.hgweb import hgweb
+  > from mercurial.hgweb import wsgicgi
+  > import cgitb
+  > cgitb.enable()
+  > app = hgweb('.', 'test')
+  > wsgicgi.launch(app)
+  > HGWEB
+  $ . "$TESTDIR/cgienv"
+  $ PATH_INFO=/tags; export PATH_INFO
+  $ QUERY_STRING='style=raw'
+  $ python hgweb.cgi | grep -v ETag:
+  Status: 200 Script output follows\r (esc)
+  Content-Type: text/plain; charset=ascii\r (esc)
+  \r (esc)
+  tip	[0-9a-f]{40} (re)
+
   $ cd ..