From bde873c52914b40377a12764cab926ee974c3f32 Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Wed, 24 Feb 2010 20:50:23 +0800 Subject: fetch: refactor verbosity option handling into transport.[ch] transport_set_verbosity() is now provided to transport users. Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- transport.h | 1 + 1 file changed, 1 insertion(+) (limited to 'transport.h') diff --git a/transport.h b/transport.h index 7cea5cc723..7d1a0b6b36 100644 --- a/transport.h +++ b/transport.h @@ -122,6 +122,7 @@ struct transport *transport_get(struct remote *, const char *); **/ int transport_set_option(struct transport *transport, const char *name, const char *value); +void transport_set_verbosity(struct transport *transport, int verbosity); int transport_push(struct transport *connection, int refspec_nr, const char **refspec, int flags, -- cgit v1.2.3 From 8afd8dc065c54d3c8d8e0397506aa99261703414 Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Wed, 24 Feb 2010 20:50:24 +0800 Subject: push: support multiple levels of verbosity Remove the flags TRANSPORT_PUSH_QUIET and TRANSPORT_PUSH_VERBOSE; use transport->verbose instead to determine verbosity for pushing. Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- transport.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'transport.h') diff --git a/transport.h b/transport.h index 7d1a0b6b36..c0743b1086 100644 --- a/transport.h +++ b/transport.h @@ -88,9 +88,7 @@ struct transport { #define TRANSPORT_PUSH_FORCE 2 #define TRANSPORT_PUSH_DRY_RUN 4 #define TRANSPORT_PUSH_MIRROR 8 -#define TRANSPORT_PUSH_VERBOSE 16 #define TRANSPORT_PUSH_PORCELAIN 32 -#define TRANSPORT_PUSH_QUIET 64 #define TRANSPORT_PUSH_SET_UPSTREAM 128 /* Returns a transport suitable for the url */ -- cgit v1.2.3 From d01b3c02e8a066054c308ee2ce521a2ea44738d3 Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Wed, 24 Feb 2010 20:50:26 +0800 Subject: transport->progress: use flag authoritatively Set transport->progress in transport.c::transport_set_verbosity() after checking for the appropriate conditions (eg. --progress, isatty(2)), and thereafter use it without having to check again. The rules used are as follows (processing aborts when a rule is satisfied): 1. Report progress, if force_progress is 1 (ie. --progress). 2. Don't report progress, if verbosity < 0 (ie. -q/--quiet). 3. Report progress if isatty(2) is 1. This changes progress reporting behaviour such that if both --progress and --quiet are specified, progress is reported. In two areas, the logic to determine whether to *not* show progress is changed to simply use the negation of transport->progress. This changes behaviour in some ways (see previous paragraph for details). Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- transport.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'transport.h') diff --git a/transport.h b/transport.h index c0743b1086..de2745a6ed 100644 --- a/transport.h +++ b/transport.h @@ -74,7 +74,12 @@ struct transport { int (*disconnect)(struct transport *connection); char *pack_lockfile; signed verbose : 3; - /* Force progress even if stderr is not a tty */ + /** + * Transports should not set this directly, and should use this + * value without having to check isatty(2), -q/--quiet + * (transport->verbose < 0), etc. - checking has already been done + * in transport_set_verbosity(). + **/ unsigned progress : 1; /* * If transport is at least potentially smart, this points to @@ -120,7 +125,8 @@ struct transport *transport_get(struct remote *, const char *); **/ int transport_set_option(struct transport *transport, const char *name, const char *value); -void transport_set_verbosity(struct transport *transport, int verbosity); +void transport_set_verbosity(struct transport *transport, int verbosity, + int force_progress); int transport_push(struct transport *connection, int refspec_nr, const char **refspec, int flags, -- cgit v1.2.3 From 212cfe157effe53537ec42f156fbf7415441efd0 Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Wed, 24 Feb 2010 20:50:29 +0800 Subject: transport: update flags to be in running order Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- transport.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'transport.h') diff --git a/transport.h b/transport.h index de2745a6ed..d9bbabba0c 100644 --- a/transport.h +++ b/transport.h @@ -93,8 +93,8 @@ struct transport { #define TRANSPORT_PUSH_FORCE 2 #define TRANSPORT_PUSH_DRY_RUN 4 #define TRANSPORT_PUSH_MIRROR 8 -#define TRANSPORT_PUSH_PORCELAIN 32 -#define TRANSPORT_PUSH_SET_UPSTREAM 128 +#define TRANSPORT_PUSH_PORCELAIN 16 +#define TRANSPORT_PUSH_SET_UPSTREAM 32 /* Returns a transport suitable for the url */ struct transport *transport_get(struct remote *, const char *); -- cgit v1.2.3