##// END OF EJS Templates

Compare Commits r1106:490ebeeb75af...r1108:ebe0247cd154

Target:

Source:

Time Author Commit Description
Martin Bornhold
r1106:490ebeeb75af
subrepo: Add merge failure reason code ad message for subrepo merge conflicts.
Martin Bornhold
r1107:6bc055e1504d
subrepo: Add exception for subrepo merge errors.
Martin Bornhold
r1108:ebe0247cd154
subrepo: Handle subrepo merge errors.
@@ -104,6 +104,10 b' class MergeFailureReason(object):'
104 # The source repo reference is missing.
104 # The source repo reference is missing.
105 MISSING_SOURCE_REF = 10
105 MISSING_SOURCE_REF = 10
106
106
107 # The merge was not successful, there are conflicts related to sub
108 # repositories.
109 SUBREPO_MERGE_FAILED = 11
110
107
111
108 class UpdateFailureReason(object):
112 class UpdateFailureReason(object):
109 """
113 """
@@ -44,7 +44,7 b' from rhodecode.lib.vcs.backends.hg.diff '
44 from rhodecode.lib.vcs.backends.hg.inmemory import MercurialInMemoryCommit
44 from rhodecode.lib.vcs.backends.hg.inmemory import MercurialInMemoryCommit
45 from rhodecode.lib.vcs.exceptions import (
45 from rhodecode.lib.vcs.exceptions import (
46 EmptyRepositoryError, RepositoryError, TagAlreadyExistError,
46 EmptyRepositoryError, RepositoryError, TagAlreadyExistError,
47 TagDoesNotExistError, CommitDoesNotExistError)
47 TagDoesNotExistError, CommitDoesNotExistError, SubrepoMergeError)
48
48
49 hexlify = binascii.hexlify
49 hexlify = binascii.hexlify
50 nullid = "\0" * 20
50 nullid = "\0" * 20
@@ -712,6 +712,11 b' class MercurialRepository(BaseRepository'
712 # shadow repository.
712 # shadow repository.
713 shadow_repo.bookmark('pr-merge', revision=merge_commit_id)
713 shadow_repo.bookmark('pr-merge', revision=merge_commit_id)
714 merge_ref = Reference('book', 'pr-merge', merge_commit_id)
714 merge_ref = Reference('book', 'pr-merge', merge_commit_id)
715 except SubrepoMergeError:
716 log.exception(
717 'Subrepo merge error during local merge on hg shadow repo.')
718 merge_possible = False
719 merge_failure_reason = MergeFailureReason.SUBREPO_MERGE_FAILED
715 except RepositoryError:
720 except RepositoryError:
716 log.exception('Failure when doing local merge on hg shadow repo')
721 log.exception('Failure when doing local merge on hg shadow repo')
717 merge_possible = False
722 merge_possible = False
@@ -128,6 +128,14 b' class NodeAlreadyRemovedError(Committing'
128 pass
128 pass
129
129
130
130
131 class SubrepoMergeError(RepositoryError):
132 """
133 This happens if we try to merge a repository which contains subrepos and
134 the subrepos cannot be merged. The subrepos are not merged itself but
135 their references in the root repo are merged.
136 """
137
138
131 class ImproperArchiveTypeError(VCSError):
139 class ImproperArchiveTypeError(VCSError):
132 pass
140 pass
133
141
@@ -156,6 +164,7 b' class UnhandledException(VCSError):'
156 # TODO: johbo: Define our own exception for this and stop abusing
164 # TODO: johbo: Define our own exception for this and stop abusing
157 # urllib's exception class.
165 # urllib's exception class.
158 'url_error': urllib2.URLError,
166 'url_error': urllib2.URLError,
167 'subrepo_merge_error': SubrepoMergeError,
159 }
168 }
160
169
161
170
@@ -105,6 +105,9 b' class PullRequestModel(BaseModel):'
105 MergeFailureReason.MISSING_SOURCE_REF: lazy_ugettext(
105 MergeFailureReason.MISSING_SOURCE_REF: lazy_ugettext(
106 'This pull request cannot be merged because the source '
106 'This pull request cannot be merged because the source '
107 'reference is missing.'),
107 'reference is missing.'),
108 MergeFailureReason.SUBREPO_MERGE_FAILED: lazy_ugettext(
109 'This pull request cannot be merged because of conflicts related '
110 'to sub repositories.'),
108 }
111 }
109
112
110 UPDATE_STATUS_MESSAGES = {
113 UPDATE_STATUS_MESSAGES = {