Esempio n. 1
0
def get_new_paths(txn_root):
    new_paths = []
    for path, change in fs.paths_changed(txn_root).iteritems():
        if (change.change_kind == fs.path_change_add
                or change.change_kind == fs.path_change_replace):
            new_paths.append(path)
    return new_paths
Esempio n. 2
0
    def add_history(self, path, revision, pool):
        # If filtering, only add the path and revision to the histories
        # list if they were actually changed in this revision (where
        # change means the path itself was changed, or one of its parents
        # was copied).  This is useful for omitting bubble-up directory
        # changes.
        if not self.oldest_rev:
            self.oldest_rev = revision
        else:
            assert (revision < self.oldest_rev)

        if not self.show_all_logs:
            rev_root = fs.revision_root(self.fs_ptr, revision)
            changed_paths = fs.paths_changed(rev_root)
            paths = changed_paths.keys()
            if path not in paths:
                # Look for a copied parent
                test_path = path
                found = 0
                while 1:
                    off = test_path.rfind('/')
                    if off < 0:
                        break
                    test_path = test_path[0:off]
                    if test_path in paths:
                        copyfrom_rev, copyfrom_path = fs.copied_from(
                            rev_root, test_path)
                        if copyfrom_rev >= 0 and copyfrom_path:
                            found = 1
                            break
                if not found:
                    return
        self.histories.append([revision, _cleanup_path(path)])
        if self.limit and len(self.histories) == self.limit:
            raise core.SubversionException("", _SVN_ERR_CEASE_INVOCATION)
Esempio n. 3
0
def get_new_paths(txn_root):
  new_paths = []
  for path, change in fs.paths_changed(txn_root).iteritems():
    if (change.change_kind == fs.path_change_add
        or change.change_kind == fs.path_change_replace):
      new_paths.append(path)
  return new_paths
Esempio n. 4
0
 def add_history(self, path, revision, pool):
   # If filtering, only add the path and revision to the histories
   # list if they were actually changed in this revision (where
   # change means the path itself was changed, or one of its parents
   # was copied).  This is useful for omitting bubble-up directory
   # changes.
   if not self.oldest_rev:
     self.oldest_rev = revision
   else:
     assert(revision < self.oldest_rev)
     
   if not self.show_all_logs:
     rev_root = fs.revision_root(self.fs_ptr, revision)
     changed_paths = fs.paths_changed(rev_root)
     paths = changed_paths.keys()
     if path not in paths:
       # Look for a copied parent
       test_path = path
       found = 0
       while 1:
         off = test_path.rfind('/')
         if off < 0:
           break
         test_path = test_path[0:off]
         if test_path in paths:
           copyfrom_rev, copyfrom_path = fs.copied_from(rev_root, test_path)
           if copyfrom_rev >= 0 and copyfrom_path:
             found = 1
             break
       if not found:
         return
   self.histories.append([revision, _cleanup_path(path)])
   if self.limit and len(self.histories) == self.limit:
     raise core.SubversionException("", _SVN_ERR_CEASE_INVOCATION)
Esempio n. 5
0
 def add_history(self, path, revision, pool):
     # If filtering, only add the path and revision to the histories
     # list if they were actually changed in this revision (where
     # change means the path itself was changed, or one of its parents
     # was copied).  This is useful for omitting bubble-up directory
     # changes.
     if not self.show_all_logs:
         rev_root = fs.revision_root(self.fs_ptr, revision, pool)
         changed_paths = fs.paths_changed(rev_root, pool)
         paths = changed_paths.keys()
         if path not in paths:
             # Look for a copied parent
             test_path = path
             found = 0
             subpool = core.svn_pool_create(pool)
             while 1:
                 core.svn_pool_clear(subpool)
                 off = string.rfind(test_path, '/')
                 if off < 0:
                     break
                 test_path = test_path[0:off]
                 if test_path in paths:
                     copyfrom_rev, copyfrom_path = \
                                   fs.copied_from(rev_root, test_path, subpool)
                     if copyfrom_rev >= 0 and copyfrom_path:
                         found = 1
                         break
             core.svn_pool_destroy(subpool)
             if not found:
                 return
     self.histories[revision] = _cleanup_path(path)
