diff options
Diffstat (limited to 'git')
m--------- | git/ext/gitdb | 0 | ||||
-rw-r--r-- | git/remote.py | 41 | ||||
-rw-r--r-- | git/repo/base.py | 4 | ||||
-rw-r--r-- | git/util.py | 13 |
4 files changed, 24 insertions, 34 deletions
diff --git a/git/ext/gitdb b/git/ext/gitdb -Subproject 2389b75280efb1a63e6ea578eae7f897fd4beb1 +Subproject d1996e04dbf4841b853b60c1365f0f5fd28d170 diff --git a/git/remote.py b/git/remote.py index 0afb4ad3..946d0165 100644 --- a/git/remote.py +++ b/git/remote.py @@ -58,7 +58,8 @@ def add_progress(kwargs, git, progress): #} END utilities -def progress_object(progress): + +def to_progress_instance(progress): """Given the 'progress' return a suitable object derived from RemoteProgress(). """ @@ -552,9 +553,8 @@ class Remote(LazyMixin, Iterable): self.repo.git.remote(scmd, self.name, **kwargs) return self - def _get_fetch_info_from_stderr(self, proc, progress): - progress = progress_object(progress) + progress = to_progress_instance(progress) # skip first line as it is some remote info we are not interested in output = IterableList('name') @@ -610,7 +610,7 @@ class Remote(LazyMixin, Iterable): return output def _get_push_info(self, proc, progress): - progress = progress_object(progress) + progress = to_progress_instance(progress) # read progress information from stderr # we hope stdout can hold all the data, it should ... @@ -715,26 +715,19 @@ class Remote(LazyMixin, Iterable): :param refspec: see 'fetch' method :param progress: - If None, progress information will be discarded - - No further progress information is returned after push returns. - - A function (callable) that is called with the progress infomation: - - progress( op_code, cur_count, max_count=None, message='' ) - - op_code is a bit mask of values defined in git.RemoteProgress - - cur_count and max_count are float values. - - max_count is None if there is no max_count - - messages is '' if there is no additon message. - - Deprecated: Pass in a class derived from git.RemoteProgres that - overrides the update() function. - - + Can take one of many value types: + + * None to discard progress information + * A function (callable) that is called with the progress infomation. + + Signature: ``progress(op_code, cur_count, max_count=None, message='')``. + + `Click here <http://goo.gl/NPa7st>`_ for a description of all arguments + given to the function. + * An instance of a class derived from ``git.RemoteProgress`` that + overrides the ``update()`` function. + + :note: No further progress information is returned after push returns. :param kwargs: Additional arguments to be passed to git-push :return: IterableList(PushInfo, ...) iterable list of PushInfo instances, each diff --git a/git/repo/base.py b/git/repo/base.py index 9ba2b1d2..f43cc462 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -33,7 +33,7 @@ from git.config import GitConfigParser from git.remote import ( Remote, add_progress, - progress_object + to_progress_instance ) from git.db import GitCmdObjectDB @@ -873,7 +873,7 @@ class Repo(object): @classmethod def _clone(cls, git, url, path, odb_default_type, progress, **kwargs): - progress = progress_object(progress) + progress = to_progress_instance(progress) # special handling for windows for path at which the clone should be # created. diff --git a/git/util.py b/git/util.py index 9b86b191..021018d1 100644 --- a/git/util.py +++ b/git/util.py @@ -179,11 +179,7 @@ class RemoteProgress(object): re_op_relative = re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") def __init__(self, progress_function=None): - if progress_function is not None: - self.__progress_function = progress_function - else: - self.__progress_function = self.update - + self.__progress_function = progress_function if progress_function else self.update self._seen_ops = list() self._cur_line = None @@ -273,9 +269,9 @@ class RemoteProgress(object): message = message.strip(self.TOKEN_SEPARATOR) self.__progress_function(op_code, - cur_count and float(cur_count), - max_count and float(max_count), - message) + cur_count and float(cur_count), + max_count and float(max_count), + message) # END for each sub line return failed_lines @@ -319,6 +315,7 @@ class RemoteProgress(object): You may read the contents of the current line in self._cur_line""" pass + class Actor(object): """Actors hold information about a person acting on the repository. They |