From f9e7a3d93da741f81a5af2e84422376c54f1f337 Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Wed, 15 Apr 2015 12:42:41 -0500 Subject: fix(util): Handle 'Finding sources' messages in RemoteProgress When running a long running operation (such as a clone on a large repo), Git may return a message indicating that it is 'Finding sources'. Since there is no bit field value for this message, this causes a large amount of error messages to be emitted to stderr. This patch fixes this by adding another bit field value for this message, FINDING_SOURCES. Derived classes can look for this op_code and handle it appropriately. --- git/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 1147cb53..547da093 100644 --- a/git/util.py +++ b/git/util.py @@ -165,7 +165,7 @@ class RemoteProgress(object): and git-fetch and to dispatch callbacks allowing subclasses to react to the progress. """ _num_op_codes = 7 - BEGIN, END, COUNTING, COMPRESSING, WRITING, RECEIVING, RESOLVING = [1 << x for x in range(_num_op_codes)] + BEGIN, END, COUNTING, COMPRESSING, WRITING, RECEIVING, RESOLVING, FINDING_SOURCES = [1 << x for x in range(_num_op_codes)] STAGE_MASK = BEGIN | END OP_MASK = ~STAGE_MASK @@ -227,6 +227,8 @@ class RemoteProgress(object): op_code |= self.RECEIVING elif op_name == 'Resolving deltas': op_code |= self.RESOLVING + elif op_name == 'Finding sources': + op_code |= self.FINDING_SOURCES else: # Note: On windows it can happen that partial lines are sent # Hence we get something like "CompreReceiving objects", which is -- cgit v1.2.1 From 6d83f44007c5c581eae7ddc6c5de33311b7c1895 Mon Sep 17 00:00:00 2001 From: Matt Jordan Date: Wed, 15 Apr 2015 16:15:10 -0500 Subject: fix(util): Correct number of op codes The previous patch failed to update the expected number of op_codes, which would result in an exception when creating an instance of RemoteProgress. This patch corrects the value to the new expected number of op_codes (8) --- git/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 547da093..ec605b0b 100644 --- a/git/util.py +++ b/git/util.py @@ -164,7 +164,7 @@ class RemoteProgress(object): Handler providing an interface to parse progress information emitted by git-push and git-fetch and to dispatch callbacks allowing subclasses to react to the progress. """ - _num_op_codes = 7 + _num_op_codes = 8 BEGIN, END, COUNTING, COMPRESSING, WRITING, RECEIVING, RESOLVING, FINDING_SOURCES = [1 << x for x in range(_num_op_codes)] STAGE_MASK = BEGIN | END OP_MASK = ~STAGE_MASK -- cgit v1.2.1 From b89b089972b5bac824ac3de67b8a02097e7e95d7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 16 Apr 2015 09:09:26 +0200 Subject: fix(indent): flake-8 happyness --- git/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index ec605b0b..fb459da1 100644 --- a/git/util.py +++ b/git/util.py @@ -165,7 +165,8 @@ class RemoteProgress(object): and git-fetch and to dispatch callbacks allowing subclasses to react to the progress. """ _num_op_codes = 8 - BEGIN, END, COUNTING, COMPRESSING, WRITING, RECEIVING, RESOLVING, FINDING_SOURCES = [1 << x for x in range(_num_op_codes)] + BEGIN, END, COUNTING, COMPRESSING, WRITING, RECEIVING, RESOLVING, FINDING_SOURCES = \ + [1 << x for x in range(_num_op_codes)] STAGE_MASK = BEGIN | END OP_MASK = ~STAGE_MASK -- cgit v1.2.1