- # The local branch has been recently updated,
- # so we don't need to update yet again, but we need to
- # merge down to default branch, even if there was
- # no commit's since last update
-
- if main.ancestorof(local):
- print "case 1"
- main.merge_with(local, user=user, message=message)
- no_changes = False
- # Case 2:
- #
- # main * * local
- # |\ |
- # | \|
- # | *
- # | |
- #
- # Default has no changes, to update from this branch
- # since the last merge of local to default.
- elif local.has_common_ancestor(main):
- print "case 2"
- if not local.parentof(main):
- main.merge_with(local, user=user, message=message)
- no_changes = False
-
- # Case 3:
- # main *
- # |
- # * <- this case overlaps with previos one
- # |\
- # | \
- # | * local
- # | |
- #
- # There was a recent merge to the defaul branch and
- # no changes to local branch recently.
- #
- # Use the fact, that user is prepared to see changes, to
- # update his branch if there are any
- elif local.ancestorof(main):
- print "case 3"
- if not local.parentof(main):
- local.merge_with(main, user=user, message='Local branch update.')
- no_changes = False
- else:
- print "case 4"
- local.merge_with(main, user=user, message='Local branch update.')
- local = self.shelf()
- main.merge_with(local, user=user, message=message)
-
- print "no_changes: ", no_changes
- return no_changes