def test_heads(self): self.assertEqual( git_sort.get_heads(self.repo), collections.OrderedDict([ (git_sort.Head(git_sort.RepoURL("torvalds/linux.git")), self.heads["mainline"]), (git_sort.Head(git_sort.RepoURL("davem/net.git")), self.heads["net"]), ]))
def test_heads(self): self.assertEqual( git_sort.get_heads(self.repo), collections.OrderedDict([( git_sort.Head(git_sort.RepoURL(None), "HEAD"), str(self.commits[-1][0]), )]))
def parse_section_header(line): """ Parse a series.conf line to identify if it's a comment denoting the beginning of a subsystem section. In that case, return the Head object it corresponds to. """ oot_text = git_sort.oot.rev line = line.strip() if not line.startswith("# "): raise exc.KSNotFound() line = line[2:] if line == oot_text: return git_sort.oot elif line.lower() == series_conf.start_text: raise exc.KSNotFound() words = line.split(None, 3) if len(words) > 2: raise exc.KSError( "Section comment \"%s\" in series.conf could not be parsed. " "series.conf is invalid." % (line, )) args = [git_sort.RepoURL(words[0])] if len(words) == 2: args.append(words[1]) head = git_sort.Head(*args) if head not in git_sort.remotes: raise exc.KSError( "Section comment \"%s\" in series.conf does not match any Head in " "variable \"remotes\". series.conf is invalid." % (line, )) return head
def test_sort(self): mapping = {commit: subject for commit, subject in self.commits} r = self.index.sort(mapping) self.assertEqual(len(mapping), 0) self.assertEqual(len(r), 1) r2 = list(r.items())[0] self.assertEqual(r2[0], git_sort.Head(git_sort.RepoURL(None), "HEAD")) self.assertEqual(r2[1], [subject for commit, subject in self.commits])
def test_sort(self): mapping = {str(commit.id): commit.message for commit in self.commits} r = self.index.sort(mapping) self.assertEqual(len(mapping), 0) self.assertEqual(len(r), 2) r2 = list(r.items())[0] self.assertEqual(r2[0], git_sort.Head(git_sort.RepoURL("torvalds/linux.git"))) self.assertEqual(r2[1], [commit.message for commit in self.commits])
def test_eq(self): self.assertEqual( git_sort.Head(git_sort.RepoURL("torvalds/linux.git")), git_sort.Head(git_sort.RepoURL("torvalds/linux.git")), ) self.assertEqual( git_sort.Head(git_sort.RepoURL("torvalds/linux.git")), git_sort.Head(git_sort.RepoURL("torvalds/linux.git"), "master"), ) self.assertNotEqual( git_sort.Head(git_sort.RepoURL("torvalds/linux.git")), git_sort.Head(git_sort.RepoURL("davem/net.git")), ) self.assertTrue( git_sort.Head(git_sort.RepoURL("torvalds/linux.git")) < git_sort.Head(git_sort.RepoURL("davem/net.git")))