| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import collections | 5 import collections |
| 6 | 6 |
| 7 | 7 |
| 8 class Dependency(object): | 8 class Dependency(object): |
| 9 """Represents a dependency in Chrome, like blink, v8, pdfium, etc.""" | 9 """Represents a dependency in Chrome, like blink, v8, pdfium, etc.""" |
| 10 def __init__(self, path, repo_url, revision, deps_file='DEPS'): | 10 def __init__(self, path, repo_url, revision, |
| 11 deps_file='DEPS', deps_repo_url=None, deps_repo_revision=None): |
| 11 self.path = path | 12 self.path = path |
| 12 self.repo_url = repo_url | 13 self.repo_url = repo_url |
| 13 self.revision = revision | 14 self.revision = revision |
| 14 self.deps_file = deps_file | 15 self.deps_file = deps_file |
| 16 |
| 17 if deps_repo_url is None: |
| 18 self.deps_repo_url = repo_url |
| 19 else: |
| 20 self.deps_repo_url = deps_repo_url |
| 21 |
| 22 if deps_repo_revision is None: |
| 23 self.deps_repo_revision = revision |
| 24 else: |
| 25 self.deps_repo_revision = deps_repo_revision |
| 26 |
| 15 self.parent = None | 27 self.parent = None |
| 16 self.children = dict() | 28 self.children = dict() |
| 17 | 29 |
| 18 def SetParent(self, parent): | 30 def SetParent(self, parent): |
| 19 assert self.parent is None | 31 assert self.parent is None |
| 20 self.parent = parent | 32 self.parent = parent |
| 21 self.parent.AddChild(self) | 33 self.parent.AddChild(self) |
| 22 | 34 |
| 23 def AddChild(self, child): | 35 def AddChild(self, child): |
| 24 self.children[child.path] = child | 36 self.children[child.path] = child |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 class DependencyRoll(collections.namedtuple( | 51 class DependencyRoll(collections.namedtuple( |
| 40 'DependencyRoll', ('path', 'repo_url', 'old_revision', 'new_revision'))): | 52 'DependencyRoll', ('path', 'repo_url', 'old_revision', 'new_revision'))): |
| 41 """Represents a dependency roll (revision update) in chromium. | 53 """Represents a dependency roll (revision update) in chromium. |
| 42 | 54 |
| 43 Note: It is possible that the DEPS roll is a revert so that ``new_revision`` | 55 Note: It is possible that the DEPS roll is a revert so that ``new_revision`` |
| 44 is actually older than ``old_revision`` in the dependency. | 56 is actually older than ``old_revision`` in the dependency. |
| 45 """ | 57 """ |
| 46 | 58 |
| 47 def ToDict(self): | 59 def ToDict(self): |
| 48 return self._asdict() | 60 return self._asdict() |
| OLD | NEW |