Merge with stable
authorAugie Fackler <raf@durin42.com>
Mon, 26 May 2014 12:39:31 -0400
changeset 21550 b4f0e15d1dab
parent 21549 ea3d75ebea6d (current diff)
parent 21547 565d45919db8 (diff)
child 21551 bde505f47141
Merge with stable
tests/test-bundle2.t
--- a/hgext/bugzilla.py	Tue Apr 29 14:12:32 2014 -0700
+++ b/hgext/bugzilla.py	Mon May 26 12:39:31 2014 -0400
@@ -1,7 +1,7 @@
 # bugzilla.py - bugzilla integration for mercurial
 #
 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
-# Copyright 2011-2 Jim Hague <jim.hague@acm.org>
+# Copyright 2011-4 Jim Hague <jim.hague@acm.org>
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
@@ -523,7 +523,7 @@
 
     The regular xmlrpclib transports ignore cookies. Which causes
     a bit of a problem when you need a cookie-based login, as with
-    the Bugzilla XMLRPC interface.
+    the Bugzilla XMLRPC interface prior to 4.4.3.
 
     So this is a helper for defining a Transport which looks for
     cookies being set in responses and saves them to add to all future
@@ -620,7 +620,9 @@
         ver = self.bzproxy.Bugzilla.version()['version'].split('.')
         self.bzvermajor = int(ver[0])
         self.bzverminor = int(ver[1])
-        self.bzproxy.User.login({'login': user, 'password': passwd})
+        login = self.bzproxy.User.login({'login': user, 'password': passwd,
+                                         'restrict_login': True})
+        self.bztoken = login.get('token', '')
 
     def transport(self, uri):
         if urlparse.urlparse(uri, "http")[0] == "https":
@@ -631,13 +633,15 @@
     def get_bug_comments(self, id):
         """Return a string with all comment text for a bug."""
         c = self.bzproxy.Bug.comments({'ids': [id],
-                                       'include_fields': ['text']})
+                                       'include_fields': ['text'],
+                                       'token': self.bztoken})
         return ''.join([t['text'] for t in c['bugs'][str(id)]['comments']])
 
     def filter_real_bug_ids(self, bugs):
         probe = self.bzproxy.Bug.get({'ids': sorted(bugs.keys()),
                                       'include_fields': [],
                                       'permissive': True,
+                                      'token': self.bztoken,
                                       })
         for badbug in probe['faults']:
             id = badbug['id']
@@ -662,6 +666,7 @@
             if 'fix' in newstate:
                 args['status'] = self.fixstatus
                 args['resolution'] = self.fixresolution
+            args['token'] = self.bztoken
             self.bzproxy.Bug.update(args)
         else:
             if 'fix' in newstate:
@@ -719,10 +724,12 @@
         than the subject line, and leave a blank line after it.
         '''
         user = self.map_committer(committer)
-        matches = self.bzproxy.User.get({'match': [user]})
+        matches = self.bzproxy.User.get({'match': [user],
+                                         'token': self.bztoken})
         if not matches['users']:
             user = self.ui.config('bugzilla', 'user', 'bugs')
-            matches = self.bzproxy.User.get({'match': [user]})
+            matches = self.bzproxy.User.get({'match': [user],
+                                             'token': self.bztoken})
             if not matches['users']:
                 raise util.Abort(_("default bugzilla user %s email not found") %
                                  user)
--- a/mercurial/changelog.py	Tue Apr 29 14:12:32 2014 -0700
+++ b/mercurial/changelog.py	Mon May 26 12:39:31 2014 -0400
@@ -127,6 +127,7 @@
             self._generaldelta = False
         self._realopener = opener
         self._delayed = False
+        self._delaybuf = []
         self._divert = False
         self.filteredrevs = frozenset()
 
--- a/mercurial/templater.py	Tue Apr 29 14:12:32 2014 -0700
+++ b/mercurial/templater.py	Mon May 26 12:39:31 2014 -0400
@@ -310,7 +310,9 @@
     item = stringify(args[0][0](context, mapping, args[0][1]))
     items = args[1][0](context, mapping, args[1][1])
 
-    if item in items:
+    # Iterating over items gives a formatted string, so we iterate
+    # directly over the raw values.
+    if item in [i.values()[0] for i in items()]:
         yield _evalifliteral(args[2], context, mapping)
     elif len(args) == 4:
         yield _evalifliteral(args[3], context, mapping)
--- a/mercurial/url.py	Tue Apr 29 14:12:32 2014 -0700
+++ b/mercurial/url.py	Mon May 26 12:39:31 2014 -0400
@@ -225,7 +225,6 @@
     proxyheaders = dict(
             [(x, self.headers[x]) for x in self.headers
              if x.lower().startswith('proxy-')])
-    self._set_hostport(self.host, self.port)
     self.send('CONNECT %s HTTP/1.0\r\n' % self.realhostport)
     for header in proxyheaders.iteritems():
         self.send('%s: %s\r\n' % header)
--- a/tests/test-bundle2.t	Tue Apr 29 14:12:32 2014 -0700
+++ b/tests/test-bundle2.t	Mon May 26 12:39:31 2014 -0400
@@ -8,6 +8,14 @@
   > code. We still need to be able to test it while it grow up.
   > """
   > 
+  > try:
+  >     import msvcrt
+  >     msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
+  >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+  >     msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
+  > except ImportError:
+  >     pass
+  > 
   > import sys
   > from mercurial import cmdutil
   > from mercurial import util
--- a/tests/test-command-template.t	Tue Apr 29 14:12:32 2014 -0700
+++ b/tests/test-command-template.t	Mon May 26 12:39:31 2014 -0400
@@ -1819,6 +1819,11 @@
   1 not current rev
   0 not current rev
 
+  $ hg log --template '{rev} {ifcontains(rev, revset(". + .^"), "match rev", "not match rev")}\n'
+  2 match rev
+  1 match rev
+  0 not match rev
+
   $ hg log --template '{rev} Parents: {revset("parents(%s)", rev)}\n'
   2 Parents: 1
   1 Parents: 0