Keep modifications to GitPython objects in single module
Ensure all modifications to objects imported from GitPython are placed in the same module within git-upstream, from which all instances are then imported. This ensures that for all test contexts, the modified objects are the ones used instead of accidentally using the objects without modifications. Specifically this allows direct execution of the strategies unit tests using testtools to behave as expected, as otherwise the note module is not correctly pulled in when processing the filters. Change-Id: I0725429d8247e657681ee1dda25cb26e3688c0d9
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from git import base
|
||||
from git import GitCommandError
|
||||
|
||||
from git_upstream.errors import GitUpstreamError
|
||||
@@ -68,7 +67,3 @@ def note_message(self, note_ref='refs/notes/commits'):
|
||||
return None
|
||||
else:
|
||||
raise e
|
||||
|
||||
base.Object.add_note = add_note
|
||||
base.Object.append_note = append_note
|
||||
base.Object.note = note_message
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#
|
||||
|
||||
import git
|
||||
from git import base
|
||||
|
||||
from git_upstream.lib import note
|
||||
|
||||
try:
|
||||
from git.objects.commit import Commit
|
||||
@@ -119,3 +122,8 @@ if not hasattr(Commit, 'iter_items'):
|
||||
git.commit.Commit = GitUpstreamCompatCommit
|
||||
else:
|
||||
Commit.short = GitUpstreamCompatCommit.short
|
||||
|
||||
|
||||
base.Object.add_note = note.add_note
|
||||
base.Object.append_note = note.append_note
|
||||
base.Object.note = note.note_message
|
||||
|
||||
Reference in New Issue
Block a user