| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a83eee5 commit 60e5413
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,7 +120,7 @@ def wait(self): | |||
| 120 | 120 | :raise GitCommandError: if the return status is not 0""" | |
| 121 | 121 | status = self.proc.wait() | |
| 122 | 122 | if status != 0: | |
| 123 | - raise GitCommandError(self.args, status, self.proc.stderr.read()) | ||
| 123 | + raise GitCommandError(self.args, status, self.proc.stderr.read().decode(defenc)) | ||
| 124 | 124 | # END status handling | |
| 125 | 125 | return status | |
| 126 | 126 | # END auto interrupt | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,10 +29,12 @@ def __init__(self, command, status, stderr=None, stdout=None): | |||
| 29 | 29 | self.command = command | |
| 30 | 30 | ||
| 31 | 31 | def __str__(self): | |
| 32 | - ret = "'%s' returned exit status %i: %s" % \ | ||
| 33 | - (' '.join(str(i) for i in self.command), self.status, self.stderr) | ||
| 34 | - if self.stdout is not None: | ||
| 35 | - ret += "\nstdout: %s" % self.stdout | ||
| 32 | + ret = "'%s' returned with exit code %i" % \ | ||
| 33 | + (' '.join(str(i) for i in self.command), self.status) | ||
| 34 | + if self.stderr: | ||
| 35 | + ret += "\nstderr: '%s'" % self.stderr | ||
| 36 | + if self.stdout: | ||
| 37 | + ret += "\nstdout: '%s'" % self.stdout | ||
| 36 | 38 | return ret | |
| 37 | 39 | ||
| 38 | 40 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,7 +138,7 @@ def remote_ref(self): | |||
| 138 | 138 | @classmethod | |
| 139 | 139 | def _from_line(cls, remote, line): | |
| 140 | 140 | """Create a new PushInfo instance as parsed from line which is expected to be like | |
| 141 | - refs/heads/master:refs/heads/master 05d2687..1d0568e""" | ||
| 141 | + refs/heads/master:refs/heads/master 05d2687..1d0568e as bytes""" | ||
| 142 | 142 | control_character, from_to, summary = line.split('\t', 3) | |
| 143 | 143 | flags = 0 | |
| 144 | 144 | ||
@@ -522,6 +522,7 @@ def update(self, **kwargs): | |||
| 522 | 522 | ||
| 523 | 523 | def _get_fetch_info_from_stderr(self, proc, progress): | |
| 524 | 524 | # skip first line as it is some remote info we are not interested in | |
| 525 | + # TODO: Use poll() to process stdout and stderr at same time | ||
| 525 | 526 | output = IterableList('name') | |
| 526 | 527 | ||
| 527 | 528 | # lines which are no progress are fetch info lines | |
@@ -544,8 +545,8 @@ def _get_fetch_info_from_stderr(self, proc, progress): | |||
| 544 | 545 | # END for each line | |
| 545 | 546 | ||
| 546 | 547 | # read head information | |
| 547 | - fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'r') | ||
| 548 | - fetch_head_info = fp.readlines() | ||
| 548 | + fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') | ||
| 549 | + fetch_head_info = [l.decode(defenc) for l in fp.readlines()] | ||
| 549 | 550 | fp.close() | |
| 550 | 551 | ||
| 551 | 552 | # NOTE: We assume to fetch at least enough progress lines to allow matching each fetch head line with it. | |
@@ -562,18 +563,19 @@ def _get_push_info(self, proc, progress): | |||
| 562 | 563 | # we hope stdout can hold all the data, it should ... | |
| 563 | 564 | # read the lines manually as it will use carriage returns between the messages | |
| 564 | 565 | # to override the previous one. This is why we read the bytes manually | |
| 566 | + # TODO: poll() on file descriptors to know what to read next, process streams concurrently | ||
| 565 | 567 | digest_process_messages(proc.stderr, progress) | |
| 566 | 568 | ||
| 567 | 569 | output = IterableList('name') | |
| 568 | 570 | for line in proc.stdout.readlines(): | |
| 571 | + line = line.decode(defenc) | ||
| 569 | 572 | try: | |
| 570 | 573 | output.append(PushInfo._from_line(self, line)) | |
| 571 | 574 | except ValueError: | |
| 572 | 575 | # if an error happens, additional info is given which we cannot parse | |
| 573 | 576 | pass | |
| 574 | 577 | # END exception handling | |
| 575 | 578 | # END for each line | |
| 576 | - | ||
| 577 | 579 | finalize_process(proc) | |
| 578 | 580 | return output | |
| 579 | 581 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | def touch(filename): | |
| 24 | - fp = open(filename, "a") | ||
| 24 | + fp = open(filename, "ab") | ||
| 25 | 25 | fp.close() | |
| 26 | 26 | ||
| 27 | 27 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -193,7 +193,7 @@ def remote_repo_creator(self): | |||
| 193 | 193 | temp_dir = os.path.dirname(_mktemp()) | |
| 194 | 194 | # On windows, this will fail ... we deal with failures anyway and default to telling the user to do it | |
| 195 | 195 | try: | |
| 196 | - gd = Git().daemon(temp_dir, as_process=True) | ||
| 196 | + gd = Git().daemon(temp_dir, enable='receive-pack', as_process=True) | ||
| 197 | 197 | # yes, I know ... fortunately, this is always going to work if sleep time is just large enough | |
| 198 | 198 | time.sleep(0.5) | |
| 199 | 199 | except Exception: | |
@@ -215,7 +215,8 @@ def remote_repo_creator(self): | |||
| 215 | 215 | msg += 'Otherwise, run: git-daemon "%s"' % temp_dir | |
| 216 | 216 | raise AssertionError(msg) | |
| 217 | 217 | else: | |
| 218 | - msg = 'Please start a git-daemon to run this test, execute: git-daemon "%s"' % temp_dir | ||
| 218 | + msg = 'Please start a git-daemon to run this test, execute: git daemon --enable=receive-pack "%s"' | ||
| 219 | + msg %= temp_dir | ||
| 219 | 220 | raise AssertionError(msg) | |
| 220 | 221 | # END make assertion | |
| 221 | 222 | # END catch ls remote error | |
@@ -227,15 +228,17 @@ def remote_repo_creator(self): | |||
| 227 | 228 | return func(self, rw_repo, rw_remote_repo) | |
| 228 | 229 | finally: | |
| 229 | 230 | # gd.proc.kill() ... no idea why that doesn't work | |
| 230 | - os.kill(gd.proc.pid, 15) | ||
| 231 | + if gd is not None: | ||
| 232 | + os.kill(gd.proc.pid, 15) | ||
| 231 | 233 | ||
| 232 | 234 | os.chdir(prev_cwd) | |
| 233 | 235 | rw_repo.git.clear_cache() | |
| 234 | 236 | rw_remote_repo.git.clear_cache() | |
| 235 | 237 | shutil.rmtree(repo_dir, onerror=_rmtree_onerror) | |
| 236 | 238 | shutil.rmtree(remote_repo_dir, onerror=_rmtree_onerror) | |
| 237 | 239 | ||
| 238 | - gd.proc.wait() | ||
| 240 | + if gd is not None: | ||
| 241 | + gd.proc.wait() | ||
| 239 | 242 | # END cleanup | |
| 240 | 243 | # END bare repo creator | |
| 241 | 244 | remote_repo_creator.__name__ = func.__name__ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments