comparison mercurial/destutil.py @ 28189:fac3a24be50e

rebase: choose default destination the same way as 'hg merge' (BC) This changeset finally make 'hg rebase' choose its default destination using the same logic as 'hg merge'. The previous default was "tipmost changeset on the current branch", the new default is "the other head if there is only one". This change has multiple consequences: - Multiple tests which were not rebasing anything (rebasing from tipmost head) are now rebasing on the other "lower" branch. This is the expected new behavior. - A test is now explicitly aborting when there is too many heads on the branch. This is the expected behavior. - We gained a better detection of the "nothing to rebase" case while performing 'hg pull --rebase' so the message have been updated. Making clearer than an update was performed and why. This is beneficial side-effect. - Rebasing from an active bookmark will behave the same as 'hg merge' from a bookmark.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 14 Feb 2016 13:25:59 +0000
parents 3324345a498e
children 9da2283d0c56
comparison
equal deleted inserted replaced
28188:6411140aeda9 28189:fac3a24be50e
139 'toomanybookmarks': 139 'toomanybookmarks':
140 {'merge': 140 {'merge':
141 (_("multiple matching bookmarks to merge -" 141 (_("multiple matching bookmarks to merge -"
142 " please merge with an explicit rev or bookmark"), 142 " please merge with an explicit rev or bookmark"),
143 _("run 'hg heads' to see all heads")), 143 _("run 'hg heads' to see all heads")),
144 'rebase':
145 (_("multiple matching bookmarks to rebase -"
146 " please rebase to an explicit rev or bookmark"),
147 _("run 'hg heads' to see all heads")),
144 }, 148 },
145 # no other matching divergent bookmark 149 # no other matching divergent bookmark
146 'nootherbookmarks': 150 'nootherbookmarks':
147 {'merge': 151 {'merge':
148 (_("no matching bookmark to merge - " 152 (_("no matching bookmark to merge - "
149 "please merge with an explicit rev or bookmark"), 153 "please merge with an explicit rev or bookmark"),
150 _("run 'hg heads' to see all heads")), 154 _("run 'hg heads' to see all heads")),
155 'rebase':
156 (_("no matching bookmark to rebase - "
157 "please rebase to an explicit rev or bookmark"),
158 _("run 'hg heads' to see all heads")),
151 }, 159 },
152 # branch have too many unbookmarked heads, no obvious destination 160 # branch have too many unbookmarked heads, no obvious destination
153 'toomanyheads': 161 'toomanyheads':
154 {'merge': 162 {'merge':
155 (_("branch '%s' has %d heads - please merge with an explicit rev"), 163 (_("branch '%s' has %d heads - please merge with an explicit rev"),
156 _("run 'hg heads .' to see heads")), 164 _("run 'hg heads .' to see heads")),
165 'rebase':
166 (_("branch '%s' has %d heads - please rebase to an explicit rev"),
167 _("run 'hg heads .' to see heads")),
157 }, 168 },
158 # branch have no other unbookmarked heads 169 # branch have no other unbookmarked heads
159 'bookmarkedheads': 170 'bookmarkedheads':
160 {'merge': 171 {'merge':
161 (_("heads are bookmarked - please merge with an explicit rev"), 172 (_("heads are bookmarked - please merge with an explicit rev"),
162 _("run 'hg heads' to see all heads")), 173 _("run 'hg heads' to see all heads")),
174 'rebase':
175 (_("heads are bookmarked - please rebase to an explicit rev"),
176 _("run 'hg heads' to see all heads")),
163 }, 177 },
164 # branch have just a single heads, but there is other branches 178 # branch have just a single heads, but there is other branches
165 'nootherbranchheads': 179 'nootherbranchheads':
166 {'merge': 180 {'merge':
167 (_("branch '%s' has one head - please merge with an explicit rev"), 181 (_("branch '%s' has one head - please merge with an explicit rev"),
168 _("run 'hg heads' to see all heads")), 182 _("run 'hg heads' to see all heads")),
183 'rebase':
184 (_("branch '%s' has one head - please rebase to an explicit rev"),
185 _("run 'hg heads' to see all heads")),
169 }, 186 },
170 # repository have a single head 187 # repository have a single head
171 'nootherheads': 188 'nootherheads':
172 {'merge': 189 {'merge':
173 (_('nothing to merge'), 190 (_('nothing to merge'),
174 None), 191 None),
192 'rebase':
193 (_('nothing to rebase'),
194 None),
175 }, 195 },
176 # repository have a single head and we are not on it 196 # repository have a single head and we are not on it
177 'nootherheadsbehind': 197 'nootherheadsbehind':
178 {'merge': 198 {'merge':
179 (_('nothing to merge'), 199 (_('nothing to merge'),
180 _("use 'hg update' instead")), 200 _("use 'hg update' instead")),
201 'rebase':
202 (_('nothing to rebase'),
203 _("use 'hg update' instead")),
181 }, 204 },
182 # We are not on a head 205 # We are not on a head
183 'notatheads': 206 'notatheads':
184 {'merge': 207 {'merge':
185 (_('working directory not at a head revision'), 208 (_('working directory not at a head revision'),
186 _("use 'hg update' or merge with an explicit revision")) 209 _("use 'hg update' or merge with an explicit revision")),
210 'rebase':
211 (_('working directory not at a head revision'),
212 _("use 'hg update' or rebase to an explicit revision"))
187 }, 213 },
188 'emptysourceset': 214 'emptysourceset':
189 {'merge': 215 {'merge':
190 (_('source set is empty'), 216 (_('source set is empty'),
191 None) 217 None),
218 'rebase':
219 (_('source set is empty'),
220 None),
192 }, 221 },
193 'multiplebranchessourceset': 222 'multiplebranchessourceset':
194 {'merge': 223 {'merge':
195 (_('source set is rooted in multiple branches'), 224 (_('source set is rooted in multiple branches'),
196 None) 225 None),
226 'rebase':
227 (_('rebaseset is rooted in multiple named branches'),
228 _('specify an explicit destination with --dest')),
197 }, 229 },
198 } 230 }
199 231
200 def _destmergebook(repo, action='merge', sourceset=None): 232 def _destmergebook(repo, action='merge', sourceset=None):
201 """find merge destination in the active bookmark case""" 233 """find merge destination in the active bookmark case"""