def test1(self): base = "svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk" s = SVNPoller(base + "/") self.failUnlessEqual(s.svnurl, base) # certify slash-stripping prefix = s.determine_prefix(prefix_output) self.failUnlessEqual(prefix, "trunk") self.failUnlessEqual(s._prefix, prefix)
def testFirstTime(self): base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository/sample" s = SVNPoller(base, split_file=split_file) s._prefix = "sample" doc = s.parse_logs(make_changes_output(4)) logentries = s.get_new_logentries(doc) # SVNPoller ignores all changes that happened before it was started self.failUnlessEqual(len(logentries), 0) self.failUnlessEqual(s.last_change, 4)
def test1(self): base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository/sample" s = SVNPoller(base) s._prefix = "sample" output = make_changes_output(4) doc = s.parse_logs(output) newlast, logentries = s._filter_new_logentries(doc, 4) self.failUnlessEqual(newlast, 4) self.failUnlessEqual(len(logentries), 0) newlast, logentries = s._filter_new_logentries(doc, 3) self.failUnlessEqual(newlast, 4) self.failUnlessEqual(len(logentries), 1) newlast, logentries = s._filter_new_logentries(doc, 1) self.failUnlessEqual(newlast, 4) self.failUnlessEqual(len(logentries), 3) newlast, logentries = s._filter_new_logentries(doc, None) self.failUnlessEqual(newlast, 4) self.failUnlessEqual(len(logentries), 0)
def test2(self): base = "svn+ssh://svn.twistedmatrix.com/svn/Twisted" s = SVNPoller(base) self.failUnlessEqual(s.svnurl, base) prefix = s.determine_prefix(prefix_output_2) self.failUnlessEqual(prefix, "")
def testChanges(self): base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository/sample" s = SVNPoller(base, split_file=split_file) s._prefix = "sample" doc = s.parse_logs(make_changes_output(3)) newlast, logentries = s._filter_new_logentries(doc, 1) # so we see revisions 2 and 3 as being new self.failUnlessEqual(newlast, 3) changes = s.create_changes(logentries) self.failUnlessEqual(len(changes), 2) self.failUnlessEqual(changes[0].branch, "branch") self.failUnlessEqual(changes[0].revision, '2') self.failUnlessEqual(changes[1].branch, "branch") self.failUnlessEqual(changes[1].files, ["main.c"]) self.failUnlessEqual(changes[1].revision, '3') # and now pull in r4 doc = s.parse_logs(make_changes_output(4)) newlast, logentries = s._filter_new_logentries(doc, newlast) self.failUnlessEqual(newlast, 4) # so we see revision 4 as being new changes = s.create_changes(logentries) self.failUnlessEqual(len(changes), 1) self.failUnlessEqual(changes[0].branch, None) self.failUnlessEqual(changes[0].revision, '4') self.failUnlessEqual(changes[0].files, ["version.c"]) # and now pull in r5 (should *not* create a change as it's a # branch deletion doc = s.parse_logs(make_changes_output(5)) newlast, logentries = s._filter_new_logentries(doc, newlast) self.failUnlessEqual(newlast, 5) # so we see revision 5 as being new changes = s.create_changes(logentries) self.failUnlessEqual(len(changes), 0) # and now pull in r6 (should create a change as it's not # deleting an entire branch doc = s.parse_logs(make_changes_output(6)) newlast, logentries = s._filter_new_logentries(doc, newlast) self.failUnlessEqual(newlast, 6) # so we see revision 6 as being new changes = s.create_changes(logentries) self.failUnlessEqual(len(changes), 1) self.failUnlessEqual(changes[0].branch, 'branch') self.failUnlessEqual(changes[0].revision, '6') self.failUnlessEqual(changes[0].files, ["version.c"])
def __init__(self, *args, **kwargs): SVNPoller.__init__(self, *args, **kwargs) self.pending_commands = [] self.finished_changes = []
def create_changes(self, new_logentries): changes = SVNPoller.create_changes(self, new_logentries) for change in changes: self.comparator.addRevision(change['revision']) return changes
def test4(self): base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository/sample/trunk" s = SVNPoller(base) self.failUnlessEqual(s.svnurl, base) prefix = s.determine_prefix(prefix_output_4) self.failUnlessEqual(prefix, "sample/trunk")
def __init__(self, comparator, *args, **kwargs): self.comparator = comparator SVNPoller.__init__(self, *args, **kwargs)
def test3(self): base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository" s = SVNPoller(base) self.failUnlessEqual(s.svnurl, base) prefix = s.determine_prefix(prefix_output_3) self.failUnlessEqual(prefix, "")