~racb/git-ubuntu:fix-head-detection

Last commit made on 2020-05-01
Get this branch:
git clone -b fix-head-detection https://git.launchpad.net/~racb/git-ubuntu
Only Robie Basak can upload to this branch. If you are Robie Basak please log in for upload directions.

Branch merges

Branch information

Name:
fix-head-detection
Repository:
lp:~racb/git-ubuntu

Recent commits

93999c6... by Robie Basak

Fix Debian/Ubuntu HEAD branch detection

repo.references provides a list of pygit2.Reference objects, not strings
of their names. Just try the lookup method directly instead.

0f56f2f... by Robie Basak

Merge branch 'rich-history-preservation'

8d8c457... by Robie Basak

Make tagging hash-stable

Now that we have importer notes, adjust the created import tags so that
they are hash-stable.

This does not include applied tags, which will be made stable at a later
point.

04e2325... by Robie Basak

create_import_tag: use Pythonic object for commit

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.

680f237... by Robie Basak

Add signature support to repo_builder

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.

5bdc374... by Robie Basak

Add tagger support to create_tag()

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

f8c5029... by Robie Basak

Add rich history preservation

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%.

583cfba... by Robie Basak

Add repo_factory fixture

This is useful for tests that require multiple repo fixtures.

0a3e40a... by Robie Basak

Factor out datetime_to_signature_spec

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.

b94455f... by Robie Basak

Add importer notes

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.