merge with stable

This commit is contained in:
Matt Mackall 2012-11-28 16:15:05 -06:00
commit cf4605492a
5 changed files with 30 additions and 31 deletions

View File

@ -142,9 +142,14 @@ def hook(ui, repo, name, throw=False, **args):
return False return False
r = False r = False
oldstdout = -1 oldstdout = -1
if _redirect:
try:
for hname, cmd in _allhooks(ui):
if hname.split('.')[0] != name or not cmd:
continue
if oldstdout == -1 and _redirect:
try: try:
stdoutno = sys.__stdout__.fileno() stdoutno = sys.__stdout__.fileno()
stderrno = sys.__stderr__.fileno() stderrno = sys.__stderr__.fileno()
@ -153,14 +158,10 @@ def hook(ui, repo, name, throw=False, **args):
sys.__stdout__.flush() sys.__stdout__.flush()
oldstdout = os.dup(stdoutno) oldstdout = os.dup(stdoutno)
os.dup2(stderrno, stdoutno) os.dup2(stderrno, stdoutno)
except AttributeError: except (OSError, AttributeError):
# __stdout__/__stderr__ doesn't have fileno(), it's not a real file # files seem to be bogus, give up on redirecting (WSGI, etc)
pass pass
try:
for hname, cmd in _allhooks(ui):
if hname.split('.')[0] != name or not cmd:
continue
if util.safehasattr(cmd, '__call__'): if util.safehasattr(cmd, '__call__'):
r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r
elif cmd.startswith('python:'): elif cmd.startswith('python:'):

View File

@ -103,7 +103,7 @@ Note: old client behave as a publishing server with draft only content
import errno import errno
from node import nullid, nullrev, bin, hex, short from node import nullid, nullrev, bin, hex, short
from i18n import _ from i18n import _
import util import util, error
import obsolete import obsolete
allphases = public, draft, secret = range(3) allphases = public, draft, secret = range(3)

View File

@ -584,14 +584,6 @@ def _descendants(repo, subset, x, followfirst=False):
if not args: if not args:
return [] return []
s = set(_revdescendants(repo, args, followfirst)) | set(args) s = set(_revdescendants(repo, args, followfirst)) | set(args)
if len(subset) == len(repo):
# the passed in revisions may not exist, -1 for example
for arg in args:
if arg not in subset:
s.remove(arg)
return list(s)
return [r for r in subset if r in s] return [r for r in subset if r in s]
def descendants(repo, subset, x): def descendants(repo, subset, x):
@ -1349,9 +1341,6 @@ def roots(repo, subset, x):
Changesets in set with no parent changeset in set. Changesets in set with no parent changeset in set.
""" """
s = set(getset(repo, repo.changelog, x)) s = set(getset(repo, repo.changelog, x))
if len(subset) == len(repo):
subset = s
else:
subset = [r for r in subset if r in s] subset = [r for r in subset if r in s]
cs = _children(repo, subset, s) cs = _children(repo, subset, s)
return [r for r in subset if r not in cs] return [r for r in subset if r not in cs]

View File

@ -899,7 +899,7 @@ class chunkbuffer(object):
"""Read L bytes of data from the iterator of chunks of data. """Read L bytes of data from the iterator of chunks of data.
Returns less than L bytes if the iterator runs dry.""" Returns less than L bytes if the iterator runs dry."""
left = l left = l
buf = '' buf = []
queue = self._queue queue = self._queue
while left > 0: while left > 0:
# refill the queue # refill the queue
@ -917,11 +917,11 @@ class chunkbuffer(object):
left -= len(chunk) left -= len(chunk)
if left < 0: if left < 0:
queue.appendleft(chunk[left:]) queue.appendleft(chunk[left:])
buf += chunk[:left] buf.append(chunk[:left])
else: else:
buf += chunk buf.append(chunk)
return buf return ''.join(buf)
def filechunkiter(f, size=65536, limit=None): def filechunkiter(f, size=65536, limit=None):
"""Create a generator that produces the data in the file size """Create a generator that produces the data in the file size

View File

@ -339,6 +339,15 @@ test that phase are displayed in log at debug level
(Issue3707)
test invalid phase name
$ mkcommit I --config phases.new-commit='babar'
transaction abort!
rollback completed
abort: phases.new-commit: not a valid phase name ('babar')
[255]
Test phase command Test phase command
=================== ===================