Beispiel #1
0
 def get_copy_ancestry(self):
     """Retrieve the list of `(path,rev)` copy ancestors of this node.
     Most recent ancestor first. Each ancestor `(path, rev)` corresponds
     to the path and revision of the source at the time the copy or move
     operation was performed.
     """
     ancestors = []
     previous = (self._scoped_path_utf8, self.rev, self.root)
     while previous:
         (previous_path, previous_rev, previous_root) = previous
         previous = None
         root_path = fs.closest_copy(previous_root, previous_path)
         if root_path:
             (root, path) = root_path
             path = path.lstrip('/')
             rev = fs.revision_root_revision(root)
             relpath = None
             if path != previous_path:
                 # `previous_path` is a subfolder of `path` and didn't
                 # change since `path` was copied
                 relpath = previous_path[len(path):].strip('/')
             copied_from = fs.copied_from(root, path)
             if copied_from:
                 (rev, path) = copied_from
                 path = path.lstrip('/')
                 root = fs.revision_root(self.fs_ptr, rev, self.pool())
                 if relpath:
                     path += '/' + relpath
                 ui_path = _path_within_scope(self.scope, _from_svn(path))
                 if ui_path:
                     ancestors.append((ui_path, rev))
                 previous = (path, rev, root)
     return ancestors
Beispiel #2
0
 def get_copy_ancestry(self):
     """Retrieve the list of `(path,rev)` copy ancestors of this node.
     Most recent ancestor first. Each ancestor `(path, rev)` corresponds
     to the path and revision of the source at the time the copy or move
     operation was performed.
     """
     ancestors = []
     previous = (self._scoped_path_utf8, self.rev, self.root)
     while previous:
         (previous_path, previous_rev, previous_root) = previous
         previous = None
         root_path = fs.closest_copy(previous_root, previous_path)
         if root_path:
             (root, path) = root_path
             path = path.lstrip('/')
             rev = fs.revision_root_revision(root)
             relpath = None
             if path != previous_path:
                 # `previous_path` is a subfolder of `path` and didn't
                 # change since `path` was copied
                 relpath = previous_path[len(path):].strip('/')
             copied_from = fs.copied_from(root, path)
             if copied_from:
                 (rev, path) = copied_from
                 path = path.lstrip('/')
                 root = fs.revision_root(self.fs_ptr, rev, self.pool())
                 if relpath:
                     path += '/' + relpath
                 ui_path = _path_within_scope(self.scope, _from_svn(path))
                 if ui_path:
                     ancestors.append((ui_path, rev))
                 previous = (path, rev, root)
     return ancestors
Beispiel #3
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    """Construct a walker over the svn_fs_root_t ROOT, which must
    be in the svn_fs_t FS_PTR.  Invoke NOTIFY_CB with a single argument
    of type ChangedPath for each change under ROOT.

    At this time, two ChangedPath objects will be passed for a path that had
    been replaced in the revision/transaction.  This may change in the future.

    ### Can't we deduce FS_PTR from ROOT?

    ### POOL is unused
    """

    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_svnfs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _svnfs.is_revision_root(self.fs_root):
      rev = _svnfs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _svnfs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _svnfs.txn_root_name(self.fs_root)
      txn_t = _svnfs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _svnfs.txn_base_revision(txn_t)
      self.props = _svnfs.txn_proplist(txn_t)
Beispiel #4
0
    def get_branch_origin(self):
        """Return the revision in which the node's path was created.

        (wraps ``fs.revision_root_revision(fs.closest_copy)``)
        """
        root_and_path = fs.closest_copy(self.root, self._scoped_path_utf8)
        if root_and_path:
            return fs.revision_root_revision(root_and_path[0])
Beispiel #5
0
    def get_branch_origin(self):
        """Return the revision in which the node's path was created.

        (wraps ``fs.revision_root_revision(fs.closest_copy)``)
        """
        root_and_path = fs.closest_copy(self.root, self._scoped_path_utf8)
        if root_and_path:
            return fs.revision_root_revision(root_and_path[0])
Beispiel #6
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_svnfs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _svnfs.is_revision_root(self.fs_root):
      rev = _svnfs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _svnfs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _svnfs.txn_root_name(self.fs_root)
      txn_t = _svnfs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _svnfs.txn_base_revision(txn_t)
      self.props = _svnfs.txn_proplist(txn_t)
Beispiel #7
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_fs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _fs.is_revision_root(self.fs_root):
      rev = _fs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _fs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _fs.txn_root_name(self.fs_root)
      txn_t = _fs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _fs.txn_base_revision(txn_t)
      self.props = _fs.txn_proplist(txn_t)