Rev 1256: Use uppercase/lowercase style consistent with rest of the project. in http://people.samba.org/bzr/jelmer/bzr-svn/svn-1.5
Jelmer Vernooij
jelmer at samba.org
Thu Jun 26 18:08:50 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/svn-1.5
------------------------------------------------------------
revno: 1256
revision-id: jelmer at samba.org-20080626170850-6n22hyvad5pdzlis
parent: jelmer at samba.org-20080626170457-v5uwhd3jot0bq3m6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: svn-1.5
timestamp: Thu 2008-06-26 19:08:50 +0200
message:
Use uppercase/lowercase style consistent with rest of the project.
modified:
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
=== modified file 'logwalker.py'
--- a/logwalker.py 2008-06-26 17:04:57 +0000
+++ b/logwalker.py 2008-06-26 17:08:50 +0000
@@ -103,20 +103,13 @@
def _create_table(self):
self.cachedb.executescript("""
- CREATE TABLE IF NOT EXISTS changed_path(
- rev INTEGER,
- action TEXT,
- path TEXT,
- copyfrom_path TEXT,
- copyfrom_rev INTEGER);
- CREATE INDEX IF NOT EXISTS path_rev ON changed_path(rev);
- CREATE UNIQUE INDEX IF NOT EXISTS path_rev_path ON changed_path(rev, path);
- CREATE UNIQUE INDEX IF NOT EXISTS path_rev_path_action ON changed_path(rev, path, action);
+ create table if not exists changed_path(rev integer, action text, path text, copyfrom_path text, copyfrom_rev integer);
+ create index if not exists path_rev on changed_path(rev);
+ create unique index if not exists path_rev_path on changed_path(rev, path);
+ create unique index if not exists path_rev_path_action on changed_path(rev, path, action);
- CREATE TABLE IF NOT EXISTS fetched_rev(
- path TEXT,
- rev INTEGER);
- CREATE UNIQUE INDEX IF NOT EXISTS fetched_path ON fetched_rev(path, rev);
+ create table if not exists fetched_rev(path text, rev integer);
+ create unique index if not exists fetched_path on fetched_rev(path, rev);
create table if not exists revprop(rev integer, name text, value text);
create table if not exists revinfo(rev integer, all_revprops int);
create index if not exists revprop_rev on revprop(rev);
@@ -126,17 +119,14 @@
def find_latest_change(self, path, revnum):
if path == "":
- return self.cachedb.execute("""
- SELECT MAX(rev) FROM changed_path
- WHERE rev <= ?
- """, (revnum,)).fetchone()[0]
+ return self.cachedb.execute("select max(rev) from changed_path where rev <= ?", (revnum,)).fetchone()[0]
return self.cachedb.execute("""
- SELECT MAX(rev) FROM changed_path
- WHERE rev <= ?
- AND (path=?
- OR path GLOB ?
- OR (? GLOB (path || '/*')
- AND action IN ('A', 'R')))
+ select max(rev) from changed_path
+ where rev <= ?
+ and (path=?
+ or path glob ?
+ or (? glob (path || '/*')
+ and action in ('A', 'R')))
""", (revnum, path, path + "/*", path)).fetchone()[0]
def path_added(self, path, from_revnum, to_revnum):
@@ -148,29 +138,29 @@
"""
assert from_revnum < to_revnum
return self.cachedb.execute("""
- SELECT MAX(rev) FROM changed_path
- WHERE rev > ? AND rev <= ?
- AND (?=path OR ? GLOB (path || '/*'))
- AND action IN ('A', 'R')
+ select max(rev) from changed_path
+ where rev > ? and rev <= ?
+ and (?=path or ? glob (path || '/*'))
+ and action in ('A', 'R')
""", (from_revnum, to_revnum, path, path)).fetchone()[0]
def get_change(self, path, revnum):
return self.cachedb.execute("""
- SELECT action, copyfrom_path, copyfrom_rev
- FROM changed_path
- WHERE path=? AND rev=?
+ select action, copyfrom_path, copyfrom_rev
+ from changed_path
+ where path=? and rev=?
""", (path, revnum)).fetchone()
def get_previous(self, path, revnum):
"""Determine the change that created the given path or its
nearest ancestor, in order to determine where it came from."""
return self.cachedb.execute("""
- SELECT path, action, copyfrom_path, copyfrom_rev
- FROM changed_path
- WHERE rev=? AND action IN ('A', 'R')
- AND (path=? OR path='' OR ? GLOB (path || '/*'))
- ORDER BY path DESC
- LIMIT 1
+ select path, action, copyfrom_path, copyfrom_rev
+ from changed_path
+ where rev=? and action in ('a', 'r')
+ and (path=? or path='' or ? glob (path || '/*'))
+ order by path desc
+ limit 1
""", (revnum, path, path)).fetchone()
def get_revision_paths(self, revnum):
@@ -178,10 +168,7 @@
:param revnum: Revision number of revision.
"""
- result = self.cachedb.execute("""
- SELECT path, action, copyfrom_path, copyfrom_rev
- FROM changed_path WHERE rev=?
- """, (revnum,))
+ result = self.cachedb.execute("select path, action, copyfrom_path, copyfrom_rev from changed_path where rev=?", (revnum,))
paths = {}
for p, act, cf, cr in result:
if cf is not None:
@@ -196,17 +183,8 @@
:param revnum: revision number to fetch
"""
if path == '':
- return self.cachedb.execute("""
- SELECT COUNT(*)
- FROM changed_path
- WHERE rev=?
- """, (revnum,)).fetchone()[0] > 0
- return self.cachedb.execute("""
- SELECT COUNT(*)
- FROM changed_path
- WHERE rev=?
- AND (path=? OR path GLOB (? || '/*'))
- """, (revnum, path, path)).fetchone()[0] > 0
+ return self.cachedb.execute("select count(*) from changed_path where rev=?", (revnum,)).fetchone()[0] > 0
+ return self.cachedb.execute("select count(*) from changed_path where rev=? and (path=? or path glob (? || '/*'))", (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.
@@ -219,20 +197,14 @@
"""
assert action in ("A", "R", "D", "M")
assert not path.startswith("/")
- self.cachedb.execute("""
- REPLACE INTO changed_path
- (rev, path, action, copyfrom_path, copyfrom_rev)
- VALUES (?, ?, ?, ?, ?)
- """, (rev, path, action, copyfrom_path, copyfrom_rev))
+ self.cachedb.execute("replace into changed_path (rev, path, action, copyfrom_path, copyfrom_rev) values (?, ?, ?, ?, ?)", (rev, path, action, copyfrom_path, copyfrom_rev))
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,))
+ result = self.cachedb.execute("select name, value from revprop where rev = ?", (revnum,))
revprops = {}
for k,v in result:
revprops[k.encode("utf-8")] = v.encode("utf-8")
@@ -245,18 +217,14 @@
: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.cachedb.execute("replace into revprop (rev, name, value) values (?, ?, ?)", (rev, name, value))
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]
+ 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.
@@ -265,7 +233,7 @@
:param all_revprops: Whether or not the full revprops have been stored.
"""
self.cachedb.execute("""
- REPLACE INTO revinfo (rev, all_revprops) VALUES (?, ?)
+ replace into revinfo (rev, all_revprops) values (?, ?)
""", (rev, all_revprops))
def commit(self):
@@ -285,30 +253,30 @@
:param rev: Revision number of tree.
"""
self.cachedb.execute("""
- REPLACE INTO fetched_rev (path, rev) VALUES (?, ?)
+ 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 a path.
- PATH no later
- than REV, or None if that exact path had not been cached
- before or at revision REV."""
+ path no later than rev, or None if that exact path had not been cached
+ before or at revision rev.
+ """
return self.cachedb.execute("""
- SELECT MAX(rev) FROM fetched_rev
- WHERE path = ? AND rev <= ?
+ select max(rev) from fetched_rev
+ where path = ? and rev <= ?
""", (path, rev)).fetchone()[0]
def get_next_cache(self, path, rev):
"""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."""
+ path beginning at revision rev, or None if that exact path had not been
+ cached since rev.
+ """
return self.cachedb.execute("""
- SELECT MIN(rev) FROM fetched_rev
- WHERE path = ? AND rev >= ?
+ select min(rev) from fetched_rev
+ where path = ? and rev >= ?
""", (path, rev)).fetchone()[0]
More information about the bazaar-commits
mailing list