diff options
author | Jameson Miller <jamill@microsoft.com> | 2013-09-19 14:52:57 -0400 |
---|---|---|
committer | Jameson Miller <jamill@microsoft.com> | 2013-09-30 13:22:28 -0400 |
commit | b176ededb7d226ac85809b3ec594d185e7e3e866 (patch) | |
tree | f0ee8577697aa284cc98ab6ff6ad05b485c87c69 /include/git2/push.h | |
parent | 5b09db15d1041032c446f6141a9b41265fb253bc (diff) | |
download | libgit2-b176ededb7d226ac85809b3ec594d185e7e3e866.tar.gz |
Initial Implementation of progress reports during push
This adds the basics of progress reporting during push. While progress
for all aspects of a push operation are not reported with this change,
it lays the foundation to add these later. Push progress reporting
can be improved in the future - and consumers of the API should
just get more accurate information at that point.
The main areas where this is lacking are:
1) packbuilding progress: does not report progress during deltafication,
as this involves coordinating progress from multiple threads.
2) network progress: reports progress as objects and bytes are going
to be written to the subtransport (instead of as client gets
confirmation that they have been received by the server) and leaves
out some of the bytes that are transfered as part of the push protocol.
Basically, this reports the pack bytes that are written to the
subtransport. It does not report the bytes sent on the wire that
are received by the server. This should be a good estimate of
progress (and an improvement over no progress).
Diffstat (limited to 'include/git2/push.h')
-rw-r--r-- | include/git2/push.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/git2/push.h b/include/git2/push.h index ed6253afb..ecfd862d4 100644 --- a/include/git2/push.h +++ b/include/git2/push.h @@ -8,6 +8,7 @@ #define INCLUDE_git_push_h__ #include "common.h" +#include "pack.h" /** * @file git2/push.h @@ -38,6 +39,13 @@ typedef struct { #define GIT_PUSH_OPTIONS_VERSION 1 #define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION } +/** Push network progress notification function */ +typedef void (*git_push_transfer_progress)( + unsigned int current, + unsigned int total, + size_t bytes, + void* payload); + /** * Create a new push object * @@ -61,6 +69,27 @@ GIT_EXTERN(int) git_push_set_options( const git_push_options *opts); /** + * Set the callbacks for a push + * + * @param push The push object + * @param pack_progress_cb Function to call with progress information during + * pack building. Be aware that this is called inline with pack building + * operations, so performance may be affected. + * @param pack_progress_cb_payload Payload for the pack progress callback. + * @param transfer_progress_cb Function to call with progress information during + * the upload portion of a push. Be aware that this is called inline with + * pack building operations, so performance may be affected. + * @param transfer_progress_cb_payload Payload for the network progress callback. + * @return 0 or an error code + */ +GIT_EXTERN(int) git_push_set_callbacks( + git_push *push, + git_packbuilder_progress pack_progress_cb, + void *pack_progress_cb_payload, + git_push_transfer_progress transfer_progress_cb, + void *transfer_progress_cb_payload); + +/** * Add a refspec to be pushed * * @param push The push object |