comparison tests/test_util.py @ 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 0991df151799
comparison
equal deleted inserted replaced
1463:86ae03f889a4 1464:1a4d0f1563d0
26 from mercurial import ui 26 from mercurial import ui
27 from mercurial import util as hgutil 27 from mercurial import util as hgutil
28 from mercurial import extensions 28 from mercurial import extensions
29 29
30 from hgsubversion import compathacks 30 from hgsubversion import compathacks
31 from hgsubversion import svnrepo
31 from hgsubversion import svnwrap 32 from hgsubversion import svnwrap
32 33
33 try: 34 try:
34 from mercurial import obsolete 35 from mercurial import obsolete
35 obsolete._enabled 36 obsolete._enabled
780 except AttributeError: 781 except AttributeError:
781 from mercurial import commands 782 from mercurial import commands
782 commands.log(_ui, repo, rev=None, template=templ, graph=True) 783 commands.log(_ui, repo, rev=None, template=templ, graph=True)
783 return _ui.popbuffer() 784 return _ui.popbuffer()
784 785
786 def svnlog(self, repo=None):
787 '''log of the remote Subversion repository corresponding to repo
788
789 In order to make the format suitable for direct comparison in
790 tests, we exclude dates and convert the path operations into
791 a tuple.
792 '''
793
794 if repo is None:
795 repo = self.repo
796
797 return [(r.revnum, r.message,
798 dict((p, (op.action, op.copyfrom_path, int(op.copyfrom_rev)))
799 for (p, op) in r.paths.items()))
800 for r in svnrepo.svnremoterepo(repo.ui).svn.revisions()]
801
785 def draw(self, repo): 802 def draw(self, repo):
786 sys.stdout.write(self.getgraph(repo)) 803 sys.stdout.write(self.getgraph(repo))