Mercurial > hg
view mercurial/strutil.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 | b723f05ec49b |
children |
line wrap: on
line source
# strutil.py - string utilities for Mercurial # # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import def findall(haystack, needle, start=0, end=None): if end is None: end = len(haystack) if end < 0: end += len(haystack) if start < 0: start += len(haystack) while start < end: c = haystack.find(needle, start, end) if c == -1: break yield c start = c + 1 def rfindall(haystack, needle, start=0, end=None): if end is None: end = len(haystack) if end < 0: end += len(haystack) if start < 0: start += len(haystack) while end >= 0: c = haystack.rfind(needle, start, end) if c == -1: break yield c end = c - 1