Show More
@@ -142,25 +142,26 def hook(ui, repo, name, throw=False, ** | |||||
142 | return False |
|
142 | return False | |
143 |
|
143 | |||
144 | r = False |
|
144 | r = False | |
145 |
|
||||
146 | oldstdout = -1 |
|
145 | oldstdout = -1 | |
147 | if _redirect: |
|
|||
148 | try: |
|
|||
149 | stdoutno = sys.__stdout__.fileno() |
|
|||
150 | stderrno = sys.__stderr__.fileno() |
|
|||
151 | # temporarily redirect stdout to stderr, if possible |
|
|||
152 | if stdoutno >= 0 and stderrno >= 0: |
|
|||
153 | sys.__stdout__.flush() |
|
|||
154 | oldstdout = os.dup(stdoutno) |
|
|||
155 | os.dup2(stderrno, stdoutno) |
|
|||
156 | except AttributeError: |
|
|||
157 | # __stdout__/__stderr__ doesn't have fileno(), it's not a real file |
|
|||
158 | pass |
|
|||
159 |
|
146 | |||
160 | try: |
|
147 | try: | |
161 | for hname, cmd in _allhooks(ui): |
|
148 | for hname, cmd in _allhooks(ui): | |
162 | if hname.split('.')[0] != name or not cmd: |
|
149 | if hname.split('.')[0] != name or not cmd: | |
163 | continue |
|
150 | continue | |
|
151 | ||||
|
152 | if oldstdout == -1 and _redirect: | |||
|
153 | try: | |||
|
154 | stdoutno = sys.__stdout__.fileno() | |||
|
155 | stderrno = sys.__stderr__.fileno() | |||
|
156 | # temporarily redirect stdout to stderr, if possible | |||
|
157 | if stdoutno >= 0 and stderrno >= 0: | |||
|
158 | sys.__stdout__.flush() | |||
|
159 | oldstdout = os.dup(stdoutno) | |||
|
160 | os.dup2(stderrno, stdoutno) | |||
|
161 | except (OSError, AttributeError): | |||
|
162 | # files seem to be bogus, give up on redirecting (WSGI, etc) | |||
|
163 | pass | |||
|
164 | ||||
164 | if util.safehasattr(cmd, '__call__'): |
|
165 | if util.safehasattr(cmd, '__call__'): | |
165 | r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r |
|
166 | r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r | |
166 | elif cmd.startswith('python:'): |
|
167 | elif cmd.startswith('python:'): |
@@ -103,7 +103,7 Note: old client behave as a publishing | |||||
103 | import errno |
|
103 | import errno | |
104 | from node import nullid, nullrev, bin, hex, short |
|
104 | from node import nullid, nullrev, bin, hex, short | |
105 | from i18n import _ |
|
105 | from i18n import _ | |
106 | import util |
|
106 | import util, error | |
107 | import obsolete |
|
107 | import obsolete | |
108 |
|
108 | |||
109 | allphases = public, draft, secret = range(3) |
|
109 | allphases = public, draft, secret = range(3) |
@@ -584,14 +584,6 def _descendants(repo, subset, x, follow | |||||
584 | if not args: |
|
584 | if not args: | |
585 | return [] |
|
585 | return [] | |
586 | s = set(_revdescendants(repo, args, followfirst)) | set(args) |
|
586 | s = set(_revdescendants(repo, args, followfirst)) | set(args) | |
587 |
|
||||
588 | if len(subset) == len(repo): |
|
|||
589 | # the passed in revisions may not exist, -1 for example |
|
|||
590 | for arg in args: |
|
|||
591 | if arg not in subset: |
|
|||
592 | s.remove(arg) |
|
|||
593 | return list(s) |
|
|||
594 |
|
||||
595 | return [r for r in subset if r in s] |
|
587 | return [r for r in subset if r in s] | |
596 |
|
588 | |||
597 | def descendants(repo, subset, x): |
|
589 | def descendants(repo, subset, x): | |
@@ -1349,10 +1341,7 def roots(repo, subset, x): | |||||
1349 | Changesets in set with no parent changeset in set. |
|
1341 | Changesets in set with no parent changeset in set. | |
1350 | """ |
|
1342 | """ | |
1351 | s = set(getset(repo, repo.changelog, x)) |
|
1343 | s = set(getset(repo, repo.changelog, x)) | |
1352 | if len(subset) == len(repo): |
|
1344 | subset = [r for r in subset if r in s] | |
1353 | subset = s |
|
|||
1354 | else: |
|
|||
1355 | subset = [r for r in subset if r in s] |
|
|||
1356 | cs = _children(repo, subset, s) |
|
1345 | cs = _children(repo, subset, s) | |
1357 | return [r for r in subset if r not in cs] |
|
1346 | return [r for r in subset if r not in cs] | |
1358 |
|
1347 |
@@ -899,7 +899,7 class chunkbuffer(object): | |||||
899 | """Read L bytes of data from the iterator of chunks of data. |
|
899 | """Read L bytes of data from the iterator of chunks of data. | |
900 | Returns less than L bytes if the iterator runs dry.""" |
|
900 | Returns less than L bytes if the iterator runs dry.""" | |
901 | left = l |
|
901 | left = l | |
902 |
buf = |
|
902 | buf = [] | |
903 | queue = self._queue |
|
903 | queue = self._queue | |
904 | while left > 0: |
|
904 | while left > 0: | |
905 | # refill the queue |
|
905 | # refill the queue | |
@@ -917,11 +917,11 class chunkbuffer(object): | |||||
917 | left -= len(chunk) |
|
917 | left -= len(chunk) | |
918 | if left < 0: |
|
918 | if left < 0: | |
919 | queue.appendleft(chunk[left:]) |
|
919 | queue.appendleft(chunk[left:]) | |
920 |
buf |
|
920 | buf.append(chunk[:left]) | |
921 | else: |
|
921 | else: | |
922 |
buf |
|
922 | buf.append(chunk) | |
923 |
|
923 | |||
924 | return buf |
|
924 | return ''.join(buf) | |
925 |
|
925 | |||
926 | def filechunkiter(f, size=65536, limit=None): |
|
926 | def filechunkiter(f, size=65536, limit=None): | |
927 | """Create a generator that produces the data in the file size |
|
927 | """Create a generator that produces the data in the file size |
@@ -337,8 +337,17 test that phase are displayed in log at | |||||
337 | description: |
|
337 | description: | |
338 | A |
|
338 | A | |
339 |
|
339 | |||
|
340 | ||||
|
341 | ||||
|
342 | (Issue3707) | |||
|
343 | test invalid phase name | |||
|
344 | ||||
|
345 | $ mkcommit I --config phases.new-commit='babar' | |||
|
346 | transaction abort! | |||
|
347 | rollback completed | |||
|
348 | abort: phases.new-commit: not a valid phase name ('babar') | |||
|
349 | [255] | |||
340 |
|
350 | |||
341 |
|
||||
342 | Test phase command |
|
351 | Test phase command | |
343 | =================== |
|
352 | =================== | |
344 |
|
353 |
General Comments 0
You need to be logged in to leave comments.
Login now