openSUSE / osc

The Command Line Interface to work with an Open Build Service
http://openbuildservice.org/
GNU General Public License v2.0
170 stars 185 forks source link

osc commands with revision ignore revision setting #1457

Open ggardet opened 10 months ago

ggardet commented 10 months ago

Describe the bug osc commands with revision are broken since it ignores revision setting. For example:

osc copypac -r 110 hardware:boot raspberrypi-firmware-dt home:Guillaume_G:test

returns a copy of the current revision instead of revision 110. Another one is submitting an older revision:

 osc sr -r 110 "hardware:boot"  raspberrypi-firmware-dt "hardware:boot" -m"revert to rev110 - boo#1217512"

which returns:

Server returned an error: HTTP Error 400: Bad Request
The request contains no actions. Submit requests without source changes may have skipped!

Versions

To Reproduce Try one of the commands above, or similar.

Expected behavior We should be able to checkout, copy or submit older revisions.

Screenshots, console outputs N/A

Additional context N/A

dmach commented 9 months ago

I'm afraid I'm unable to reproduce the behavior. I used the latest osc from master, but that shouldn't be that far from 1.5.0.

Here's what I tried:

git clone https://github.com/openSUSE/osc.git
cd osc/behave
./container-pull.sh
./container-run.sh

# username is Admin
# password is opensuse

copypac -r 1 test:factory test-pkgA home:Admin
>>> Sending meta data...
>>> Copying files...
>>> <revision rev="1" vrev="1">
>>> ...
>>>  <comment>osc copypac from project:test:factory package:test-pkgA revision:1</comment>
>>> ...

osc -A https://localhost:1443 cat test:factory test-pkgA test-pkgA.spec
>>> Version: 1  - corresponds with revision 1

osc -A https://localhost:1443 sr -r 1 test:factory test-pkgA test:factory -m "revert to rev 1" --nodevelproject
# --nodevelproject is important, otherwise osc attempts to submit the request from the devel project instead
>>> created request id 1

osc -A https://localhost:1443 rq show 1 --diff
>>> -Version:        3
>>> +Version:        1
adrianschroeter commented 9 months ago

The behaviour is most likely correct, but surprising. The reason is that the old revision of the unexpanded source contains a link to latest source revision of the package in openSUSE:Factory.

However, we should make it possible at least to copy the old sources merged as they were on commit time.

So we may add an option like

osc copypac --expand-rev=110 ...

which then would make the api call with

..&expand&orev=110&olinkrev=base

It would result in an expanded copy without a link. So the user would need to specify the target on "osc sr".

The alternative would be to do the copy like we do today, but modifing the _link file afterwards to reference to the link target old revision.