Rev 1253: PEP8, docstrings. in http://people.samba.org/bzr/jelmer/bzr-svn/svn-1.5
Jelmer Vernooij
jelmer at samba.org
Thu Jun 26 17:55:26 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/svn-1.5
------------------------------------------------------------
revno: 1253
revision-id: jelmer at samba.org-20080626165526-ob00qi6qnv13ydv7
parent: jelmer at samba.org-20080626163923-svs1cly2vlvrjapa
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: svn-1.5
timestamp: Thu 2008-06-26 18:55:26 +0200
message:
PEP8, docstrings.
modified:
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
=== modified file 'logwalker.py'
--- a/logwalker.py 2008-06-23 20:48:07 +0000
+++ b/logwalker.py 2008-06-26 16:55:26 +0000
@@ -140,10 +140,12 @@
""", (revnum, path, path + "/*", path)).fetchone()[0]
def path_added(self, path, from_revnum, to_revnum):
- """Determine whether a path was recently added. It returns the
- latest revision number before TO_REVNUM in which the PATH was
- added or replaced, or None if the PATH was neither added nor
- replaced after FROM_REVNUM but before TO_REVNUM."""
+ """Determine whether a path was recently added.
+
+ It returns the latest revision number before to_revnum in which the
+ path was added or replaced, or None if the path was neither added nor
+ replaced after from_revnum but before to_revnum.
+ """
assert from_revnum < to_revnum
return self.cachedb.execute("""
SELECT MAX(rev) FROM changed_path
@@ -172,7 +174,10 @@
""", (revnum, path, path)).fetchone()
def get_revision_paths(self, revnum):
- """Return all history information for a given revision number"""
+ """Return all history information for a given revision number.
+
+ :param revnum: Revision number of revision.
+ """
result = self.cachedb.execute("""
SELECT path, action, copyfrom_path, copyfrom_rev
FROM changed_path WHERE rev=?
@@ -185,6 +190,11 @@
return paths
def changes_path(self, path, revnum):
+ """Check whether a path was changed in a particular revision:
+
+ :param path: path to check for
+ :param revnum: revision number to fetch
+ """
if path == '':
return self.cachedb.execute("""
SELECT COUNT(*)
@@ -199,7 +209,14 @@
""", (revnum, path, path)).fetchone()[0] > 0
def insert_path(self, rev, path, action, copyfrom_path=None, copyfrom_rev=-1):
- """Insert new history information into the cache."""
+ """Insert new history information into the cache.
+
+ :param rev: Revision number of the revision
+ :param path: Path that was changed
+ :param action: Action on path (single-character)
+ :param copyfrom_path: Optional original path this path was copied from.
+ :param copyfrom_rev: Optional original rev this path was copied from.
+ """
assert action in ("A", "R", "D", "M")
self.cachedb.execute("""
REPLACE INTO changed_path
@@ -209,6 +226,10 @@
self._commit_conditionally()
def get_revprops(self, revnum):
+ """Retrieve all the cached revision properties.
+
+ :param revnum: Revision number of revision to retrieve revprops for.
+ """
result = self.cachedb.execute("""
SELECT name, value FROM revprop WHERE rev = ?
""", (revnum,))
@@ -218,17 +239,32 @@
return revprops
def insert_revprop(self, rev, name, value):
+ """Add a revision property.
+
+ :param rev: Revision number of the revision.
+ :param name: Name of the revision property.
+ :param value: Contents of the revision property.
+ """
self.cachedb.execute("""
REPLACE INTO revprop (rev, name, value) VALUES (?, ?, ?)
""", (rev, name, value))
self._commit_conditionally()
def has_all_revprops(self, revnum):
+ """Check whether all revprops for a revision have been cached.
+
+ :param revnum: Revision number of the revision.
+ """
return self.cachedb.execute("""
SELECT all_revprops FROM revinfo WHERE rev = ?
""", (revnum,)).fetchone()[0]
def insert_revinfo(self, rev, all_revprops):
+ """Insert metadata for a revision.
+
+ :param rev: Revision number of the revision.
+ :param all_revprops: Whether or not the full revprops have been stored.
+ """
self.cachedb.execute("""
REPLACE INTO revinfo (rev, all_revprops) VALUES (?, ?)
""", (rev, all_revprops))
@@ -245,14 +281,20 @@
self.commit()
def have_cached(self, path, rev):
- """Remember a given pegged subtree as cached."""
+ """Remember a given pegged subtree as cached.
+
+ :param path: Base path of tree.
+ :param rev: Revision number of tree.
+ """
self.cachedb.execute("""
REPLACE INTO fetched_rev (path, rev) VALUES (?, ?)
""", (path, rev))
self.commit()
def get_prev_cache(self, path, rev):
- """Return the latest fully cached revision of PATH no later
+ """Return the latest fully cached revision of a path.
+
+ PATH no later
than REV, or None if that exact path had not been cached
before or at revision REV."""
return self.cachedb.execute("""
@@ -261,7 +303,9 @@
""", (path, rev)).fetchone()[0]
def get_next_cache(self, path, rev):
- """Return the earliest fully cached revision of PATH beginning
+ """Return the earliest fully cached revision of a path.
+
+ of path beginning
at revision REV, or None if that exact path had not been
cached since REV."""
return self.cachedb.execute("""
@@ -270,7 +314,6 @@
""", (path, rev)).fetchone()[0]
-
def struct_revpaths_to_tuples(changed_paths):
assert isinstance(changed_paths, dict)
revpaths = {}
@@ -621,7 +664,7 @@
def _fetch_revisions(self, path, peg_revnum):
"""Fetch information about all revisions in the remote repository
- until PEG_REVNUM. The PATH is pegged to that revnum.
+ until peg_revnum. The path is pegged to that revnum.
Revision fetching level 1: Ensure that we get complete history
information for the requested pegged path.
More information about the bazaar-commits
mailing list