Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/mr/developer/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def worker(working_copies, the_queue):
return
try:
output = action(**kwargs)
except WCError:
except WCError as e:
threading.current_thread().exc = e
output_lock.acquire()
for lvl, msg in wc._output:
lvl(msg)
Expand Down Expand Up @@ -259,6 +260,12 @@ def _cleanup():
thread.start()
threads.append(thread)
for thread in threads:
exc = None
if hasattr(thread, "exc"):
exc = thread.exc
delattr(thread, "exc")
if exc:
raise thread.exc
thread.join()
if sys.version_info < (2, 6):
subprocess._cleanup = _old_subprocess_cleanup
Expand Down
8 changes: 5 additions & 3 deletions src/mr/developer/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def git_switch_branch(self, stdout_in, stderr_in, accept_missing=False):
return (stdout_in + stdout,
stderr_in + stderr)
else:
self.output((logger.error, "No such branch %r", branch))
sys.exit(1)
raise GitError("No such branch %r" % branch)
# runs the checkout with predetermined arguments
cmd = self.run_git(argv, cwd=path)
stdout, stderr = cmd.communicate()
Expand Down Expand Up @@ -288,7 +287,10 @@ def matches(self):
def update(self, **kwargs):
name = self.source['name']
if not self.matches():
self.output((logger.warning, "Can't update package '%s' because its URL doesn't match." % name))
message = "Can't update package '%s' because its URL doesn't match." % name
if kwargs.get("force"):
raise GitError(message)
self.output((logger.warning, message))
if self.status() != 'clean' and not kwargs.get('force', False):
raise GitError("Can't update package '%s' because it's dirty." % name)
return self.git_update(**kwargs)
Expand Down