##// END OF EJS Templates
destutil: extract all 'mergedest' abort messages into a dictionary...
Pierre-Yves David -
r28102:bd74b5e0 default
parent child Browse files
Show More
@@ -134,6 +134,43 b' def destupdate(repo, clean=False, check='
134
134
135 return rev, movemark, activemark
135 return rev, movemark, activemark
136
136
137 msgdestmerge = {
138 # too many matching divergent bookmark
139 'toomanybookmarks':
140 (_("multiple matching bookmarks to merge -"
141 " please merge with an explicit rev or bookmark"),
142 _("run 'hg heads' to see all heads")),
143 # no other matching divergent bookmark
144 'nootherbookmarks':
145 (_("no matching bookmark to merge - "
146 "please merge with an explicit rev or bookmark"),
147 _("run 'hg heads' to see all heads")),
148 # branch have too many unbookmarked heads, no obvious destination
149 'toomanyheads':
150 (_("branch '%s' has %d heads - please merge with an explicit rev"),
151 _("run 'hg heads .' to see heads")),
152 # branch have no other unbookmarked heads
153 'bookmarkedheads':
154 (_("heads are bookmarked - please merge with an explicit rev"),
155 _("run 'hg heads' to see all heads")),
156 # branch have just a single heads, but there is other branches
157 'nootherbranchheads':
158 (_("branch '%s' has one head - please merge with an explicit rev"),
159 _("run 'hg heads' to see all heads")),
160 # repository have a single head
161 'nootherheads':
162 (_('nothing to merge'),
163 None),
164 # repository have a single head and we are not on it
165 'nootherheadsbehind':
166 (_('nothing to merge'),
167 _("use 'hg update' instead")),
168 # We are not on a head
169 'notatheads':
170 (_('working directory not at a head revision'),
171 _("use 'hg update' or merge with an explicit revision"))
172 }
173
137 def _destmergebook(repo):
174 def _destmergebook(repo):
138 """find merge destination in the active bookmark case"""
175 """find merge destination in the active bookmark case"""
139 node = None
176 node = None
@@ -145,13 +182,11 b' def _destmergebook(repo):'
145 else:
182 else:
146 node = bmheads[0]
183 node = bmheads[0]
147 elif len(bmheads) > 2:
184 elif len(bmheads) > 2:
148 raise error.Abort(_("multiple matching bookmarks to merge - "
185 msg, hint = msgdestmerge['toomanybookmarks']
149 "please merge with an explicit rev or bookmark"),
186 raise error.Abort(msg, hint=hint)
150 hint=_("run 'hg heads' to see all heads"))
151 elif len(bmheads) <= 1:
187 elif len(bmheads) <= 1:
152 raise error.Abort(_("no matching bookmark to merge - "
188 msg, hint = msgdestmerge['nootherbookmarks']
153 "please merge with an explicit rev or bookmark"),
189 raise error.Abort(msg, hint=hint)
154 hint=_("run 'hg heads' to see all heads"))
155 assert node is not None
190 assert node is not None
156 return node
191 return node
157
192
@@ -163,31 +198,26 b' def _destmergebranch(repo):'
163 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
198 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
164
199
165 if len(nbhs) > 2:
200 if len(nbhs) > 2:
166 raise error.Abort(_("branch '%s' has %d heads - "
201 msg, hint = msgdestmerge['toomanyheads']
167 "please merge with an explicit rev")
202 msg %= (branch, len(bheads))
168 % (branch, len(bheads)),
203 raise error.Abort(msg, hint=hint)
169 hint=_("run 'hg heads .' to see heads"))
170
204
171 parent = repo.dirstate.p1()
205 parent = repo.dirstate.p1()
172 if len(nbhs) <= 1:
206 if len(nbhs) <= 1:
173 if len(bheads) > 1:
207 if len(bheads) > 1:
174 raise error.Abort(_("heads are bookmarked - "
208 msg, hint = msgdestmerge['bookmarkedheads']
175 "please merge with an explicit rev"),
209 elif len(repo.heads()) > 1:
176 hint=_("run 'hg heads' to see all heads"))
210 msg, hint = msgdestmerge['nootherbranchheads']
177 if len(repo.heads()) > 1:
211 msg %= branch
178 raise error.Abort(_("branch '%s' has one head - "
212 elif parent != repo.lookup(branch):
179 "please merge with an explicit rev")
213 msg, hint = msgdestmerge['nootherheadsbehind']
180 % branch,
214 else:
181 hint=_("run 'hg heads' to see all heads"))
215 msg, hint = msgdestmerge['nootherheads']
182 msg, hint = _('nothing to merge'), None
183 if parent != repo.lookup(branch):
184 hint = _("use 'hg update' instead")
185 raise error.Abort(msg, hint=hint)
216 raise error.Abort(msg, hint=hint)
186
217
187 if parent not in bheads:
218 if parent not in bheads:
188 raise error.Abort(_('working directory not at a head revision'),
219 msg, hint = msgdestmerge['notatheads']
189 hint=_("use 'hg update' or merge with an "
220 raise error.Abort(msg, hint=hint)
190 "explicit revision"))
191 if parent == nbhs[0]:
221 if parent == nbhs[0]:
192 node = nbhs[-1]
222 node = nbhs[-1]
193 else:
223 else:
General Comments 0
You need to be logged in to leave comments. Login now