We intend to move the imported repositories to a separate Launchpad team
whose only member will be the importer bot. This will break existing
users' pkg remote URLs, since they currently have ~usd-import-team
hardcoded.
Instead, change behaviour so that "git clone" will configure the "pkg"
remote to the URL for the default repository for a package only. We will
ensure out-of-band that the default repository is pointed correctly for
all imported packages.
Then when the default repository changes as expected, users who used
"git ubuntu clone" after this change will not be affected; they will
seamlessly access the new repository location at the Launchpad end.
The GitUbuntuRepository.add_base_remotes() is currently only called from
two places: once from importer.py, and once from clone.py. We want the
importer to always use an explicit owner, but clone not to do so in
order that the default is used in that case. It just so happens that the
call from importer.py already always specifies repo_owner, and clone.py
already does not, so the callers are already doing what we need and do
not need to be adjusted.
Expect the caller to provide a pygit2.Commit object instead of a commit
hash string. We're moving to this as a standard, and in addition this
will allow the implementation to more directly examine the commit which
will be needed for tag hash stability.
For testing purposes we will need to specify particular committer,
author and tagger signatures in test commits and tags, so add support
for this to repo_builder.
We'd like to be able to specify the tagger precisely to enable hash
stability for tags. This adds the tagger parameter to create_tag() to
permit this to happen.
It is easiest to switch to the pygit2 create_tag() implementation
instead of calling the git CLI, so this relatively trivial conversion is
done at the same time. The existing tests should be sufficient to ensure
that this doesn't break anything, but a unit test is also added.
Note that the behaviour is slightly changed: before, the tagger used was
not defined, and in practice was using the name and email from git's
configuration together with the current time as inferred by git. Now
we're using a standard name and email address by default, and looking up
the current time ourselves (timezone-aware and based on the
system-configured timezone).
Add a new facility to permit rich history to be preserved across
reimports (when using "git ubuntu import --reimport"). Previous rich
history is exported to a temporary directory prior to the reimport.
During import, the rich history importer is then given the opportunity
to reconstruct an upload tag "just in time" before it is used.
Testing the importer end-to-end for this is not currently practical
since we have no tests for the --reimport function at all. We have
pragmatically concluded that it is sufficient to functionally test the
new rich history code, since --reimport will generally only be used with
manual supervision and the likely bugs in the importer code itself are
that rich history preservation won't work at all, or the importer will
fail entirely, and so will be easily noticed.
I have also added some limited additional tests to bring coverage of the
new gitubuntu.rich_history up to 100%.
This moves the implementation of the conversion from datetime.datetime
into parameters suitable for the pygit2.Signature constructor into its
own function for future reuse. This also allows for better unit testing.
Importer notes are generic notes about the import that, by being stored
as a git note, won't affect the resulting commit hashes. This allows
them to be a relatively free form place where we can store information
about the import that happened. For now, we'll put the timestamp of the
import itself and the git-ubuntu version used in the importer note.
Using importer notes allows us to move this information away from tags
so that tags can then be adjusted to be hash-stable.
There is no need for implementation in "git ubuntu clone" as these notes
are for diagnostic purposes only so need not be fetched by users by
default.