def revprop_list(self, revnum=None): """Returns a hash of the revision properties of REVNUM. If REVNUM is not provided, it defaults to the head revision.""" rev = svn_opt_revision_t() if revnum is not None: rev.kind = svn_opt_revision_number rev.value.number = revnum else: rev.kind = svn_opt_revision_head props = _types.Hash(POINTER(svn_string_t), None, wrapper=_types.SvnStringPtr) set_rev = svn_revnum_t() svn_client_revprop_list(props.byref(), self.url, byref(rev), byref(set_rev), self.client, props.pool) self.iterpool.clear() return props
def propget(self, propname, target="", recurse=True): """Get the value of propname for target. Returns a hash the keys of which are file paths and the values are the value of PROPNAME for the corresponding file. The values of the hash are c_char_p objects, which can be treated much like strings. Keyword arguments: propname -- name of property to get target -- item to get properties for (defaults to Wc root) recurse -- if True, operation will recurse into directories (default True)""" peg_revision = svn_opt_revision_t() peg_revision.kind = svn_opt_revision_unspecified revision = svn_opt_revision_t() revision.kind = svn_opt_revision_working props = _types.Hash(c_char_p) svn_client_propget2(byref(props.hash), propname, self._build_path(target), byref(peg_revision), byref(revision), recurse, self.client, props.pool) self.iterpool.clear() return props
def test_hash(self): self.pydict = {"bruce":"batman", "clark":"superman", "vic":"the question"} self.svnhash = _types.Hash(c_char_p, self.pydict) self.assertEqual(self.svnhash["clark"].value, self.pydict["clark"]) self.assertEqual(self.svnhash["vic"].value, self.pydict["vic"]) self.assertNotEqual(self.svnhash["clark"].value, self.pydict["bruce"])
def receive(self, baton, changed_paths, revision, author, date, message, pool): entry = LogEntry() # Save information about the log entry entry.revision = revision entry.author = str(author) entry.date = _types.SvnDate(date) entry.message = str(message) if self.discover_changed_paths: entry.changed_paths = _types.Hash(POINTER(svn_log_changed_path_t), changed_paths, dup = svn_log_changed_path_dup) else: entry.changed_paths = None self.send(entry)
def proplist(self, path, rev = SVN_INVALID_REVNUM): """Return a dictionary containing the properties on PATH@REV If REV is not specified, we look at the latest revision of the repository.""" props = _types.Hash(POINTER(svn_string_t), None, wrapper=_types.SvnStringPtr) status = self.check_path(path, rev) if status == svn_node_dir: svn_ra_get_dir2(self, NULL, NULL, props.byref(), path, rev, 0, props.pool) else: svn_ra_get_file(self, path, rev, NULL, NULL, props.byref(), props.pool) self.iterpool.clear() return props
def list(self, path, rev = SVN_INVALID_REVNUM, fields = SVN_DIRENT_ALL): """List the contents of the specified directory PATH@REV. This function returns a dictionary, which maps entry names to directory entries (svn_dirent_t objects). If REV is not specified, we look at the latest revision of the repository. FIELDS controls what portions of the svn_dirent_t object are filled in. To have them completely filled in, just pass in SVN_DIRENT_ALL (which is the default); otherwise, pass the bitwise OR of all the SVN_DIRENT_ fields you would like to have returned to you. """ dirents = _types.Hash(POINTER(svn_dirent_t), None) svn_ra_get_dir2(self, dirents.byref(), NULL, NULL, path, rev, fields, dirents.pool) self.iterpool.clear() return dirents