extra = ""
if path == "":
- extra += " OR path LIKE '%'"
+ extra += " OR path GLOB '*'"
else:
- extra += " OR path LIKE '%s/%%'" % path.strip("/")
- extra += " OR ('%s' LIKE (path || '/%%') AND (action = 'R' OR action = 'A'))" % path.strip("/")
+ extra += " OR path GLOB '%s/*'" % path.strip("/")
+ extra += " OR ('%s' GLOB (path || '/*') AND (action = 'R' OR action = 'A'))" % path.strip("/")
query = "SELECT rev FROM changed_path WHERE (path='%s'%s) AND rev <= %d ORDER BY rev DESC LIMIT 1" % (path.strip("/"), extra, revnum)
return row[0]
- def iter_changes(self, path, from_revnum, to_revnum=0, limit=0, pb=None):
- """Return iterator over all the revisions between revnum and 0 named path or inside path.
+ def iter_changes(self, paths, from_revnum, to_revnum=0, limit=0, pb=None):
+ """Return iterator over all the revisions between from_revnum and to_revnum named path or inside path.
- :param path: Branch path to start reporting (in revnum)
+ :param paths: Paths to report about.
:param from_revnum: Start revision.
- :param to_revnum: End revision
- :return: An iterator that yields tuples with (path, paths, revnum, revprops)
- where paths is a dictionary with all changes that happened in path
+ :param to_revnum: End revision.
+ :return: An iterator that yields tuples with (paths, revnum, revprops)
+ where paths is a dictionary with all changes that happened
in revnum.
"""
- assert from_revnum >= 0 and to_revnum >= 0 and from_revnum >= to_revnum
+ assert from_revnum >= 0 and to_revnum >= 0
+
+ ascending = (to_revnum > from_revnum)
revnum = from_revnum
- self.mutter("iter changes %r:%r" % (path, revnum))
+ self.mutter("iter changes %r->%r (%r)" % (from_revnum, to_revnum, paths))
- recurse = (path != "")
+ if paths is None:
+ path = ""
+ else:
+ assert len(paths) == 1
+ path = paths[0].strip("/")
- path = path.strip("/")
+ assert from_revnum >= to_revnum or path == ""
i = 0
- while revnum >= to_revnum:
+ while ((not ascending and revnum >= to_revnum) or
+ (ascending and revnum <= to_revnum)):
if pb is not None:
pb.update("determining changes", from_revnum-revnum, from_revnum)
assert revnum > 0 or path == "", "Inconsistent path,revnum: %r,%r" % (revnum, path)
revpaths = self._get_revision_paths(revnum)
- next = changes.find_prev_location(revpaths, path, revnum)
+ if ascending:
+ next = (path, revnum+1)
+ else:
+ next = changes.find_prev_location(revpaths, path, revnum)
revprops = lazy_dict({}, self._transport.revprop_list, revnum)
if changes.changes_path(revpaths, path, True):
- yield (path, revpaths, revnum, revprops)
+ yield (revpaths, revnum, revprops)
i += 1
if limit != 0 and i == limit:
break
try:
try:
while self.saved_revnum < to_revnum:
- for (orig_paths, revision, revprops) in self.actual._transport.iter_log("", self.saved_revnum,
+ for (orig_paths, revision, revprops) in self.actual._transport.iter_log(None, self.saved_revnum,
to_revnum, self.actual._limit, True,
True, []):
pb.update('fetching svn revision info', revision, to_revnum)
"""
assert isinstance(path, str)
assert isinstance(revnum, int) and revnum >= 0
-
+
try:
- return self._transport.iter_log(path, revnum, 0, 2, True, False, []).next()[1]
+ return self._transport.iter_log([path], revnum, 0, 2, True, False, []).next()[1]
except SubversionException, (_, num):
if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
raise NoSuchRevision(branch=self,
return None
raise
- def iter_changes(self, path, from_revnum, to_revnum=0, limit=0, pb=None):
+ def iter_changes(self, paths, from_revnum, to_revnum=0, limit=0, pb=None):
"""Return iterator over all the revisions between revnum and 0 named path or inside path.
- :param path: Branch path to start reporting (in revnum)
+ :param paths: Paths report about (in revnum)
:param from_revnum: Start revision.
- :param to_revnum: End revision.
- :return: An iterator that yields tuples with (path, paths, revnum, revprops)
- where paths is a dictionary with all changes that happened in path
- in revnum.
+ :param to_revnum: End revision.
+ :return: An iterator that yields tuples with (paths, revnum, revprops)
+ where paths is a dictionary with all changes that happened in revnum.
"""
- assert from_revnum >= 0 and to_revnum >= 0 and from_revnum >= to_revnum
+ assert from_revnum >= 0 and to_revnum >= 0
try:
- for (changed_paths, revnum, known_revprops) in self._transport.iter_log(path, from_revnum, to_revnum, limit, True, False, []):
+ for (changed_paths, revnum, known_revprops) in self._transport.iter_log(paths, from_revnum, to_revnum, limit, True, False, []):
if pb is not None:
pb.update("determining changes", from_revnum-revnum, from_revnum)
if revnum == 0 and changed_paths is None:
revpaths = {"": ('A', None, -1)}
else:
- assert isinstance(changed_paths, dict), "invalid paths in %r:%r" % (revnum, path)
+ assert isinstance(changed_paths, dict), "invalid paths %r in %r" % (changed_paths, revnum)
revpaths = struct_revpaths_to_tuples(changed_paths)
- next = changes.find_prev_location(revpaths, path, revnum)
revprops = lazy_dict(known_revprops, self._transport.revprop_list, revnum)
- yield (path, revpaths, revnum, revprops)
- if next is None:
- break
- path = next[0]
+ yield (revpaths, revnum, revprops)
except SubversionException, (_, num):
if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
raise NoSuchRevision(branch=self,
try:
return struct_revpaths_to_tuples(
- self._transport.iter_log("", revnum, revnum, 1, True, True, []).next()[0])
+ self._transport.iter_log(None, revnum, revnum, 1, True, True, []).next()[0])
except SubversionException, (_, num):
if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
raise NoSuchRevision(branch=self,
return (None, -1)
try:
- paths = struct_revpaths_to_tuples(self._transport.iter_log(path, revnum, revnum, 1, True, False, []).next()[0])
+ paths = struct_revpaths_to_tuples(self._transport.iter_log([path], revnum, revnum, 1, True, False, []).next()[0])
except SubversionException, (_, num):
if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
raise NoSuchRevision(branch=self,