/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/_dirstate_helpers_py.py

  • Committer: Martin
  • Date: 2017-06-10 00:39:34 UTC
  • mto: This revision was merged to the branch mainline in revision 6676.
  • Revision ID: gzlist@googlemail.com-20170610003934-ubq4y9z5s7gyy1c7
Change cmp_by_dirs to lt_by_dirs

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
    return lo
164
164
 
165
165
 
166
 
def cmp_by_dirs(path1, path2):
 
166
def lt_by_dirs(path1, path2):
167
167
    """Compare two paths directory by directory.
168
168
 
169
169
    This is equivalent to doing::
170
170
 
171
 
       cmp(path1.split('/'), path2.split('/'))
 
171
       operator.lt(path1.split('/'), path2.split('/'))
172
172
 
173
173
    The idea is that you should compare path components separately. This
174
 
    differs from plain ``cmp(path1, path2)`` for paths like ``'a-b'`` and
175
 
    ``a/b``. "a-b" comes after "a" but would come before "a/b" lexically.
 
174
    differs from plain ``path1 < path2`` for paths like ``'a-b'`` and ``a/b``.
 
175
    "a-b" comes after "a" but would come before "a/b" lexically.
176
176
 
177
177
    :param path1: first path
178
178
    :param path2: second path
179
 
    :return: negative number if ``path1`` comes first,
180
 
        0 if paths are equal,
181
 
        and positive number if ``path2`` sorts first
 
179
    :return: True if path1 comes first, otherwise False
182
180
    """
183
181
    if not isinstance(path1, str):
184
182
        raise TypeError("'path1' must be a plain string, not %s: %r"
186
184
    if not isinstance(path2, str):
187
185
        raise TypeError("'path2' must be a plain string, not %s: %r"
188
186
                        % (type(path2), path2))
189
 
    return cmp(path1.split('/'), path2.split('/'))
 
187
    return path1.split('/') < path2.split('/')
190
188
 
191
189
 
192
190
def _cmp_path_by_dirblock(path1, path2):