changeset 1464:1a4d0f1563d0

test_util: add utility function for logging the Subversion repository This is useful when pushing non-trivial manipulations to Subversion, as it allows you to see the actual result.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 14 Jun 2016 21:31:37 +0200
parents 86ae03f889a4
children 32166f557518
files tests/test_util.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -28,6 +28,7 @@ from mercurial import util as hgutil
 from mercurial import extensions
 
 from hgsubversion import compathacks
+from hgsubversion import svnrepo
 from hgsubversion import svnwrap
 
 try:
@@ -782,5 +783,21 @@ files:     {files}
             commands.log(_ui, repo, rev=None, template=templ, graph=True)
         return _ui.popbuffer()
 
+    def svnlog(self, repo=None):
+        '''log of the remote Subversion repository corresponding to repo
+
+        In order to make the format suitable for direct comparison in
+        tests, we exclude dates and convert the path operations into
+        a tuple.
+        '''
+
+        if repo is None:
+            repo = self.repo
+
+        return [(r.revnum, r.message,
+                 dict((p, (op.action, op.copyfrom_path, int(op.copyfrom_rev)))
+                      for (p, op) in r.paths.items()))
+                for r in svnrepo.svnremoterepo(repo.ui).svn.revisions()]
+
     def draw(self, repo):
         sys.stdout.write(self.getgraph(repo))