def test_append_get_and_has_notes(self):
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        changeset = gitrepo.commit('A new commit!', allow_empty=True)

        gitrepo.append_note('Hello note 1', revision=changeset.hash)
        gitrepo.append_note('Goodbye note 2')

        notes = gitrepo.get_changeset_notes(changeset.hash)
        self.assertEqual(['Hello note 1', 'Goodbye note 2'], notes)

        self.assertTrue(gitrepo.has_note('Hello note 1'))
        self.assertTrue(gitrepo.has_note('Goodbye note 2', changeset.hash))
        self.assertFalse(gitrepo.has_note(''))
        self.assertFalse(gitrepo.has_note('\n'))
Exemplo n.º 2
0
    def test_append_get_and_has_notes(self):
        gitrepo = Repository(self.cloned_from_repo)
        gitrepo.update('master')
        changeset = gitrepo.commit('A new commit!', allow_empty=True)

        gitrepo.append_note('Hello note 1', revision=changeset.hash)
        gitrepo.append_note('Goodbye note 2')

        notes = gitrepo.get_changeset_notes(changeset.hash)
        self.assertEqual(['Hello note 1', 'Goodbye note 2'], notes)

        self.assertTrue(gitrepo.has_note('Hello note 1'))
        self.assertTrue(gitrepo.has_note('Goodbye note 2', changeset.hash))
        self.assertFalse(gitrepo.has_note(''))
        self.assertFalse(gitrepo.has_note('\n'))
    def test_push_all_with_reference_and_revision(self):
        git1 = GitCmd(self.main_repo_bare)
        git2 = GitCmd(self.cloned_from_repo)

        repo2 = Repository(self.cloned_from_repo)
        repo2.commit('A commit', allow_empty=True)
        cs = repo2.commit('A second commit', allow_empty=True)
        repo2.tag('unqualified', revision=cs.hash)
        notes_ref = repo2.append_note('some note dude', cs.hash)

        repo2.push(self.main_repo,
                   self.main_repo_bare,
                   rev=cs.hash,
                   ref_name='master')

        notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
        notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()

        self.assertEqual(commit_ref_repo1, commit_ref_repo2)
        self.assertEqual(notes_ref_repo1, notes_ref_repo2)
        self.assertEqual(notes_ref, notes_ref_repo1)

        changesets1 = list(
            git1('log', 'unqualified', '--', pretty='oneline', _iter=True))
        changesets2 = list(
            git2('log', 'unqualified', '--', pretty='oneline', _iter=True))
        self.assertEquals(changesets1, changesets2)
Exemplo n.º 4
0
    def test_push_only_notes(self):
        git1 = GitCmd(self.main_repo_bare)
        git2 = GitCmd(self.cloned_from_repo)

        repo2 = Repository(self.cloned_from_repo)
        cs = repo2.commit('A commit', allow_empty=True)

        repo2.push(self.main_repo, self.main_repo_bare, rev=cs.hash, ref_name='master')

        notes_ref = repo2.append_note('some note dude', cs.hash)
        repo2.push(self.main_repo, self.main_repo_bare, ref_name='refs/notes/*')

        notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
        notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()

        self.assertEqual(commit_ref_repo1, commit_ref_repo2)
        self.assertEqual(notes_ref_repo1, notes_ref_repo2)
        self.assertEqual(notes_ref, notes_ref_repo1)
Exemplo n.º 5
0
    def test_push_all_with_reference_and_revision(self):
        git1 = GitCmd(self.main_repo_bare)
        git2 = GitCmd(self.cloned_from_repo)

        repo2 = Repository(self.cloned_from_repo)
        repo2.commit('A commit', allow_empty=True)
        cs = repo2.commit('A second commit', allow_empty=True)
        repo2.tag('unqualified', revision=cs.hash)
        notes_ref = repo2.append_note('some note dude', cs.hash)

        repo2.push(self.main_repo, self.main_repo_bare, rev=cs.hash, ref_name='master')

        notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
        notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()

        self.assertEqual(commit_ref_repo1, commit_ref_repo2)
        self.assertEqual(notes_ref_repo1, notes_ref_repo2)
        self.assertEqual(notes_ref, notes_ref_repo1)

        changesets1 = list(git1('log', 'unqualified', '--', pretty='oneline', _iter=True))
        changesets2 = list(git2('log', 'unqualified', '--', pretty='oneline', _iter=True))
        self.assertEquals(changesets1, changesets2)
    def test_push_only_notes(self):
        git1 = GitCmd(self.main_repo_bare)
        git2 = GitCmd(self.cloned_from_repo)

        repo2 = Repository(self.cloned_from_repo)
        cs = repo2.commit('A commit', allow_empty=True)

        repo2.push(self.main_repo,
                   self.main_repo_bare,
                   rev=cs.hash,
                   ref_name='master')

        notes_ref = repo2.append_note('some note dude', cs.hash)
        repo2.push(self.main_repo,
                   self.main_repo_bare,
                   ref_name='refs/notes/*')

        notes_ref_repo1, commit_ref_repo1 = git1('notes', 'list').split()
        notes_ref_repo2, commit_ref_repo2 = git2('notes', 'list').split()

        self.assertEqual(commit_ref_repo1, commit_ref_repo2)
        self.assertEqual(notes_ref_repo1, notes_ref_repo2)
        self.assertEqual(notes_ref, notes_ref_repo1)