1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-22 21:16:16 +01:00

Expand links when checking out a single file.

Prior to this change, `osc co PROJECT' and `osc co PROJECT PACKAGE'
would both follow links, but `osc co PROJECT PACKAGE FILE' would not.

To make matters even more confusing, `osc ls PROJECT PACKAGE FILE'
does follow links - so, for linked files, an `ls' would tell you a file
exists, then `co' would give a 404 error.

This change fixes the inconsistency.
This commit is contained in:
Rohan McGovern 2010-12-30 11:31:28 +10:00 committed by Adrian Schröter
parent 06e285130b
commit 2d5b853aa0

View File

@ -2886,6 +2886,22 @@ Please submit there instead, or use --nodevelproject to force direct submission.
sys.exit(1)
if filename:
link_seen = False
# Note: this logic should follow the `osc ls' logic
if expand_link:
l = meta_get_filelist(apiurl,
project,
package,
expand=False,
revision=rev)
link_seen = '_link' in l
if link_seen:
m = show_files_meta(apiurl, project, package)
li = Linkinfo()
li.read(ET.fromstring(''.join(m)).find('linkinfo'))
if li.haserror():
raise oscerr.LinkExpandError(project, package, li.error)
project, package, rev = li.project, li.package, li.rev
get_source_file(apiurl, project, package, filename, revision=rev, progress_obj=self.download_progress)
elif package: