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

clone: Fetch the upstream remote specified in debian/upstream/metadata #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iainlane
Copy link

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.

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
@3v1n0
Copy link
Contributor

3v1n0 commented Mar 10, 2020

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?

@iainlane
Copy link
Author

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",
Copy link
Owner

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
Copy link
Owner

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)?

Copy link
Author

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?

Copy link
Owner

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)

@agx
Copy link
Owner

agx commented Mar 30, 2020

Thanks! This looks useful, we just need to get the defaults/options right.

@agx
Copy link
Owner

agx commented May 28, 2022

This would still be great to have in case you want to give it a respin @iainlane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants