def open(self): # Register a handler for SIGTERM so we can have a chance to # cleanup. If ViewVC takes too long to start generating CGI # output, Apache will grow impatient and SIGTERM it. While we # don't mind getting told to bail, we want to gracefully close the # repository before we bail. def _sigterm_handler(signum, frame, self=self): sys.exit(-1) try: signal.signal(signal.SIGTERM, _sigterm_handler) except ValueError: # This is probably "ValueError: signal only works in main # thread", which will get thrown by the likes of mod_python # when trying to install a signal handler from a thread that # isn't the main one. We'll just not care. pass # Open the repository and init some other variables. self.repos = repos.svn_repos_open(self.rootpath) self.fs_ptr = repos.svn_repos_fs(self.repos) self.youngest = fs.youngest_rev(self.fs_ptr) self._fsroots = {} self._revinfo_cache = {} # See if a universal read access determination can be made. if self.auth and self.auth.check_universal_access(self.name) == 1: self.auth = None ### TeamForge customization: See if we can bypass expensive changed-paths ### lookups. if self.auth and hasattr(self.auth, 'check_global_access'): if self.auth.check_global_access(self.name): self.auth = None
def repos(self): """ Repository instance. """ if self._repos is None: self._repos = svn_repos_fs(svn_repos_open(self._repos_path)) return self._repos
def __init__(self, path, authz): Repository.__init__(self, authz) if core.SVN_VER_MAJOR < 1: raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)) self.repos = None self.fs_ptr = None self.path = path # Remove any trailing slash or else subversion might abort if not os.path.split(path)[1]: path = os.path.split(path)[0] self.path = repos.svn_repos_find_root_path(path) if self.path is None: raise TracError( "%s does not appear to be a Subversion repository." % (path, )) if self.path != path: self.scope = path[len(self.path):] if not self.scope[-1:] == b'/': self.scope += b'/' else: self.scope = b'/' self.repos = repos.svn_repos_open(self.path) self.fs_ptr = repos.svn_repos_fs(self.repos) self.rev = fs.youngest_rev(self.fs_ptr) self.history = None if self.scope != b'/': self.history = [] for path, rev in _get_history(self.scope[1:], self.authz, self.fs_ptr, 0, self.rev): self.history.append(rev)
def inner(pool, path, rev): repos_ptr = repos.svn_repos_open(path, pool) fs_ptr = repos.svn_repos_fs(repos_ptr) root = fs.revision_root(fs_ptr, rev, pool) base_rev = rev - 1 # get all changes editor = repos.RevisionChangeCollector(fs_ptr, rev, pool) e_ptr, e_baton = delta.make_editor(editor, pool) repos.svn_repos_replay(root, e_ptr, e_baton, pool) changelist = editor.changes.items() changelist.sort() base_root = fs.revision_root(fs_ptr, base_rev, pool) l = [] for filepath, change in changelist: d = {'path': filepath, 'info': ''} if change.path: if change.added: d['action'] = 'new' else: d['action'] = 'modify' differ = fs.FileDiff(base_root, change.path, root, filepath, pool, '-L \t(original) -L \t(new) -u'.split(' ')) d['info'] = differ.get_pipe().read() else: d['action'] = 'delete' l.append(d) return l
def main(pool, repos_dir, txn): # Construct a ChangeCollector to fetch our changes. fs_ptr = repos.svn_repos_fs(repos.svn_repos_open(repos_dir, pool)) root = fs.txn_root(fs.open_txn(fs_ptr, txn, pool), pool) cc = repos.ChangeCollector(fs_ptr, root, pool) # Call the transaction property validator. Might as well get the # cheap checks outta the way first. retval = test_props(cc.get_root_props()) if retval: return retval # Generate the path-based changes list. e_ptr, e_baton = delta.make_editor(cc, pool) repos.svn_repos_replay(root, e_ptr, e_baton, pool) # Call the path change validator. changes = cc.get_changes() paths = changes.keys() paths.sort(lambda a, b: core.svn_path_compare_paths(a, b)) for path in paths: change = changes[path] retval = test_path_change(path, change) if retval: return retval return 0
def __init__(self, path, authz, log, options={}): self.log = log self.options = options self.pool = Pool() if isinstance(path, unicode): path = path.encode('utf-8') path = os.path.normpath(path).replace('\\', '/') self.path = repos.svn_repos_find_root_path(path, self.pool()) if self.path is None: raise Exception('%(path)s does not appear to be a Subversion' 'Repository.' % {'path': path}) self.repos = repos.svn_repos_open(self.path, self.pool()) self.fs_ptr = repos.svn_repos_fs(self.repos) uuid = fs.get_uuid(self.fs_ptr, self.pool()) name = 'svn:%s:%s' % (uuid, _from_svn(path)) if self.path != path: self.scope = path[len(self.path):] if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' assert self.scope[0] == '/' self.clear() self.youngest_rev = property(lambda x: x.get_youngest_rev())
def __init__(self, path, authz): Repository.__init__(self, authz) if core.SVN_VER_MAJOR < 1: raise TracError, \ "Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) self.repos = None self.fs_ptr = None self.path = path # Remove any trailing slash or else subversion might abort if not os.path.split(path)[1]: path = os.path.split(path)[0] self.path = repos.svn_repos_find_root_path(path) if self.path is None: raise TracError, "%s does not appear to be a Subversion repository." % (path, ) if self.path != path: self.scope = path[len(self.path):] if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' self.repos = repos.svn_repos_open(self.path) self.fs_ptr = repos.svn_repos_fs(self.repos) self.rev = fs.youngest_rev(self.fs_ptr) self.history = None if self.scope != '/': self.history = [] for path,rev in _get_history(self.scope[1:], self.authz, self.fs_ptr, 0, self.rev): self.history.append(rev)
def open(self): # Register a handler for SIGTERM so we can have a chance to # cleanup. If ViewVC takes too long to start generating CGI # output, Apache will grow impatient and SIGTERM it. While we # don't mind getting told to bail, we want to gracefully close the # repository before we bail. def _sigterm_handler(signum, frame, self=self): sys.exit(-1) try: signal.signal(signal.SIGTERM, _sigterm_handler) except ValueError: # This is probably "ValueError: signal only works in main # thread", which will get thrown by the likes of mod_python # when trying to install a signal handler from a thread that # isn't the main one. We'll just not care. pass # Open the repository and init some other variables. self.repos = repos.svn_repos_open(self.rootpath) self.fs_ptr = repos.svn_repos_fs(self.repos) self.youngest = fs.youngest_rev(self.fs_ptr) self._fsroots = {} self._revinfo_cache = {} # See if a universal read access determination can be made. if self.auth and self.auth.check_universal_access(self.name) == 1: self.auth = None
def __init__(self, path, authz, log): self.path = path # might be needed by __del__()/close() self.log = log if core.SVN_VER_MAJOR < 1: raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)) self.pool = Pool() # Remove any trailing slash or else subversion might abort if isinstance(path, unicode): path = path.encode('utf-8') path = os.path.normpath(path).replace('\\', '/') self.path = repos.svn_repos_find_root_path(path, self.pool()) if self.path is None: raise TracError("%s does not appear to be a Subversion repository." \ % path) self.repos = repos.svn_repos_open(self.path, self.pool()) self.fs_ptr = repos.svn_repos_fs(self.repos) uuid = fs.get_uuid(self.fs_ptr, self.pool()) name = 'svn:%s:%s' % (uuid, _from_svn(path)) Repository.__init__(self, name, authz, log) if self.path != path: self.scope = path[len(self.path):] if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' assert self.scope[0] == '/' self.clear()
def __init__(self, repos_path, txn_name): # these are for SVNLOOK/changed self.rpath = repos_path self.tname = txn_name self.repos_path = core.svn_path_canonicalize(repos_path) self.fs = repos.svn_repos_fs(repos.svn_repos_open(repos_path)) self.txn = fs.svn_fs_open_txn(self.fs, txn_name) self.txn_root = fs.svn_fs_txn_root(self.txn)
class SubversionRepository(Repository): """Repository implementation based on the svn.fs API.""" has_linear_changesets = True def __init__(self, path, params, log): self.log = log self.pool = Pool() # Remove any trailing slash or else subversion might abort if isinstance(path, unicode): path_utf8 = path.encode('utf-8') else: # note that this should usually not happen (unicode arg expected) path_utf8 = to_unicode(path).encode('utf-8') path_utf8 = core.svn_path_canonicalize( os.path.normpath(path_utf8).replace('\\', '/')) self.path = path_utf8.decode('utf-8') root_path_utf8 = repos.svn_repos_find_root_path(path_utf8, self.pool()) if root_path_utf8 is None: raise TracError( _("%(path)s does not appear to be a Subversion " "repository.", path=to_unicode(path_utf8))) try: self.repos = repos.svn_repos_open(root_path_utf8, self.pool()) except core.SubversionException, e: raise TracError( _( "Couldn't open Subversion repository %(path)s: " "%(svn_error)s", path=to_unicode(path_utf8), svn_error=exception_to_unicode(e))) self.fs_ptr = repos.svn_repos_fs(self.repos) self.uuid = fs.get_uuid(self.fs_ptr, self.pool()) self.base = 'svn:%s:%s' % (self.uuid, _from_svn(root_path_utf8)) name = 'svn:%s:%s' % (self.uuid, self.path) Repository.__init__(self, name, params, log) # if root_path_utf8 is shorter than the path_utf8, the difference is # this scope (which always starts with a '/') if root_path_utf8 != path_utf8: self.scope = path_utf8[len(root_path_utf8):].decode('utf-8') if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' assert self.scope[0] == '/' # we keep root_path_utf8 for RA ra_prefix = 'file:///' if os.name == 'nt' else 'file://' self.ra_url_utf8 = _svn_uri_canonicalize(ra_prefix + root_path_utf8) self.clear()
def __init__(self, repositoryPath, pool): self.context = client.svn_client_ctx_t() configDirectory = core.svn_config_ensure( '', pool) self.context.config = core.svn_config_get_config(configDirectory, pool) self.pool = pool self.repos_ptr = repos.svn_repos_open(repositoryPath, pool) self.fsob = repos.svn_repos_fs(self.repos_ptr) # Directories we've added to the repository. self.addedDirectories = {} self.addedDirectories["/"] = 1
def __init__(self, repos_path, pool, logger=None): if logger: self.logger = logger else: self.logger = sys.stdout self.pool = pool assert self.pool self.repo = repos.svn_repos_open(repos_path, self.pool) self.fsptr = repos.svn_repos_fs(self.repo)
def __init__(self, repositoryPath, pool): self.context = client.svn_client_create_context() configDirectory = core.svn_config_ensure( '', pool) self.context.config = core.svn_config_get_config(configDirectory, pool) self.pool = pool self.repos_ptr = repos.svn_repos_open(repositoryPath, pool) self.fsob = repos.svn_repos_fs(self.repos_ptr) # Directories we've added to the repository. self.addedDirectories = {} self.addedDirectories["/"] = 1
def open(self): # Open the repository and init some other variables. self.repos = repos.svn_repos_open(self.rootpath) self.fs_ptr = repos.svn_repos_fs(self.repos) self.youngest = fs.youngest_rev(self.fs_ptr) self._fsroots = {} self._revinfo_cache = {} # See if a universal read access determination can be made. if self.auth and self.auth.check_universal_access(self.name) == 1: self.auth = None
def main(pool, repos_dir, path): # Construct a ChangeCollector to fetch our changes. fs_ptr = repos.svn_repos_fs(repos.svn_repos_open(repos_dir, pool)) youngest_rev = fs.svn_fs_youngest_rev(fs_ptr, pool) root = fs.svn_fs_revision_root(fs_ptr, youngest_rev, pool) if not fs.svn_fs_node_prop(root, path, core.SVN_PROP_NEEDS_LOCK, pool): sys.stderr.write( """Locking of path '%s' prohibited by repository policy (must have %s property set) """ % (path, core.SVN_PROP_NEEDS_LOCK)) return 1 return 0
def check_tabs(pool, repos_path, txn): def authz_cb(root, path, pool): return 1 fs_ptr = repos.svn_repos_fs(repos.svn_repos_open(repos_path, pool)) txn_ptr = fs.open_txn(fs_ptr, txn, pool) txn_root = fs.txn_root(txn_ptr, pool) base_root = fs.revision_root(fs_ptr, fs.txn_base_revision(txn_ptr), pool) editor = ChangeReceiver(txn_root, base_root, pool) e_ptr, e_baton = delta.make_editor(editor, pool) repos.svn_repos_dir_delta(base_root, '', '', txn_root, '', e_ptr, e_baton, authz_cb, 0, 1, 0, 0, pool)
def open_svn_repos(repos_dir): from svn import util, repos, core core.apr_initialize() pool = core.svn_pool_create(None) # Remove any trailing slash or else subversion might abort if not os.path.split(repos_dir)[1]: repos_dir = os.path.split(repos_dir)[0] rep = repos.svn_repos_open(repos_dir, pool) fs_ptr = repos.svn_repos_fs(rep) return pool, rep, fs_ptr
def __init__(self, path, params, log): self.log = log self.pool = Pool() # Remove any trailing slash or else subversion might abort if isinstance(path, unicode): path_utf8 = path.encode('utf-8') else: # note that this should usually not happen (unicode arg expected) path_utf8 = to_unicode(path).encode('utf-8') path_utf8 = core.svn_path_canonicalize( os.path.normpath(path_utf8).replace('\\', '/')) self.path = path_utf8.decode('utf-8') root_path_utf8 = repos.svn_repos_find_root_path(path_utf8, self.pool()) if root_path_utf8 is None: raise InvalidRepository( _("%(path)s does not appear to be a Subversion repository.", path=to_unicode(path_utf8))) try: self.repos = repos.svn_repos_open(root_path_utf8, self.pool()) except core.SubversionException as e: raise InvalidRepository( _("Couldn't open Subversion repository %(path)s: " "%(svn_error)s", path=to_unicode(path_utf8), svn_error=exception_to_unicode(e))) self.fs_ptr = repos.svn_repos_fs(self.repos) self.uuid = fs.get_uuid(self.fs_ptr, self.pool()) self.base = 'svn:%s:%s' % (self.uuid, _from_svn(root_path_utf8)) name = 'svn:%s:%s' % (self.uuid, self.path) Repository.__init__(self, name, params, log) # if root_path_utf8 is shorter than the path_utf8, the difference is # this scope (which always starts with a '/') if root_path_utf8 != path_utf8: self.scope = path_utf8[len(root_path_utf8):].decode('utf-8') if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' assert self.scope[0] == '/' # we keep root_path_utf8 for RA ra_prefix = 'file:///' if os.name == 'nt' else 'file://' self.ra_url_utf8 = _svn_uri_canonicalize(ra_prefix + quote(root_path_utf8)) self.clear()
def __init__(self, repository, rev, username, message, pool, logger=None): if logger: self.logger = logger else: self.logger = sys.stdout self.pool = pool self.rev = rev self.fsptr = repos.svn_repos_fs(repository) self.rev_root = fs.revision_root(self.fsptr, self.rev, self.pool) self.txnp = repos.svn_repos_fs_begin_txn_for_commit( repository, self.rev, username, message, self.pool) self.txn_root = fs.txn_root(self.txnp, self.pool) self.log('Base revision %d\n' % rev)
def get_entries(self, path): # lots of conversions from and to utf-8 disk_url = directory(self.name).encode('utf-8') root_path_utf8 = repos.svn_repos_find_root_path(disk_url) if root_path_utf8 is None or not os.path.exists(root_path_utf8): if os.path.exists(disk_url): raise EncodingError(disk_url) raise DoesNotExistError(disk_url) try: repository = repos.svn_repos_open(root_path_utf8) except SubversionException as e: # check for messages like the following: # "Expected FS Format 'x'; found format 'y'" # there are different errorcodes for each version, so do a string # match instead of errorcode match errstr = str(e) if "Expected" in errstr and "format" in errstr and "found" in errstr: raise VersionError raise PermissionError fs_ptr = repos.svn_repos_fs(repository) path_utf8 = path youngest_revision_number = fs.youngest_rev(fs_ptr) try: root = fs.revision_root(fs_ptr, youngest_revision_number) except SubversionException as e: raise PermissionError entries = fs.dir_entries(root, path_utf8) # returns list of bytes-strings dirs = [] for entry in entries.keys(): entry_utf8 = entry.decode('utf-8') d = {} node_type = fs.check_path(root, os.path.join(path_utf8, entry_utf8)) if (node_type == core.svn_node_dir): d['kind'] = 'dir' elif (node_type == core.svn_node_file): d['kind'] = 'file' else: d['kind'] = 'unknown' d['name'] = entry_utf8 dirs.append(d) return dirs
def get_entries(self, path): # lots of conversions from and to utf-8 disk_url = directory(self.name) root_path_utf8 = repos.svn_repos_find_root_path(disk_url) if root_path_utf8 is None or not os.path.exists(root_path_utf8): raise DoesNotExistError(disk_url) try: repository = repos.svn_repos_open(root_path_utf8) except SubversionException as e: # check for messages like the following: # "Expected FS Format 'x'; found format 'y'" # there are different errorcodes for each version, so do a string # match instead of errorcode match errstr = str(e) if "Expected" in errstr and "format" in errstr and "found" in errstr: raise VersionError raise PermissionError fs_ptr = repos.svn_repos_fs(repository) path_utf8 = uc_to_svn(uc_str(path)) youngest_revision_number = fs.youngest_rev(fs_ptr) try: root = fs.revision_root(fs_ptr, youngest_revision_number) except SubversionException as e: raise PermissionError entries = fs.dir_entries(root, path_utf8) dirs = [] for entry in entries.keys(): d = {} node_type = fs.check_path(root, os.path.join(path_utf8, entry)) if (node_type == core.svn_node_dir): d['kind'] = 'dir' elif (node_type == core.svn_node_file): d['kind'] = 'file' else: d['kind'] = 'unknown' d['name'] = uc_from_svn(entry) dirs.append(d) return dirs
def crawl_revisions(pool, repos_path): """Open the repository at REPOS_PATH, and recursively crawl all its revisions.""" global final_rev # Open the repository at REPOS_PATH, and get a reference to its # versioning filesystem. repos_obj = svn_repos_open(repos_path, pool) fs_obj = svn_repos_fs(repos_obj) # Query the current youngest revision. youngest_rev = svn_fs_youngest_rev(fs_obj, pool) first_rev = 1 if final_rev == 0: final_rev = youngest_rev for rev in xrange(first_rev, final_rev + 1): export_revision(rev, repos_obj, fs_obj, pool)
def __init__(self, path, authz, log): if core.SVN_VER_MAJOR < 1: raise TracError, \ "Subversion >= 1.0 required: Found %d.%d.%d" % \ (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO) self.pool = Pool() # Remove any trailing slash or else subversion might abort if not os.path.split(path)[1]: path = os.path.split(path)[0] self.path = repos.svn_repos_find_root_path(path, self.pool()) if self.path is None: raise TracError, \ "%s does not appear to be a Subversion repository." % path self.repos = repos.svn_repos_open(self.path, self.pool()) self.fs_ptr = repos.svn_repos_fs(self.repos) uuid = fs.get_uuid(self.fs_ptr, self.pool()) name = 'svn:%s:%s' % (uuid, path) Repository.__init__(self, name, authz, log) if self.path != path: self.scope = path[len(self.path):] if not self.scope[-1] == '/': self.scope += '/' else: self.scope = '/' self.log.debug("Opening subversion file-system at %s with scope %s" \ % (self.path, self.scope)) self.rev = fs.youngest_rev(self.fs_ptr, self.pool()) self.history = None if self.scope != '/': self.history = [] for path, rev in _get_history(self.scope[1:], self.authz, self.fs_ptr, self.pool, 0, self.rev): self.history.append(rev)
def __init__(self, path, file_path, rev=None): self.file_path = file_path self.path = path repos_path = core.svn_path_canonicalize( os.path.normpath(self.path).replace('\\', '/') ) svn_repos = repos.svn_repos_open(repos_path) fs_ptr = repos.svn_repos_fs(svn_repos) if rev: self.rev = rev else: self.rev = fs.youngest_rev(fs_ptr) self.root = fs.revision_root(fs_ptr, self.rev) self.kind = KIND_MAP[fs.check_path(self.root, self.file_path)] self.name = os.path.split(self.file_path)[-1] self.cr = fs.node_created_rev(self.root, self.file_path) props = fs.revision_proplist(fs_ptr, self.cr) self.date = props[core.SVN_PROP_REVISION_DATE] self.author = props[core.SVN_PROP_REVISION_AUTHOR] self.log = props[core.SVN_PROP_REVISION_LOG]
def __init__(self, name, rootpath, svn_path): if not os.path.isdir(rootpath): raise vclib.ReposNotFound(name) # Initialize some stuff. self.pool = None self.apr_init = 0 self.rootpath = rootpath self.name = name self.svn_client_path = os.path.normpath(os.path.join(svn_path, 'svn')) # Register a handler for SIGTERM so we can have a chance to # cleanup. If ViewVC takes too long to start generating CGI # output, Apache will grow impatient and SIGTERM it. While we # don't mind getting told to bail, we want to gracefully close the # repository before we bail. def _sigterm_handler(signum, frame, self=self): self._close() sys.exit(-1) try: signal.signal(signal.SIGTERM, _sigterm_handler) except ValueError: # This is probably "ValueError: signal only works in main # thread", which will get thrown by the likes of mod_python # when trying to install a signal handler from a thread that # isn't the main one. We'll just not care. pass # Initialize APR and get our top-level pool. core.apr_initialize() self.apr_init = 1 self.pool = core.svn_pool_create(None) self.scratch_pool = core.svn_pool_create(self.pool) # Open the repository and init some other variables. self.repos = repos.svn_repos_open(rootpath, self.pool) self.fs_ptr = repos.svn_repos_fs(self.repos) self.youngest = fs.youngest_rev(self.fs_ptr, self.pool) self._fsroots = {}
def main(pool, repos_dir, rev, config_fp): # Construct a ChangeCollector to fetch our changes. fs_ptr = repos.svn_repos_fs(repos.svn_repos_open(repos_dir, pool)) root = fs.revision_root(fs_ptr, rev, pool) # Get revision properties we need. (Subversion 1.2) # cc = repos.ChangeCollector(fs_ptr, root, pool) # props = cc.get_root_props() # author = str(props.get(core.SVN_PROP_REVISION_AUTHOR, '')) # log = str(props.get(core.SVN_PROP_REVISION_LOG, '')) # Get revision properties we need. (Subversion 1.1) cc = repos.RevisionChangeCollector(fs_ptr, rev, pool) author = fs.revision_prop(fs_ptr, rev, core.SVN_PROP_REVISION_AUTHOR, pool) log = fs.revision_prop(fs_ptr, rev, core.SVN_PROP_REVISION_LOG, pool) ### Do any Subversion-to-Scarab author mappings here ### # Example: # _authors = { # 'miw':'mick', # 'lif':'lisefr', # 'gni':'gunleik', # 'man':'Maja', # 'ako':'konand', # 'hho':'helga', # 'hba':'hilde', # 'rgc':'rgc' # } # author = _authors.get(author, author) # Now build the comment. First we start with some header # information about the revision, and a link to the ViewCVS revision # view. e_ptr, e_baton = delta.make_editor(cc, pool) repos.svn_repos_replay(root, e_ptr, e_baton, pool) comment = "%s %d: %s/?view=rev&rev=%d\n" \ % (MSG_SUBVERSION_COMMIT, rev, VIEWCVS_URL, rev) comment = comment + \ """------------------------------------------------------------------------- %s ------------------------------------------------------------------------- """ % log # Next, we'll figure out which paths changed and use that # information to generate ViewCVS links. # changes = cc.get_changes() # Subversion 1.2 changes = cc.changes # Subversion 1.1 paths = changes.keys() # paths.sort(lambda a, b: core.svn_path_compare_paths(a, b)) # Subversion 1.2 for path in paths: change = changes[path] diff_url = '' action = None if not change.path: ### Deleted (show the last living version) action = MSG_ACTION_DELETED diff_url = '%s/%s?view=auto&rev=%d' \ % (VIEWCVS_URL, urllib.quote(change.base_path[1:]), change.base_rev) elif change.added: ### Added if change.base_path and (change.base_rev != -1): ### (with history) action = MSG_ACTION_COPIED diff_url = '%s/%s?view=diff&rev=%d&p1=%s&r1=%d&p2=%s&r2=%d' \ % (VIEWCVS_URL, urllib.quote(change.path), rev, urllib.quote(change.base_path[1:]), change.base_rev, urllib.quote(change.path), rev) else: ### (without history, show new file) action = MSG_ACTION_ADDED diff_url = '%s/%s?view=auto&rev=%d' \ % (VIEWCVS_URL, urllib.quote(change.path), rev) elif change.text_changed: ### Modified action = MSG_ACTION_MODIFIED diff_url = '%s/%s?view=diff&rev=%d&p1=%s&r1=%d&p2=%s&r2=%d' \ % (VIEWCVS_URL, urllib.quote(change.path), rev, urllib.quote(change.base_path[1:]), change.base_rev, urllib.quote(change.path), rev) if action: comment = comment + "%s: %s\n %s\n" % (action, path, diff_url) # Connect to the xmlrpc server, and transmit our data. Server(SCARAB_XMLRPC_URL).simple.addComment(log, author, comment, DISABLE_EMAILS)
def get_fs_obj(repos_path): """Return a repository filesystem object for the repository located at REPOS_PATH (which must obey the Subversion path canonicalization rules).""" return repos.svn_repos_fs(repos.svn_repos_open(repos_path))