1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-12 23:56:13 +01:00

Allow to cat/less files from deleted packages

This commit is contained in:
Adrian Schröter 2017-06-24 14:25:05 +02:00
parent 2f4792b56d
commit a8612f4ecc
3 changed files with 11 additions and 4 deletions

1
NEWS
View File

@ -5,6 +5,7 @@
- "osc build -M ..": fixed behaviour of falvoured builds
- added switch to show only issues in rdiff
- show build duration in build history
- allow to cat/less files from deleted packages (using -D option)
0.158
- cat/less/blame command: default to expand to stay in sync with checkout

View File

@ -7964,6 +7964,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='(default) force expansion of linked packages.')
@cmdln.option('-u', '--unexpand', action='store_true',
help='always work with unexpanded packages.')
@cmdln.option('-D', '--deleted', action='store_true',
help='access file in a deleted package')
@cmdln.option('-M', '--meta', action='store_true',
help='list meta data files')
@cmdln.alias('blame')
@ -8017,10 +8019,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
query['view'] = "blame"
if opts.meta:
query['meta'] = 1
if opts.deleted:
query['deleted'] = 1
if opts.revision:
query['rev'] = opts.revision
if not opts.unexpand:
query['rev'] = show_upstream_srcmd5(apiurl, project, package, expand=True, revision=opts.revision, meta=opts.meta)
query['rev'] = show_upstream_srcmd5(apiurl, project, package, expand=True, revision=opts.revision, meta=opts.meta, deleted=opts.deleted)
query['expand'] = 1 # important for blame case to follow links in old revisions
u = makeurl(apiurl, ['source', project, package, filename], query=query)
if subcmd == 'less':

View File

@ -3743,7 +3743,7 @@ def edit_meta(metatype,
f.sync()
def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None, linkrepair=False, meta=False):
def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None, linkrepair=False, meta=False, deleted=False):
query = {}
if revision:
query['rev'] = revision
@ -3755,6 +3755,8 @@ def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None,
query['linkrev'] = 'base'
if meta:
query['meta'] = 1
if deleted:
query['deleted'] = 1
if expand:
query['expand'] = 1
if linkrepair:
@ -3762,8 +3764,8 @@ def show_files_meta(apiurl, prj, pac, revision=None, expand=False, linkrev=None,
f = http_GET(makeurl(apiurl, ['source', prj, pac], query=query))
return f.read()
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False, include_service_files=False):
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision, meta=meta)
def show_upstream_srcmd5(apiurl, prj, pac, expand=False, revision=None, meta=False, include_service_files=False, deleted=False):
m = show_files_meta(apiurl, prj, pac, expand=expand, revision=revision, meta=meta, deleted=deleted)
et = ET.fromstring(''.join(m))
if include_service_files:
try: