##// END OF EJS Templates
rebase: filter out descendants of divergence-causing commits earlier...
rebase: filter out descendants of divergence-causing commits earlier `hg rebase` treats obsolete commits differently depending what has happened to the commit: 1) Obsolete commit without non-obsolete successors: Skipped, and a note is printed ("it has no successor"). 2) Obsolete commit with a successor in the destination (ancestor of it): Skipped, and a note is printed ("already in destination"). 3) Obsolete commit with a successor in the rebase set: The commit and its descendants are skipped, and a note is printed ("not rebasing <commit> and its descendants as this would cause divergence"), unless `allowdivergence` config set. 4) Obsolete commit with a successor elsewhere: Error ("this rebase will cause divergences"), unless `allowdivergence` config set. Before this patch, we did all those checks up front, except for (3), which was checked later. The later check consisted of two parts: 1) filtering out of descendants, and 2) conditionally printing message if the `allowdivergence` config was not set. This patch makes it so we do the filtering early. A consequence of filtering out divergence-causing commits earlier is that we rebase commits in slightly different order, which has some impact on tests. Differential Revision: https://phab.mercurial-scm.org/D10249

File last commit:

r37195:68ee6182 default
r47590:535de0e3 default
Show More
mapping.py
128 lines | 3.4 KiB | text/x-python | PythonLexer
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Mapping Interfaces
"""
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
from __future__ import absolute_import
from .. import Interface
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193
class IItemMapping(Interface):
"""Simplest readable mapping object
"""
def __getitem__(key):
"""Get a value for a key
A KeyError is raised if there is no value for the key.
"""
class IReadMapping(IItemMapping):
"""Basic mapping interface
"""
def get(key, default=None):
"""Get a value for a key
The default is returned if there is no value for the key.
"""
def __contains__(key):
"""Tell if a key exists in the mapping."""
class IWriteMapping(Interface):
"""Mapping methods for changing data"""
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def __delitem__(key):
"""Delete a value from the mapping using the key."""
def __setitem__(key, value):
"""Set a new item in the mapping."""
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193
class IEnumerableMapping(IReadMapping):
"""Mapping objects whose items can be enumerated.
"""
def keys():
"""Return the keys of the mapping object.
"""
def __iter__():
"""Return an iterator for the keys of the mapping object.
"""
def values():
"""Return the values of the mapping object.
"""
def items():
"""Return the items of the mapping object.
"""
def __len__():
"""Return the number of items.
"""
class IMapping(IWriteMapping, IEnumerableMapping):
''' Simple mapping interface '''
class IIterableMapping(IEnumerableMapping):
def iterkeys():
"iterate over keys; equivalent to __iter__"
def itervalues():
"iterate over values"
def iteritems():
"iterate over items"
class IClonableMapping(Interface):
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def copy():
"return copy of dict"
class IExtendedReadMapping(IIterableMapping):
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def has_key(key):
"""Tell if a key exists in the mapping; equivalent to __contains__"""
class IExtendedWriteMapping(IWriteMapping):
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def clear():
"delete all items"
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def update(d):
" Update D from E: for k in E.keys(): D[k] = E[k]"
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def setdefault(key, default=None):
"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D"
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def pop(k, *args):
"""remove specified key and return the corresponding value
*args may contain a single default value, or may not be supplied.
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195 If key is not found, default is returned if given, otherwise
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 KeyError is raised"""
Gregory Szorc
thirdparty: port zope.interface to relative imports...
r37195
Gregory Szorc
thirdparty: vendor zope.interface 4.4.3...
r37193 def popitem():
"""remove and return some (key, value) pair as a
2-tuple; but raise KeyError if mapping is empty"""
class IFullMapping(
IExtendedReadMapping, IExtendedWriteMapping, IClonableMapping, IMapping):
''' Full mapping interface ''' # IMapping included so tests for IMapping
# succeed with IFullMapping