Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix branch -N #1527

Closed
Closed

Conversation

adrianschroeter
Copy link
Member

Branching with missingok must not ask for existing package, it will lead to an error

Branching with missingok must not ask for existing package, it
will lead to an error
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 31.47%. Comparing base (7b73fde) to head (68e8ff4).
Report is 48 commits behind head on master.

Files Patch % Lines
osc/core.py 0.00% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1527      +/-   ##
==========================================
- Coverage   31.48%   31.47%   -0.01%     
==========================================
  Files         103      103              
  Lines       19072    19074       +2     
==========================================
  Hits         6004     6004              
- Misses      13068    13070       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dmach dmach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change needs rework or further explanation (maybe add comments to the code so it's more obvious at the first sight?)

Could you also propose several test cases? I can write them, I only need to know where to start.

@@ -6106,27 +6106,28 @@ def branch_pkg(
# BEGIN: Error out on branching scmsync packages; this should be properly handled in the API

# read src_package meta
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be moved with the code.

if devel_project:
raise oscerr.PackageError(devel_project, devel_package, msg)
raise oscerr.PackageError(src_project, src_package, msg)
if not missingok:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why we don't want to read devel project/package when missingok is on?
Don't we want to resolve the source project/package every time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-N is to prepare a new package for submission. It flags the _link file that the target is actually not there. So reading the meta from the target will always fail.

Copy link
Contributor

@dmach dmach Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this condition should be if not newinstance:

Also, shouldn't we explicitly turn off branching from the devel package when newinstance is set?

     query = {'cmd': 'branch'}
-    if nodevelproject:
+    if nodevelproject or newinstance:
+        # osc branch -N/--new-package should ignore devel project and always branch from the given package
         query['ignoredevel'] = '1'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it does not really matter as there could be no package definining a devel area. I would have kept the api call simple and not added that parameter in that situation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after some more discussion with Daniel I actually agree that ignoredevel makes sense when -Nis used in the situation when a new instance of a package is wanted in a hierachial project connected via project links (like SUSE:SLE-SP?: setups)

@glaubitz
Copy link
Contributor

glaubitz commented Apr 8, 2024

I assume this explains why osc bco -N no longer works, doesn't it?

@adrianschroeter
Copy link
Member Author

@glaubitz yes, indeed.

@dmach
Copy link
Contributor

dmach commented Apr 12, 2024

Closing in favor of #1535
That patch is less invasive and has tests (and I wrote it :-) )

@dmach dmach closed this Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants