Hi,
On Wed, Aug 16, 2017 at 09:31:35AM -0700, Chris Lamb wrote:
> tags 872351 + patch
> thanks
> 
> Patch attached.

Thanks! Can you update docs/manpages/gbp-pq{,-rpm}.sgml as well?
Cheers,
 -- Guido

> 
> 
> Regards,
> 
> -- 
>       ,''`.
>      : :'  :     Chris Lamb
>      `. `'`      la...@debian.org / chris-lamb.co.uk
>        `-

> diff --git a/gbp/config.py b/gbp/config.py
> index 3c484cd..aba0dcb 100644
> --- a/gbp/config.py
> +++ b/gbp/config.py
> @@ -101,7 +101,8 @@ class GbpOptionParser(OptionParser):
>      @cvar def_config_files: config files we parse
>      @type def_config_files: dict (type, path)
>      """
> -    defaults = {'allow-unauthenticated': 'False',
> +    defaults = {'abbrev': 7
> +                'allow-unauthenticated': 'False',
>                  'arch': '',
>                  'author-date-is-committer-date': 'False',
>                  'author-is-committer': 'False',
> @@ -343,6 +344,8 @@ class GbpOptionParser(OptionParser):
>          'drop':
>              "In case of 'export' drop the patch-queue branch "
>              "after export. Default is '%(drop)s'",
> +        'abbrev':
> +            "abbreviate commits to this length. default is '%(abbrev)s'",
>          'commit':
>              "commit changes after export, Default is '%(commit)s'",
>          'rollback':
> diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
> index e9502ea..cf98a6c 100644
> --- a/gbp/scripts/common/pq.py
> +++ b/gbp/scripts/common/pq.py
> @@ -185,7 +185,7 @@ def write_patch_file(filename, commit_info, diff):
>  DEFAULT_PATCH_NUM_PREFIX_FORMAT = "%04d-"
>  
>  
> -def format_patch(outdir, repo, commit_info, series, numbered=True,
> +def format_patch(outdir, repo, commit_info, series, abbrev, numbered=True,
>                   path_exclude_regex=None, topic='', name=None, 
> renumber=False,
>                   patch_num_prefix_format=DEFAULT_PATCH_NUM_PREFIX_FORMAT):
>      """Create patch of a single commit"""
> @@ -235,14 +235,14 @@ def format_patch(outdir, repo, commit_info, series, 
> numbered=True,
>      patch = None
>      if paths:
>          diff = repo.diff('%s^!' % commit_info['id'], paths=paths, stat=80,
> -                         summary=True, text=True, abbrev=7, renames=False)
> +                         summary=True, text=True, abbrev=abbrev, 
> renames=False)
>          patch = write_patch_file(filepath, commit_info, diff)
>          if patch:
>              series.append(patch)
>      return patch
>  
>  
> -def format_diff(outdir, filename, repo, start, end, path_exclude_regex=None):
> +def format_diff(outdir, filename, repo, start, end, abbrev, 
> path_exclude_regex=None):
>      """Create a patch of diff between two repository objects"""
>  
>      info = {'author': repo.get_author_info()}
> @@ -260,7 +260,7 @@ def format_diff(outdir, filename, repo, start, end, 
> path_exclude_regex=None):
>      paths = patch_path_filter(file_status, path_exclude_regex)
>      if paths:
>          diff = repo.diff(start, end, paths=paths, stat=80, summary=True,
> -                         text=True, abbrev=7, renames=False)
> +                         text=True, abbrev=abbrev, renames=False)
>          return write_patch_file(filename, info, diff)
>      return None
>  
> diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
> index 66a8d0d..8f7adb0 100755
> --- a/gbp/scripts/pq.py
> +++ b/gbp/scripts/pq.py
> @@ -98,7 +98,8 @@ def generate_patches(repo, start, end, outdir, options):
>              if 'topic' in cmds:
>                  topic = cmds['topic']
>              name = cmds.get('name', None)
> -            format_patch(outdir, repo, info, patches, options.patch_numbers,
> +            format_patch(outdir, repo, info, patches, options.abbrev,
> +                         numbered=options.patch_numbers,
>                           topic=topic, name=name,
>                           renumber=options.renumber,
>                           patch_num_prefix_format=options.patch_num_format)
> @@ -396,6 +397,7 @@ def build_parser(name):
>      parser.add_config_file_option(option_name="time-machine", 
> dest="time_machine", type="int")
>      parser.add_boolean_config_file_option("drop", dest='drop')
>      parser.add_boolean_config_file_option(option_name="commit", 
> dest="commit")
> +    parser.add_config_file_option(option_name="abbrev", dest="abbrev", 
> type="int")
>      parser.add_option("--force", dest="force", action="store_true", 
> default=False,
>                        help="in case of import even import if the branch 
> already exists")
>      parser.add_config_file_option(option_name="color", dest="color", 
> type='tristate')
> diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py
> index ebce7ff..9b7fb6a 100755
> --- a/gbp/scripts/pq_rpm.py
> +++ b/gbp/scripts/pq_rpm.py
> @@ -86,9 +86,9 @@ def generate_patches(repo, start, end, outdir, options):
>      merges = repo.get_commits(start, end_commit, options=['--merges'])
>      if merges:
>          # Shorten SHA1s
> -        start_sha1 = repo.rev_parse(start, short=7)
> -        merge_sha1 = repo.rev_parse(merges[0], short=7)
> -        patch_fn = format_diff(outdir, None, repo, start_sha1, merge_sha1)
> +        start_sha1 = repo.rev_parse(start, short=options.abbrev)
> +        merge_sha1 = repo.rev_parse(merges[0], short=options.abbrev)
> +        patch_fn = format_diff(outdir, None, repo, start_sha1, merge_sha1, 
> options.abbrev)
>          if patch_fn:
>              gbp.log.info("Merge commits found! Diff between %s..%s written "
>                           "into one monolithic diff" % (start_sha1, 
> merge_sha1))
> @@ -382,6 +382,7 @@ def build_parser(name):
>      parser.add_config_file_option(option_name="color-scheme",
>                                    dest="color_scheme")
>      parser.add_config_file_option(option_name="tmp-dir", dest="tmp_dir")
> +    parser.add_config_file_option(option_name="abbrev", dest="abbrev", 
> type="int")
>      parser.add_config_file_option(option_name="upstream-tag",
>                                    dest="upstream_tag")
>      parser.add_config_file_option(option_name="spec-file", dest="spec_file")

Reply via email to