From f97653aa06cf84bcf160be3786b6fce49ef52961 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 15 Nov 2010 18:42:44 +0100 Subject: Repo: added submodule query and iteration methods similar to the ones provided for Remotes, including test --- lib/git/util.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/git/util.py') diff --git a/lib/git/util.py b/lib/git/util.py index fcb50585..b77e7904 100644 --- a/lib/git/util.py +++ b/lib/git/util.py @@ -296,6 +296,9 @@ class IterableList(list): def __init__(self, id_attr, prefix=''): self._id_attr = id_attr self._prefix = prefix + if not isinstance(id_attr, basestring): + raise ValueError("First parameter must be a string identifying the name-property. Extend the list after initialization") + # END help debugging ! def __getattr__(self, attr): attr = self._prefix + attr -- cgit v1.2.1 From 1687283c13caf7ff8d1959591541dff6a171ca1e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 17 Nov 2010 22:38:10 +0100 Subject: RootModule.update: initial implementation of update method, which should be able to handle submodule removals, additions, path changes and branch changes. All this still needs to be tested though --- lib/git/util.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/git/util.py') diff --git a/lib/git/util.py b/lib/git/util.py index b77e7904..b7446953 100644 --- a/lib/git/util.py +++ b/lib/git/util.py @@ -316,6 +316,14 @@ class IterableList(list): return getattr(self, index) except AttributeError: raise IndexError( "No item found with id %r" % (self._prefix + index) ) + + def __contains__(self, item): + try: + self[item] + return True + except IndexError: + return False + # END handle exception class Iterable(object): -- cgit v1.2.1 From 82849578e61a7dfb47fc76dcbe18b1e3b6a36951 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 18 Nov 2010 10:40:16 +0100 Subject: ORIG_HEAD handling is now implemented in the ref-class itself, instead of being a special case of the commit method; includes tests util: Fixed iterable lists, which broke due to an incorrectly implemented __contains__ method --- lib/git/util.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'lib/git/util.py') diff --git a/lib/git/util.py b/lib/git/util.py index b7446953..c945e6a3 100644 --- a/lib/git/util.py +++ b/lib/git/util.py @@ -317,14 +317,6 @@ class IterableList(list): except AttributeError: raise IndexError( "No item found with id %r" % (self._prefix + index) ) - def __contains__(self, item): - try: - self[item] - return True - except IndexError: - return False - # END handle exception - class Iterable(object): """Defines an interface for iterable items which is to assure a uniform -- cgit v1.2.1