def assert_gets_and_sets_revision(self, before, after, rev_before='deadbeef'):
    local_scope = gclient_eval.Exec('\n'.join(before))

    result = gclient_eval.GetRevision(local_scope, 'src/dep')
    self.assertEqual(result, rev_before)

    gclient_eval.SetRevision(local_scope, 'src/dep', 'deadfeed')
    self.assertEqual('\n'.join(after), gclient_eval.RenderDEPSFile(local_scope))
Esempio n. 2
0
def calculate_roll(full_dir, dependency, gclient_dict, roll_to):
    """Calculates the roll for a dependency by processing gclient_dict, and
  fetching the dependency via git.
  """
    head = gclient_eval.GetRevision(gclient_dict, dependency)
    if not head:
        raise Error('%s is unpinned.' % dependency)
    check_call(['git', 'fetch', 'origin', '--quiet'], cwd=full_dir)
    roll_to = check_output(['git', 'rev-parse', roll_to], cwd=full_dir).strip()
    return head, roll_to