- # 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"
- success, changed = main.merge_with(local, user=user, message=message)
- # 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):
- success, changed = main.merge_with(local, user=user, message=message)
-
- # 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):
- success, changed = local.merge_with(main, user=user, \
- message='$AUTO$ Local branch update during share.')
-
- else:
- print "case 4"
- success, changed = local.merge_with(main, user=user, \
- message='$AUTO$ Local branch update during share.')