##// END OF EJS Templates
vcs: Return merge reference in merge response....
Martin Bornhold -
r1051:668a5e47 default
parent child Browse files
Show More
@@ -53,7 +53,7 b' FILEMODE_EXECUTABLE = 0100755'
53 Reference = collections.namedtuple('Reference', ('type', 'name', 'commit_id'))
53 Reference = collections.namedtuple('Reference', ('type', 'name', 'commit_id'))
54 MergeResponse = collections.namedtuple(
54 MergeResponse = collections.namedtuple(
55 'MergeResponse',
55 'MergeResponse',
56 ('possible', 'executed', 'merge_commit_id', 'failure_reason'))
56 ('possible', 'executed', 'merge_ref', 'failure_reason'))
57
57
58
58
59 class MergeFailureReason(object):
59 class MergeFailureReason(object):
@@ -36,7 +36,7 b' from rhodecode.lib.utils import safe_uni'
36 from rhodecode.lib.vcs import connection, path as vcspath
36 from rhodecode.lib.vcs import connection, path as vcspath
37 from rhodecode.lib.vcs.backends.base import (
37 from rhodecode.lib.vcs.backends.base import (
38 BaseRepository, CollectionGenerator, Config, MergeResponse,
38 BaseRepository, CollectionGenerator, Config, MergeResponse,
39 MergeFailureReason)
39 MergeFailureReason, Reference)
40 from rhodecode.lib.vcs.backends.git.commit import GitCommit
40 from rhodecode.lib.vcs.backends.git.commit import GitCommit
41 from rhodecode.lib.vcs.backends.git.diff import GitDiff
41 from rhodecode.lib.vcs.backends.git.diff import GitDiff
42 from rhodecode.lib.vcs.backends.git.inmemory import GitInMemoryCommit
42 from rhodecode.lib.vcs.backends.git.inmemory import GitInMemoryCommit
@@ -869,7 +869,7 b' class GitRepository(BaseRepository):'
869 return MergeResponse(
869 return MergeResponse(
870 False, False, None, MergeFailureReason.MISSING_COMMIT)
870 False, False, None, MergeFailureReason.MISSING_COMMIT)
871
871
872 merge_commit_id = None
872 merge_ref = None
873 merge_failure_reason = MergeFailureReason.NONE
873 merge_failure_reason = MergeFailureReason.NONE
874 try:
874 try:
875 shadow_repo._local_merge(merge_message, merger_name, merger_email,
875 shadow_repo._local_merge(merge_message, merger_name, merger_email,
@@ -885,6 +885,7 b' class GitRepository(BaseRepository):'
885 # be used to easily identify the last successful merge commit in
885 # be used to easily identify the last successful merge commit in
886 # the shadow repository.
886 # the shadow repository.
887 shadow_repo.set_refs('refs/heads/pr-merge', merge_commit_id)
887 shadow_repo.set_refs('refs/heads/pr-merge', merge_commit_id)
888 merge_ref = Reference('branch', 'pr-merge', merge_commit_id)
888 except RepositoryError:
889 except RepositoryError:
889 log.exception('Failure when doing local merge on git shadow repo')
890 log.exception('Failure when doing local merge on git shadow repo')
890 merge_possible = False
891 merge_possible = False
@@ -905,7 +906,7 b' class GitRepository(BaseRepository):'
905 merge_succeeded = False
906 merge_succeeded = False
906
907
907 return MergeResponse(
908 return MergeResponse(
908 merge_possible, merge_succeeded, merge_commit_id,
909 merge_possible, merge_succeeded, merge_ref,
909 merge_failure_reason)
910 merge_failure_reason)
910
911
911 def _get_shadow_repository_path(self, workspace_id):
912 def _get_shadow_repository_path(self, workspace_id):
@@ -38,7 +38,7 b' from rhodecode.lib.utils import safe_uni'
38 from rhodecode.lib.vcs import connection
38 from rhodecode.lib.vcs import connection
39 from rhodecode.lib.vcs.backends.base import (
39 from rhodecode.lib.vcs.backends.base import (
40 BaseRepository, CollectionGenerator, Config, MergeResponse,
40 BaseRepository, CollectionGenerator, Config, MergeResponse,
41 MergeFailureReason)
41 MergeFailureReason, Reference)
42 from rhodecode.lib.vcs.backends.hg.commit import MercurialCommit
42 from rhodecode.lib.vcs.backends.hg.commit import MercurialCommit
43 from rhodecode.lib.vcs.backends.hg.diff import MercurialDiff
43 from rhodecode.lib.vcs.backends.hg.diff import MercurialDiff
44 from rhodecode.lib.vcs.backends.hg.inmemory import MercurialInMemoryCommit
44 from rhodecode.lib.vcs.backends.hg.inmemory import MercurialInMemoryCommit
@@ -693,7 +693,7 b' class MercurialRepository(BaseRepository'
693 return MergeResponse(
693 return MergeResponse(
694 False, False, None, MergeFailureReason.MISSING_COMMIT)
694 False, False, None, MergeFailureReason.MISSING_COMMIT)
695
695
696 merge_commit_id = None
696 merge_ref = None
697 merge_failure_reason = MergeFailureReason.NONE
697 merge_failure_reason = MergeFailureReason.NONE
698
698
699 try:
699 try:
@@ -706,6 +706,7 b' class MercurialRepository(BaseRepository'
706 # used to easily identify the last successful merge commit in the
706 # used to easily identify the last successful merge commit in the
707 # shadow repository.
707 # shadow repository.
708 shadow_repo.bookmark('pr-merge', revision=merge_commit_id)
708 shadow_repo.bookmark('pr-merge', revision=merge_commit_id)
709 merge_ref = Reference('book', 'pr-merge', merge_commit_id)
709 except RepositoryError:
710 except RepositoryError:
710 log.exception('Failure when doing local merge on hg shadow repo')
711 log.exception('Failure when doing local merge on hg shadow repo')
711 merge_possible = False
712 merge_possible = False
@@ -743,8 +744,7 b' class MercurialRepository(BaseRepository'
743 merge_succeeded = False
744 merge_succeeded = False
744
745
745 return MergeResponse(
746 return MergeResponse(
746 merge_possible, merge_succeeded, merge_commit_id,
747 merge_possible, merge_succeeded, merge_ref, merge_failure_reason)
747 merge_failure_reason)
748
748
749 def _get_shadow_instance(
749 def _get_shadow_instance(
750 self, shadow_repository_path, enable_hooks=False):
750 self, shadow_repository_path, enable_hooks=False):
General Comments 0
You need to be logged in to leave comments. Login now