Esempio n. 6
0
 def add_history(self, path, revision, pool):
   # If filtering, only add the path and revision to the histories
   # list if they were actually changed in this revision (where
   # change means the path itself was changed, or one of its parents
   # was copied).  This is useful for omitting bubble-up directory
   # changes.
   if not self.show_all_logs:
     rev_root = fs.revision_root(self.fs_ptr, revision, pool)
     changed_paths = fs.paths_changed(rev_root, pool)
     paths = changed_paths.keys()
     if path not in paths:
       # Look for a copied parent
       test_path = path
       found = 0
       subpool = core.svn_pool_create(pool)
       while 1:
         core.svn_pool_clear(subpool)
         off = string.rfind(test_path, '/')
         if off < 0:
           break
         test_path = test_path[0:off]
         if test_path in paths:
           copyfrom_rev, copyfrom_path = \
                         fs.copied_from(rev_root, test_path, subpool)
           if copyfrom_rev >= 0 and copyfrom_path:
             found = 1
             break
       core.svn_pool_destroy(subpool)
       if not found:
         return
   self.histories[revision] = _cleanup_path(path)
Esempio n. 7
0
 def _simple_auth_check(fsroot):
     """Return a 2-tuple: found_readable, found_unreadable."""
     found_unreadable = found_readable = 0
     if hasattr(fs, "paths_changed2"):
         changes = fs.paths_changed2(fsroot)
     else:
         changes = fs.paths_changed(fsroot)
     paths = list(changes.keys())
     for path in paths:
         change = changes[path]
         pathtype = None
         if hasattr(change, "node_kind"):
             if change.node_kind == core.svn_node_file:
                 pathtype = vclib.FILE
             elif change.node_kind == core.svn_node_dir:
                 pathtype = vclib.DIR
         parts = _path_parts(path)
         if pathtype is None:
             # Figure out the pathtype so we can query the authz subsystem.
             if change.change_kind == fs.path_change_delete:
                 # Deletions are annoying, because they might be underneath
                 # copies (make their previous location non-trivial).
                 prev_parts = parts
                 prev_rev = rev - 1
                 parent_parts = parts[:-1]
                 while parent_parts:
                     parent_path = "/" + self._getpath(parent_parts)
                     pchange = changes.get(parent_path)
                     if not (
                         pchange
                         and (
                             pchange.change_kind == fs.path_change_replace
                             or pchange.change_kind == fs.path_change_add
                         )
                     ):
                         del parent_parts[-1]
                         continue
                     copyfrom_path, copyfrom_rev = _get_change_copyinfo(
                         fsroot, parent_path, pchange
                     )
                     if copyfrom_path:
                         prev_rev = copyfrom_rev
                         prev_parts = _path_parts(copyfrom_path) + parts[len(parent_parts) :]
                         break
                     del parent_parts[-1]
                 pathtype = self._gettype(self._getpath(prev_parts), prev_rev)
             else:
                 pathtype = self._gettype(self._getpath(parts), rev)
         if vclib.check_path_access(self, parts, pathtype, rev):
             found_readable = 1
             copyfrom_path, copyfrom_rev = _get_change_copyinfo(fsroot, path, change)
             if copyfrom_path and copyfrom_path != path:
                 parts = _path_parts(copyfrom_path)
                 if not vclib.check_path_access(self, parts, pathtype, copyfrom_rev):
                     found_unreadable = 1
         else:
             found_unreadable = 1
         if found_readable and found_unreadable:
             break
     return found_readable, found_unreadable
Esempio n. 8
0
 def paths_changed(self):
     """
     paths_changed information of this revision.
     return the iterator of SvnFile,sets, where set is svn changesets structure.
     etc: sets.change_kind == fs.path_change_add
     """
     for path,sets in fs.paths_changed(self._root).iteritems():
         yield self.get_file(path),sets
