| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b6a6a10 commit 6ef2739
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,11 +7,11 @@ Changelog | |||
| 7 | 7 | ||
| 8 | 8 | * Fix: bug in ``git-blame --incremental`` output parser that broken when | |
| 9 | 9 | commit messages contained ``\r`` characters | |
| 10 | - * Fix: progress handler exceptions are not caught anymore, which would | ||
| 11 | - usually just hide bugs previously. | ||
| 12 | - * Fix: The ``Git.execute`` method will now redirect ``stdout`` to | ||
| 13 | - ``devnull`` if ``with_stdout`` is false, which is the intended behaviour | ||
| 14 | - based on the parameter's documentation. | ||
| 10 | + * Fix: progress handler exceptions are not caught anymore, which would usually just hide bugs | ||
| 11 | + previously. | ||
| 12 | + * Fix: The `Git.execute` method will now redirect `stdout` to `devnull` if `with_stdout` is false, | ||
| 13 | + which is the intended behaviour based on the parameter's documentation. | ||
| 14 | + * Fix: `RemoteProgress` will now strip the ', ' prefix or suffix from messages. | ||
| 15 | 15 | ||
| 16 | 16 | 2.0.2 - Fixes | |
| 17 | 17 | ============= | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,6 +62,14 @@ def update(self, op_code, cur_count, max_count=None, message=''): | |||
| 62 | 62 | # check each stage only comes once | |
| 63 | 63 | op_id = op_code & self.OP_MASK | |
| 64 | 64 | assert op_id in (self.COUNTING, self.COMPRESSING, self.WRITING) | |
| 65 | + | ||
| 66 | + if op_code & self.WRITING > 0: | ||
| 67 | + if op_code & self.BEGIN > 0: | ||
| 68 | + assert not message, 'should not have message when remote begins writing' | ||
| 69 | + elif op_code & self.END > 0: | ||
| 70 | + assert message | ||
| 71 | + assert not message.startswith(', '), "Sanitize progress messages: '%s'" % message | ||
| 72 | + assert not message.endswith(', '), "Sanitize progress messages: '%s'" % message | ||
| 65 | 73 | ||
| 66 | 74 | self._stages_per_op.setdefault(op_id, 0) | |
| 67 | 75 | self._stages_per_op[op_id] = self._stages_per_op[op_id] | (op_code & self.STAGE_MASK) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -171,12 +171,16 @@ class RemoteProgress(object): | |||
| 171 | 171 | STAGE_MASK = BEGIN | END | |
| 172 | 172 | OP_MASK = ~STAGE_MASK | |
| 173 | 173 | ||
| 174 | + DONE_TOKEN = 'done.' | ||
| 175 | + TOKEN_SEPARATOR = ', ' | ||
| 176 | + | ||
| 174 | 177 | __slots__ = ("_cur_line", "_seen_ops") | |
| 175 | - re_op_absolute = re.compile("(remote: )?([\w\s]+):\s+()(\d+)()(.*)") | ||
| 176 | - re_op_relative = re.compile("(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") | ||
| 178 | + re_op_absolute = re.compile(r"(remote: )?([\w\s]+):\s+()(\d+)()(.*)") | ||
| 179 | + re_op_relative = re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") | ||
| 177 | 180 | ||
| 178 | 181 | def __init__(self): | |
| 179 | 182 | self._seen_ops = list() | |
| 183 | + self._cur_line = None | ||
| 180 | 184 | ||
| 181 | 185 | def _parse_progress_line(self, line): | |
| 182 | 186 | """Parse progress information from the given line as retrieved by git-push | |
@@ -257,11 +261,11 @@ def _parse_progress_line(self, line): | |||
| 257 | 261 | # END message handling | |
| 258 | 262 | ||
| 259 | 263 | message = message.strip() | |
| 260 | - done_token = ', done.' | ||
| 261 | - if message.endswith(done_token): | ||
| 264 | + if message.endswith(self.DONE_TOKEN): | ||
| 262 | 265 | op_code |= self.END | |
| 263 | - message = message[:-len(done_token)] | ||
| 266 | + message = message[:-len(self.DONE_TOKEN)] | ||
| 264 | 267 | # END end message handling | |
| 268 | + message = message.strip(self.TOKEN_SEPARATOR) | ||
| 265 | 269 | ||
| 266 | 270 | self.update(op_code, | |
| 267 | 271 | cur_count and float(cur_count), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments