X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/588a7414ee52328525dfcb514e580da877e4ff3c..a79cd5d5eb048bdd9e78d096f7f2cbf923d85eca:/stgit/lib/transaction.py diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py index de62a8c..54de127 100644 --- a/stgit/lib/transaction.py +++ b/stgit/lib/transaction.py @@ -94,6 +94,7 @@ class StackTransaction(object): self.__base = self.__stack.base self.__discard_changes = discard_changes self.__bad_head = None + self.__conflicts = None if isinstance(allow_conflicts, bool): self.__allow_conflicts = lambda trans: allow_conflicts else: @@ -201,7 +202,10 @@ class StackTransaction(object): self.__stack.set_head(new_head, self.__msg) if self.__error: - out.error(self.__error) + if self.__conflicts: + out.error(*([self.__error] + self.__conflicts)) + else: + out.error(self.__error) # Write patches. def write(msg): @@ -290,7 +294,6 @@ class StackTransaction(object): conflicts to them.""" orig_cd = self.patches[pn].data cd = orig_cd.set_committer(None) - s = ['', ' (empty)'][cd.is_nochange()] oldparent = cd.parent cd = cd.set_parent(self.top) base = oldparent.data.tree @@ -298,6 +301,7 @@ class StackTransaction(object): theirs = cd.tree tree, self.temp_index_tree = self.temp_index.merge( base, ours, theirs, self.temp_index_tree) + s = '' merge_conflict = False if not tree: if iw == None: @@ -311,9 +315,10 @@ class StackTransaction(object): tree = iw.index.write_tree() self.__current_tree = tree s = ' (modified)' - except git.MergeConflictException: + except git.MergeConflictException, e: tree = ours merge_conflict = True + self.__conflicts = e.conflicts s = ' (conflict)' except git.MergeException, e: self.__halt(str(e)) @@ -321,9 +326,12 @@ class StackTransaction(object): if any(getattr(cd, a) != getattr(orig_cd, a) for a in ['parent', 'tree', 'author', 'message']): comm = self.__stack.repository.commit(cd) + self.head = comm else: comm = None s = ' (unmodified)' + if not merge_conflict and cd.is_nochange(): + s = ' (empty)' out.info('Pushed %s%s' % (pn, s)) def update(): if comm: @@ -341,7 +349,7 @@ class StackTransaction(object): # Save this update so that we can run it a little later. self.__conflicting_push = update - self.__halt('Merge conflict') + self.__halt("%d merge conflict(s)" % len(self.__conflicts)) else: # Update immediately. update()