Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98889c3

Browse files
committed
chore(misc): cleanup and docs
Minor adjustments to PR to match current code style.Related to#450
1 parentece57af commit98889c3

File tree

4 files changed

+25
-35
lines changed

4 files changed

+25
-35
lines changed

‎git/ext/gitdb

‎git/remote.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def add_progress(kwargs, git, progress):
5858

5959
#} END utilities
6060

61-
defprogress_object(progress):
61+
62+
defto_progress_instance(progress):
6263
"""Given the 'progress' return a suitable object derived from
6364
RemoteProgress().
6465
"""
@@ -552,9 +553,8 @@ def update(self, **kwargs):
552553
self.repo.git.remote(scmd,self.name,**kwargs)
553554
returnself
554555

555-
556556
def_get_fetch_info_from_stderr(self,proc,progress):
557-
progress=progress_object(progress)
557+
progress=to_progress_instance(progress)
558558

559559
# skip first line as it is some remote info we are not interested in
560560
output=IterableList('name')
@@ -610,7 +610,7 @@ def _get_fetch_info_from_stderr(self, proc, progress):
610610
returnoutput
611611

612612
def_get_push_info(self,proc,progress):
613-
progress=progress_object(progress)
613+
progress=to_progress_instance(progress)
614614

615615
# read progress information from stderr
616616
# we hope stdout can hold all the data, it should ...
@@ -715,26 +715,19 @@ def push(self, refspec=None, progress=None, **kwargs):
715715
716716
:param refspec: see 'fetch' method
717717
:param progress:
718-
If None, progress information will be discarded
719-
720-
No further progress information is returned after push returns.
721-
722-
A function (callable) that is called with the progress infomation:
723-
724-
progress( op_code, cur_count, max_count=None, message='' )
725-
726-
op_code is a bit mask of values defined in git.RemoteProgress
727-
728-
cur_count and max_count are float values.
729-
730-
max_count is None if there is no max_count
731-
732-
messages is '' if there is no additon message.
733-
734-
Deprecated: Pass in a class derived from git.RemoteProgres that
735-
overrides the update() function.
736-
737-
718+
Can take one of many value types:
719+
720+
* None to discard progress information
721+
* A function (callable) that is called with the progress infomation.
722+
723+
Signature: ``progress(op_code, cur_count, max_count=None, message='')``.
724+
725+
`Click here <http://goo.gl/NPa7st>`_ for a description of all arguments
726+
given to the function.
727+
* An instance of a class derived from ``git.RemoteProgress`` that
728+
overrides the ``update()`` function.
729+
730+
:note: No further progress information is returned after push returns.
738731
:param kwargs: Additional arguments to be passed to git-push
739732
:return:
740733
IterableList(PushInfo, ...) iterable list of PushInfo instances, each

‎git/repo/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
fromgit.remoteimport (
3434
Remote,
3535
add_progress,
36-
progress_object
36+
to_progress_instance
3737
)
3838

3939
fromgit.dbimportGitCmdObjectDB
@@ -873,7 +873,7 @@ def init(cls, path=None, mkdir=True, odbt=DefaultDBType, **kwargs):
873873

874874
@classmethod
875875
def_clone(cls,git,url,path,odb_default_type,progress,**kwargs):
876-
progress=progress_object(progress)
876+
progress=to_progress_instance(progress)
877877

878878
# special handling for windows for path at which the clone should be
879879
# created.

‎git/util.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,7 @@ class RemoteProgress(object):
179179
re_op_relative=re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)")
180180

181181
def__init__(self,progress_function=None):
182-
ifprogress_functionisnotNone:
183-
self.__progress_function=progress_function
184-
else:
185-
self.__progress_function=self.update
186-
182+
self.__progress_function=progress_functionifprogress_functionelseself.update
187183
self._seen_ops=list()
188184
self._cur_line=None
189185

@@ -273,9 +269,9 @@ def _parse_progress_line(self, line):
273269
message=message.strip(self.TOKEN_SEPARATOR)
274270

275271
self.__progress_function(op_code,
276-
cur_countandfloat(cur_count),
277-
max_countandfloat(max_count),
278-
message)
272+
cur_countandfloat(cur_count),
273+
max_countandfloat(max_count),
274+
message)
279275
# END for each sub line
280276
returnfailed_lines
281277

@@ -319,6 +315,7 @@ def update(self, op_code, cur_count, max_count=None, message=''):
319315
You may read the contents of the current line in self._cur_line"""
320316
pass
321317

318+
322319
classActor(object):
323320

324321
"""Actors hold information about a person acting on the repository. They

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp