Exemple #1
0
    def testSearchFollowUpCommits(self):
        commits = self._get_commits()
        hash_of_first_commit = commits[0]

        message = "Follow-up commit of " + hash_of_first_commit
        self._make_empty_commit(message)
        self._make_empty_commit(message)
        self._make_empty_commit(message)
        commits = self._get_commits()
        message = "Not related commit"
        self._make_empty_commit(message)

        followups = mergeinfo.get_followup_commits(self.base_dir, hash_of_first_commit)
        self.assertEqual(set(followups), set(commits[1:]))
    def testSearchFollowUpCommits(self):
        commits = self._get_commits()
        hash_of_first_commit = commits[0]

        message = 'Follow-up commit of ' + hash_of_first_commit
        self._make_empty_commit(message)
        self._make_empty_commit(message)
        self._make_empty_commit(message)
        commits = self._get_commits()
        message = 'Not related commit'
        self._make_empty_commit(message)

        followups = mergeinfo.get_followup_commits(self.base_dir,
                                                   hash_of_first_commit)
        self.assertEqual(set(followups), set(commits[1:]))
  def testSearchMerges(self):
    self._execute_git(['branch', 'test'])
    self._execute_git(['checkout', 'master'])
    message = 'real initial commit'
    self._make_empty_commit(message)
    commits = self._get_commits()
    hash_of_first_commit = commits[0]

    self._execute_git(['checkout', 'test'])
    message = 'Not related commit'
    self._make_empty_commit(message)

    # This should be found
    message = 'Merge '  + hash_of_first_commit
    hash_of_hit = self._make_empty_commit(message)

    # This should be ignored
    message = 'Cr-Branched-From: '  + hash_of_first_commit
    hash_of_ignored = self._make_empty_commit(message)

    self._execute_git(['checkout', 'master'])

    followups = mergeinfo.get_followup_commits(
        self.base_dir,
        hash_of_first_commit)

    # Check if follow ups and merges are not overlapping
    self.assertEqual(len(followups), 0)

    message = 'Follow-up commit of '  + hash_of_first_commit
    hash_of_followup = self._make_empty_commit(message)

    merges = mergeinfo.get_merge_commits(self.base_dir, hash_of_first_commit)
    # Check if follow up is ignored
    self.assertTrue(hash_of_followup not in merges)

    # Check for proper return of merges
    self.assertTrue(hash_of_hit in merges)
    self.assertTrue(hash_of_ignored not in merges)
  def testSearchMerges(self):
    self._execute_git(['branch', 'test'])
    self._execute_git(['checkout', 'master'])
    message = 'real initial commit'
    self._make_empty_commit(message)
    commits = self._get_commits()
    hash_of_first_commit = commits[0]

    self._execute_git(['checkout', 'test'])
    message = 'Not related commit'
    self._make_empty_commit(message)

    # This should be found
    message = 'Merge '  + hash_of_first_commit
    hash_of_hit = self._make_empty_commit(message)

    # This should be ignored
    message = 'Cr-Branched-From: '  + hash_of_first_commit
    hash_of_ignored = self._make_empty_commit(message)

    self._execute_git(['checkout', 'master'])

    followups = mergeinfo.get_followup_commits(
        self.base_dir,
        hash_of_first_commit)

    # Check if follow ups and merges are not overlapping
    self.assertEqual(len(followups), 0)

    message = 'Follow-up commit of '  + hash_of_first_commit
    hash_of_followup = self._make_empty_commit(message)

    merges = mergeinfo.get_merge_commits(self.base_dir, hash_of_first_commit)
    # Check if follow up is ignored
    self.assertTrue(hash_of_followup not in merges)

    # Check for proper return of merges
    self.assertTrue(hash_of_hit in merges)
    self.assertTrue(hash_of_ignored not in merges)