~racb/git-ubuntu:escape-git

Last commit made on 2017-11-21
Get this branch:
git clone -b escape-git 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:
escape-git
Repository:
lp:~racb/git-ubuntu

Recent commits

7e79017... by Robie Basak

Add .git escaping

If a source package unpacks to contain any files or directories named
'.git', it cannot be represented in a git repository as-is because the
name '.git' is reserved by git and git will not permit it to be an entry
in a git tree object.

Instead we losslessly escape these names by prepending a '.' recursively.

See discussion thread at
http://lists.alioth.debian.org/pipermail/vcs-pkg-discuss/2017-May/000976.html
(continuing into June).

LP: #1730778

54c9b42... by Robie Basak

Add .git escaping functions

ba12ad6... by Robie Basak

GitUbuntuRepository instantiation without lp_user

Instead of raising an exception immediately if lp_user cannot be
determined at instantiation time of GitUbuntuRepository, proceed with
_lp_user set to None.

The associated lp_user attribute getter will raise a RuntimeError if
_lp_user isn't set.

Other methods that use lp_user will check _lp_user first and raise a
more specific RuntimeError if _lp_user isn't set.

We can have confidence that this doesn't introduce a regression since
there should not be any code path which could proceed before without
successfully instantiating a GitUbuntuRepository. All this change does
is defer that exception (that must not have been happening in successful
use cases previously).

This allows for easier testability since we can now instantiate a
GitUbuntuRepository in tests without having to make sure that lp_user is
set first.

88e50a8... by Robie Basak

Add repo fixture

a095a43... by Robie Basak

repo -> pygit2_repo

"repo" logically should mean a GitUbuntuRepository as that's what's
under test, so distinguish pygit2_repo as a separate thing.

707cd1b... by Robie Basak

Import test target as 'target'

This saves having to import everything I want to test individually or
use a really long fully qualified name for everything.

e5d0781... by Robie Basak

Do not import local Launchpad object

This is a workaround for LP 1733388. It stops py.test-3 poking the
object's __getattr__ during test discovery, which currently results in a
hang as it prompts the user to log in to Launchpad but the prompt gets
hidden. And we don't want network communication during test discovery
anyway.

b1551b1... by Robie Basak

Initial tests for _devel_branch_updates

8a605fe... by Robie Basak

Adjust head_versions structure

Let's simplify this a little. Instead of containing a pygit2.Reference,
resolve it to a commit hash string first to simplify testing.

While I'm there, as we only need two elements, just use a two-tuple for
the dictionary values.

f060cc4... by Robie Basak

Factor out and rework _devel_branch_updates

Move the core functionality into _devel_branch_updates, making
update_devel_branches a thin wrapper to it. _devel_branch_updates now
has no dependencies so should be easier to test.

Rename namespace, applied_prefix to ref_prefix. _devel_branch_updates
can be simplified by collapsing namespace and applied_prefix into a
single concept ref_prefix.

Move printing to wrapper function. Really the inner function should do
computation only and leave it to the caller to report warnings etc. This
will prevent noise when under test.

_devel_branch_updates returns None for commit hashes, in which case the
intention is that the caller will suppress setting those refs but will
be able to note which refs are not being set. This is useful to maintain
reporting.

The debug and warning messages are now slightly changed since less
information is available one level up the stack. It should still be
sufficient for debugging or warning purposes.