~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1930
1930
        lf.log_revision(lr)
1931
1931
 
1932
1932
 
1933
 
def _get_info_for_log_files(revisionspec_list, file_list):
 
1933
def _get_info_for_log_files(revisionspec_list, file_list, add_cleanup):
1934
1934
    """Find file-ids and kinds given a list of files and a revision range.
1935
1935
 
1936
1936
    We search for files at the end of the range. If not found there,
1940
1940
    :param file_list: the list of paths given on the command line;
1941
1941
      the first of these can be a branch location or a file path,
1942
1942
      the remainder must be file paths
 
1943
    :param add_cleanup: When the branch returned is read locked,
 
1944
      an unlock call will be queued to the cleanup.
1943
1945
    :return: (branch, info_list, start_rev_info, end_rev_info) where
1944
1946
      info_list is a list of (relative_path, file_id, kind) tuples where
1945
1947
      kind is one of values 'directory', 'file', 'symlink', 'tree-reference'.
1947
1949
    """
1948
1950
    from builtins import _get_revision_range, safe_relpath_files
1949
1951
    tree, b, path = bzrdir.BzrDir.open_containing_tree_or_branch(file_list[0])
1950
 
    b.lock_read()
 
1952
    add_cleanup(b.lock_read().unlock)
1951
1953
    # XXX: It's damn messy converting a list of paths to relative paths when
1952
1954
    # those paths might be deleted ones, they might be on a case-insensitive
1953
1955
    # filesystem and/or they might be in silly locations (like another branch).