def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}): p1 = self._getpath(path_parts1) p2 = self._getpath(path_parts2) r1 = self._getrev(rev1) r2 = self._getrev(rev2) if not vclib.check_path_access(self, path_parts1, vclib.FILE, rev1): raise vclib.ItemNotFound(path_parts1) if not vclib.check_path_access(self, path_parts2, vclib.FILE, rev2): raise vclib.ItemNotFound(path_parts2) args = vclib._diff_args(type, options) def _date_from_rev(rev): date, author, msg, revprops, changes = self._revinfo(rev) return date try: temp1 = cat_to_tempfile(self, p1, r1) temp2 = cat_to_tempfile(self, p2, r2) info1 = p1, _date_from_rev(r1), r1 info2 = p2, _date_from_rev(r2), r2 return vclib._diff_fp(temp1, temp2, info1, info2, self.diff_cmd, args) except core.SubversionException, e: _fix_subversion_exception(e) if e.apr_err == vclib.svn.core.SVN_ERR_FS_NOT_FOUND: raise vclib.InvalidRevision raise
def itemtype(self, path_parts, rev): rev = self._getrev(rev) basepath = self._getpath(path_parts) pathtype = self._gettype(basepath, rev) if pathtype is None: raise vclib.ItemNotFound(path_parts) if not vclib.check_path_access(self, path_parts, pathtype, rev): raise vclib.ItemNotFound(path_parts) return pathtype
def get_location(self, path, rev, old_rev): try: results = repos.svn_repos_trace_node_locations( self.fs_ptr, path, rev, [old_rev], _allow_all) except core.SubversionException as e: if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise try: old_path = results[old_rev] except KeyError: raise vclib.ItemNotFound(path) return _cleanup_path(_to_str(old_path))
def itemtype(self, path_parts, rev): basepath = self._getpath(path_parts) kind = None if os.path.isdir(basepath): kind = vclib.DIR elif os.path.isfile(basepath + ',v'): kind = vclib.FILE else: atticpath = self._getpath(self._atticpath(path_parts)) if os.path.isfile(atticpath + ',v'): kind = vclib.FILE if not kind: raise vclib.ItemNotFound(path_parts) if not vclib.check_path_access(self, path_parts, kind, rev): raise vclib.ItemNotFound(path_parts) return kind
def get_location(self, path, rev, old_rev): try: results = ra.get_locations(self.ra_session, path, rev, [old_rev]) except core.SubversionException, e: _fix_subversion_exception(e) if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise
def get_location(self, path, rev, old_rev): try: results = ra.get_locations(self.ra_session, path, rev, [old_rev]) except core.SubversionException as e: if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise try: old_path = results[old_rev] except KeyError: raise vclib.ItemNotFound(path) old_path = _cleanup_path(_to_str(old_path)) old_path_parts = _path_parts(old_path) # Check access (lying about path types) if not vclib.check_path_access(self, old_path_parts, vclib.FILE, old_rev): raise vclib.ItemNotFound(path) return old_path
def get_location(svnrepos, path, rev, old_rev): try: results = ra.get_locations(svnrepos.ra_session, path, rev, [old_rev], svnrepos.pool) except core.SubversionException, e: if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise
def itemtype(self, path_parts, rev): pathtype = None if not len(path_parts): pathtype = vclib.DIR else: path = self._getpath(path_parts) rev = self._getrev(rev) try: kind = ra.svn_ra_check_path(self.ra_session, path, rev) pathtype = _kind2type(kind) except Exception: pass if pathtype is None: raise vclib.ItemNotFound(path_parts) if not vclib.check_path_access(self, path_parts, pathtype, rev): raise vclib.ItemNotFound(path_parts) return pathtype
def get_location(self, path, rev, old_rev): try: results = repos.svn_repos_trace_node_locations( self.fs_ptr, path, rev, [old_rev], _allow_all) except core.SubversionException, e: _fix_subversion_exception(e) if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise
def itemtype(self, path_parts, rev): rev = self._getrev(rev) basepath = self._getpath(path_parts) kind = fs.check_path(self._getroot(rev), basepath, self.scratch_pool) self._scratch_clear() if kind == core.svn_node_dir: return vclib.DIR if kind == core.svn_node_file: return vclib.FILE raise vclib.ItemNotFound(path_parts)
def itemtype(self, path_parts, rev): basepath = self._getpath(path_parts) if os.path.isdir(basepath): return vclib.DIR if os.path.isfile(basepath + ',v'): return vclib.FILE atticpath = self._getpath(self._atticpath(path_parts)) if os.path.isfile(atticpath + ',v'): return vclib.FILE raise vclib.ItemNotFound(path_parts)
def itemtype(self, path_parts, rev): pathtype = None if not len(path_parts): pathtype = vclib.DIR else: path = self._getpath(path_parts) rev = self._getrev(rev) try: kind = ra.svn_ra_check_path(self.ra_session, path, rev) if kind == core.svn_node_file: pathtype = vclib.FILE elif kind == core.svn_node_dir: pathtype = vclib.DIR except: pass if pathtype is None: raise vclib.ItemNotFound(path_parts) if not vclib.check_path_access(self, path_parts, pathtype, rev): raise vclib.ItemNotFound(path_parts) return pathtype
def itemtype(self, path_parts, rev): path = self._getpath(path_parts[:-1]) rev = self._getrev(rev) if not len(path_parts): return vclib.DIR dirents = self._get_dirents(path, rev) try: entry = dirents[path_parts[-1]] if entry.kind == core.svn_node_dir: return vclib.DIR if entry.kind == core.svn_node_file: return vclib.FILE except KeyError: raise vclib.ItemNotFound(path_parts)
def created_rev(self, path, rev): # NOTE: We can't use svn_client_propget here because the # interfaces in that layer strip out the properties not meant for # human consumption (such as svn:entry:committed-rev, which we are # using here to get the created revision of PATH@REV). kind = ra.svn_ra_check_path(self.ra_session, path, rev) if kind == core.svn_node_none: raise vclib.ItemNotFound(_path_parts(path)) elif kind == core.svn_node_dir: props = get_directory_props(self.ra_session, path, rev) elif kind == core.svn_node_file: fetched_rev, props = ra.svn_ra_get_file(self.ra_session, path, rev, None) return int( props.get(core.SVN_PROP_ENTRY_COMMITTED_REV, SVN_INVALID_REVNUM))
def rcsfile(self, path_parts, root=0, v=1): "Return path to RCS file" ret_parts = path_parts ret_file = self._getpath(ret_parts) if not os.path.isfile(ret_file + ',v'): ret_parts = self._atticpath(path_parts) ret_file = self._getpath(ret_parts) if not os.path.isfile(ret_file + ',v'): raise vclib.ItemNotFound(path_parts) if root: ret = ret_file else: ret = _path_join(ret_parts) if v: ret = ret + ",v" return ret
def get_youngest_revision(self): return self.youngest def get_location(self, path, rev, old_rev): try: results = ra.get_locations(self.ra_session, path, rev, [old_rev]) except core.SubversionException, e: _fix_subversion_exception(e) if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: raise vclib.ItemNotFound(path) raise try: old_path = results[old_rev] except KeyError: raise vclib.ItemNotFound(path) old_path = _cleanup_path(old_path) old_path_parts = _path_parts(old_path) # Check access (lying about path types) if not vclib.check_path_access(self, old_path_parts, vclib.FILE, old_rev): raise vclib.ItemNotFound(path) return old_path def created_rev(self, path, rev): lh_rev, c_rev = self._get_last_history_rev(_path_parts(path), rev) return lh_rev def last_rev(self, path, peg_revision, limit_revision=None): """Given PATH, known to exist in PEG_REVISION, find the youngest revision older than, or equal to, LIMIT_REVISION in which path