Esempio n. 9
0
 def _simple_auth_check(fsroot):
   """Return a 2-tuple: found_readable, found_unreadable."""
   found_unreadable = found_readable = 0
   if hasattr(fs, 'paths_changed2'):
     changes = fs.paths_changed2(fsroot)
   else:
     changes = fs.paths_changed(fsroot)
   paths = changes.keys()
   for path in paths:
     change = changes[path]
     pathtype = None
     if hasattr(change, 'node_kind'):
       if change.node_kind == core.svn_node_file:
         pathtype = vclib.FILE
       elif change.node_kind == core.svn_node_dir:
         pathtype = vclib.DIR
     parts = _path_parts(path)
     if pathtype is None:
       # Figure out the pathtype so we can query the authz subsystem.
       if change.change_kind == fs.path_change_delete:
         # Deletions are annoying, because they might be underneath
         # copies (make their previous location non-trivial).
         prev_parts = parts
         prev_rev = rev - 1
         parent_parts = parts[:-1]
         while parent_parts:
           parent_path = '/' + self._getpath(parent_parts)
           parent_change = changes.get(parent_path)
           if not (parent_change and \
                   (parent_change.change_kind == fs.path_change_add or
                    parent_change.change_kind == fs.path_change_replace)):
             del(parent_parts[-1])
             continue
           copyfrom_path, copyfrom_rev = \
             _get_change_copyinfo(fsroot, parent_path, parent_change)
           if copyfrom_path:
             prev_rev = copyfrom_rev
             prev_parts = _path_parts(copyfrom_path) + \
                          parts[len(parent_parts):]
             break
           del(parent_parts[-1])
         pathtype = self._gettype(self._getpath(prev_parts), prev_rev)
       else:
         pathtype = self._gettype(self._getpath(parts), rev)
     if vclib.check_path_access(self, parts, pathtype, rev):
       found_readable = 1
       copyfrom_path, copyfrom_rev = \
         _get_change_copyinfo(fsroot, path, change)
       if copyfrom_path and copyfrom_path != path:
         parts = _path_parts(copyfrom_path)
         if not vclib.check_path_access(self, parts, pathtype,
                                        copyfrom_rev):
           found_unreadable = 1
     else:
       found_unreadable = 1
     if found_readable and found_unreadable:
       break
   return found_readable, found_unreadable
Esempio n. 10
0
 def _check_history(self, path, revision):
     root = fs.revision_root(self.fs_ptr, revision)
     changes = fs.paths_changed(root)
     while True:
         if path in changes:
             return 1
         if path == '/':
             return 0
         idx = path.rfind('/')
         if idx != -1:
             path = path[:idx]
         else:
             return 0
Esempio n. 11
0
 def _check_history(self, path, revision):
   root = fs.revision_root(self.fs_ptr, revision)
   changes = fs.paths_changed(root)
   while True:
     if path in changes:
       return 1
     if path == '/':
       return 0
     idx = path.rfind('/')
     if idx != -1:
       path = path[:idx]
     else:
       return 0
Esempio n. 12
0
 def _check_history(self, path, revision):
     root = fs.revision_root(self.fs_ptr, revision)
     changes = fs.paths_changed(root)
     while 1:
         if changes.has_key(path):
             return 1
         if path == '/':
             return 0
         idx = string.rfind(path, '/')
         if idx != -1:
             path = path[:idx]
         else:
             return 0
Esempio n. 13
0
 def _check_history(self, path, revision):
   root = fs.revision_root(self.fs_ptr, revision)
   changes = fs.paths_changed(root)
   while 1:
     if changes.has_key(path):
       return 1
     if path == '/':
       return 0
     idx = string.rfind(path, '/')
     if idx != -1:
       path = path[:idx]
     else:
       return 0
Esempio n. 14
0
 def modified_files(self):
     '''A better (but new and unfamiliar) way to get the changed files'''
     return fs.paths_changed(self.txn_root).keys()