Attached is a patch against HEAD to enable an optional compression level when using --compress. Tested on NetBSD, running against both same version and stock 2.6.3 on the remote end, over ssh. This uses the "feature" that popt will ignore option arguments it isn't requested to parse. eg. Older rsyncs will happily run with the option "--compress=1". Note, to support the syntax "--compress 1" (ie, space separated), a patch to popt is required, available from https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=71147
Created attachment 1517 [details] rsync compression level patch
The problem with using an optional arg with popt is that a following option (e.g. "--compress -v") treats the following option as the arg to --compress (which seems to be what your popt patch fixes). Since we want to support using a shared popt library, that means that optional args can't be used. Also, your changes to batch.c created an incompatible batch-file format. To remain compatible, you need to make sure that the existing 0 and 1 values in batch files continue to mean what 0 and -1 mean in your patch.
Created attachment 1520 [details] My version of adding optional compression-level selection Here's a patch that should accomplish the same thing, while avoiding the problems I mentioned above.
The --compress-level option was committed to CVS.
I've tested the changes, which were actually very similar to my first pass at a patch which we've been using for almost a year on production systems (rsyncing live Oracle databases between continents). I decided against the --compress-level option as it breaks if rsync is too old on the other end, and I was trying to allow older versions to skip the option transparently. Regardless, so long as the ability to change the compression ability is allowed, I don't mind how it is implemented. Thanks!