| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test suite was failing in my Baserock 15.19 chroot with:
FAILURE: test_commit_tree (gitdir_tests.GitDirectoryContentsTests)
Traceback (most recent call last):
File "morphlib/gitdir_tests.py", line 294, in test_commit_tree
self.assertEqual(expected,
gd.get_commit_contents(commit).split('\n'))
AssertionError: Lists differ: ['tree 01d830ae9bae1a9970a9f14... !=
['tree 01d830ae9bae1a9970a9f14...
First differing element 2:
author Author Name <author@email> 683074800 +0000
author Author Name <author@email> 683074800 +0100
['tree 01d830ae9bae1a9970a9f1491c914ad177f8afce',
'parent 1240834484cebc4ba8cc40cd5b76f6dffd937a50',
- 'author Author Name <author@email> 683074800 +0000',
? ^
+ 'author Author Name <author@email> 683074800 +0100',
? ^
- 'committer Committer Name <committer@email> 683074800 +0000',
? ^
+ 'committer Committer Name <committer@email> 683074800 +0100',
? ^
'',
'MESSAGE',
'']
1 failures, 0 errors
1543 excluded statements
57 excluded modules
Time: 8.4 s
Change-Id: If03e7ccbb5e3415eead9dcbcf908d3d2717e8fe0
|
|
|
|
|
|
|
|
|
|
| |
We use 'git config' format config files outside Git repos, so it's
useful to have a helper class independent of the GitDirectory class.
This allows us to use it in the sysbranchdir.open() function to remove
a hack.
Change-Id: Ifa5e87f404d10666c98b9469079b7925d16becf6
|
|
|
|
| |
Change-Id: Ic6e613c21ed26c528ad7c75f41af01d7552729fd
|
|
|
|
| |
Change-Id: I992dc0c1d40f563ade56a833162d409b02be90a0
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This consolidates a bunch of code paths that were previously duplicated.
This also changes the API for local cached repos to match the
function names GitDirectory uses. Note that the remote repo cache still
uses the old names, and should be fixed when time permits.
Some unit tests that use the CachedRepo module required a bit of
inelegant monkey-patching in order that they continue to work. A better
way to do this would be with the 'mock' library (which would need to be
added to Baserock 'build' and 'devel' systems before we could use it).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, creating a GitDirectory object for something that wasn't a
Git repository would succeed, but most operations would raise a
cliapp.AppException with the following error message:
ERROR: Command failed: git config -z core.bare
Now, the constructor will raise a NoGitRepoError if the directory isn't
a Git repo, which (unless handled) gives the user the following sort of
message:
ERROR: Directory /src/ws/definitions is not a Git repository
|
|\
| |
| |
| |
| | |
Reviewed-By: Pedro Alvarez <pedro.alvarez@codethink.co.uk>
Reviewed-By: Adam Coldrick <adam.coldrick@codethink.co.uk>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The GitDirectory() constructor, if passed a 'dirname' that doesn't
contain a '.git' subdirectory, can search upwards to find the real root
of the repository. This is used by the `add-binary`, `push`, and `pull`
commands.
This causes very confusing behaviour in the case that 'dirname' points to
a directory that should be a Git repository, but isn't, and that directory
is a path inside the working tree of another Git repository. Rather than
raising an error, in this case the GitDirectory class would perform
operations on a different repository to the one the caller expected.
This 'search_for_root' behaviour is now opt-in, to avoid confusion.
|
|/
|
|
|
| |
This allows checking if a ref exists without requiring the caller
to use a try:, except: block.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We assumed that the sha1 of the tree of the commit of the ref we care
about was sufficient to cache, but `git replace` means that you need to
know the state of other branches too, since anything in refs/replace can
completely change what the tree you check-out is.
This behaviour can be disabled globally by setting
GIT_NO_REPLACE_OBJECTS, so we're going to do that.
If we need to integrate a project that uses git-replace to change the
contents of their git trees then we could support that by:
if any(refs/replace/*):
potentially_replacable_objects = [
`git rev-parse HEAD`,
`git rev-parse HEAD^{commit}`,
`git rev-parse HEAD^{tree}`]
potentially_replacable_objects.extend(
`git ls-tree -r HEAD | awk '{print $3}'`)
# NOTE: doesn't handle submodules, and you'd need to expand this
# set whenever you process a replacement
for object in refs/replace/*:
if basename(object) not in potentially_replacable_objects: continue
cache_key['replacements'][basename(object)] = `git rev-parse $object`
If we were to support this would need to traverse the tree anyway, doing
replacements, so we may as well use libgit to do the checkout anyway,
and list which replacements were used.
However, since the expected use-case of `git replace` is as a better way
to do history grafting, we're unlikely to need it, as it would only have
any effect if it replaced the commit we were using with a different one.
Rubber-stamped-by: Daniel Silverstone
|
|
|
|
|
|
|
|
|
|
|
| |
This was noticed because our definitions.git had a dangling symlink,
so it failed to construct the temporary build branch.
We shouldn't process symlinks as morphologies either, since either we
make symlinked morphologies a first-class behaviour, and validate that
the link points inside the repository, which is a lot of work for
something we don't and probably won't need; or we can just assume that
we deal with the morphology this is linked to correctly anyway.
|
|
|
|
|
|
|
|
|
| |
gitdir._list_work_tree_files() needs to use os.relpath() instead of
direct string manipulation to avoid chopping off the first line of
every filename in cases where the base gitdir path string includes the
trailing /.
Unit test updated to catch this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces a new requirement: USERS MUST NOT HAVE SENSITIVE
DATA IN THEIR ENVIRONMENT. Otherwise it will be leaked into the system.
Note that configuration fields with 'PASSWORD' in their name are
stripped before writing the /baserock/deployment.meta file, so the
OpenStack OS_PASSWORD field is not leaked.
We want this so that we can run hooks at upgrade-time in the future.
These hooks might need to know how the system was configured and what
releaseuu it was. I'm not quite sure how we will define 'release' yet,
but by using `git tag` and `git describe` we are able to textually label
a time period in the history of the system's source code. We already
have the specific SHA1 of definitions.git stored in the system metadata,
so this should give us enough to be able to implement specific hooks
that work around any awkward upgrade complications we encounter in the
future.
|
|
|
|
|
|
|
|
| |
Remotes have a push method, which takes multiple RefSpecs, runs git push
using arguments derived from the set of refspecs, then returns the
push's result.
If it fails the push, it will return the result in the exception.
|
| |
|
|
|
|
| |
Operations on remotes are now accessed through this proxy object.
|
| |
|
|
|
|
|
| |
This is used to create commit objects. This is used by build without
commit to provide the behind-the-scenes history.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This represents the state of the index of a GitDirectory.
Methods that use the index are now used via the GitIndex class, rather
than using the default index, as previously used when the methods were
in GitDirectory.
GitIndex may be constructed with an alternative path, which can be used
to manipulate a git checkout without altering a developer's view of the
repository i.e. The working tree and default index.
This is needed for `morph build` and `morph deploy` to handle the build
without commit logic.
|
|
|
|
| |
This is needed for making commits without touching the workspace.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some APIs should take SHA1 object IDs, there needs to be a way to get
one from a ref. To handle this, we add APIs for getting either the
commit or the tree pointed to by the ref.
Commits are provided because we need to create commits from
existing commits and update refs from existing values.
Trees are provided because we need trees to create commits, and we can
read trees into the index to eventually create another tree.
|
|
|
|
|
|
|
|
|
|
| |
get_uncommitted_changes() is needed for morph status to tell if git
repositories have changes in them.
_get_status() is private, since it does not currently have a user, the
small amount of code in get_uncommitted_changes() wrapping _get_status()
is in the GitDirectory class instead of the branch and merge plugin,
since `morph build` will also need to know about uncommitted changes.
|
|
|
|
|
| |
This is needed for status to tell if a repo is checked out in an
unexpected branch.
|
|
|
|
|
|
| |
This adds methods to list and read files. The difference between doing
this to a commit and the currrent working tree is abstracted over by
whether the passed ref is None or omitted.
|
|
|