-
Notifications
You must be signed in to change notification settings - Fork 67
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
clone: Fetch the upstream remote specified in debian/upstream/metadata
#70
base: master
Are you sure you want to change the base?
Conversation
This avoids a step if the workflow involves using `--upstream-vcs-tag`. Overridable with the --upstream-remote configuration option. Set this to the empty string to disable cloning. Closes: #888313
2beca9f
to
3366533
Compare
Shouldn't we also make import-orig (when not using a git ref) to automatically fetch the tag from the upstream remote if not available yet? |
That sounds like a good idea! I might get to work on that but if I don’t get to it in time the lack of that shouldn’t block this PR hopefully (it could be a followup). |
"If debian/upstream/metadata specifies an upstream git repository, " | ||
"the remote name to fetch it into, default is " | ||
"'%(upstream-remote)s'. Set to an empty string to disable cloning " | ||
"upstream", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Set to an empty string to disable cloning "upstream"
it'd rather do a default is ...
as with most of the other options.
except KeyError: | ||
pass | ||
except FileNotFoundError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could that go into a function? Also we don't have a way to fail cloning if no upstream remote exists or when cloning fails. I'd expect things to fail if that feature is enabled otherwise things become hard to use in scripts. Maybe we need a separate option to enable adding upstream
with [yes|no|auto] (the later meaning add upstream if metadata exists)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thing is we can't know from debian/upstream/metadata
whether it is a git repository, a Mercurial one, SVN or anything else. So here I just try to clone it and don't really further interpret the failure since it could be "expected". Could log a debug message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do heuristics then: So for --clone-upstream=auto :
- if it's salsa: git
- if it ends in .git: git
- if it's gitlab.com or github.com: git
if cloning fails we give an error. If it does not match the pattern ignore the error (and print a warning). We could go further and make this configurable (similar to what we have for gbp create-remote-repo). For
--clone-upstream=yes` we always try to clone and fail if cloning fails.
And plesse add a code comment that points to the bug that says we need to be clearer on metadata (i think i saw this flying by)
Thanks! This looks useful, we just need to get the defaults/options right. |
This would still be great to have in case you want to give it a respin @iainlane |
This avoids a step if the workflow involves using --upstream-vcs-tag.
Overridable with the --upstream-remote configuration option. Set this to
the empty string to disable cloning.