summaryrefslogtreecommitdiff
path: root/morphlib/gitdir.py
Commit message (Collapse)AuthorAgeFilesLines
* Don't attempt to load symlinks as morphologiesRichard Maw2014-07-071-0/+10
| | | | | | | | | | | 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.
* Tweak some user-facing error messages in 'gitdir'Sam Thursfield2014-04-081-6/+8
| | | | | | | | | | | | | | | The default Python __repr__() is useless for both developers and users, so avoid using it in error messages. The following message: ERROR: Push to remote <morphlib.gitdir.Remote object at 0x905096c>, push url None with refspecs (<morphlib.gitdir.RefSpec object at 0xf72fec2c>,) failed with exit code 128 Becomes: ERROR: Push to remote "origin", push url None failed with exit code 128
* Stop using GitDirectory().list_files() to check for .gitfatAdam Coldrick2014-03-251-1/+1
| | | | | This function causes a UnicodeDecodeError for some repositories when building. Use os.path.isfile() when looking for .gitfat instead.
* Make existing morph commands use git-fatAdam Coldrick2014-03-201-0/+3
| | | | | | When cloning a repository, the files stored using git-fat need to be pulled. This situation occurs in `morph branch`, `morph edit`, and `morph checkout`.
* Add functionality for doing git commands in a directoryAdam Coldrick2014-03-201-2/+32
| | | | | | | | | | | | These commands are: * git fat <init|push|pull> * git pull They are required for the morph add-binary and push/pull plugins. Also make sure that GitDirectory is working in the root directory of the specified git repository, and add some helper functions for handling paths of files in the working tree.
* Fix `morph petrify` in cases where root repo URL has a trailing /Sam Thursfield2014-03-071-1/+2
| | | | | | | | | 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.
* deploy: Record deployment information in deployed systemSam Thursfield2014-03-041-1/+6
| | | | | | | | | | | | | | | | | | 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.
* GitDir: Add remote.push(RefSpec...)Richard Maw2013-11-221-0/+169
| | | | | | | | 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.
* GitDir: Add support for push urls in RemoteRichard Maw2013-11-221-7/+36
|
* GitDir: Split out Remote objectRichard Maw2013-11-221-14/+41
| | | | Operations on remotes are now accessed through this proxy object.
* GitDir: Add methods for ref managementRichard Maw2013-11-221-0/+123
|
* GitDir: Add GitDirectory.commit_tree() methodRichard Maw2013-11-221-0/+20
| | | | | This is used to create commit objects. This is used by build without commit to provide the behind-the-scenes history.
* GitDir: Add GitIndex classRichard Maw2013-11-221-32/+2
| | | | | | | | | | | | | | | 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.
* GitDir: add store_blob methodRichard Maw2013-11-221-0/+15
| | | | This is needed for making commits without touching the workspace.
* GitDir: Add resolve_ref_to_{commit,tree} methodsRichard Maw2013-11-221-5/+10
| | | | | | | | | | | | 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.
* GitDir: Provide more specific object access than cat-fileRichard Maw2013-11-221-3/+27
| | | | | | | We need to use cat-file for files by SHA1, commits by SHA1 and files by ref and path, so provide access in separate methods, since while it's all the same thing "under the hood", it avoids the user needing to know the command-line syntax.
* GitDir: Allow config values ending in whitespaceRichard Maw2013-11-221-2/+2
|
* GitDir: remove duplicate definition of update_remotesRichard Maw2013-11-221-4/+0
|
* gitdir: Add method for getting uncommitted changesRichard Maw2013-09-171-0/+32
| | | | | | | | | | 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.
* gitdir: add HEAD property to find the current branchRichard Maw2013-09-171-0/+5
| | | | | This is needed for status to tell if a repo is checked out in an unexpected branch.
* gitdir: Add methods to inspect contentsRichard Maw2013-09-051-0/+69
| | | | | | 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.
* Add GitDir.is_currently_checked_outLars Wirzenius2013-08-151-0/+17
| | | | | | | | | | | | | | | This is needed when we load morphologies in "morph edit": it needs to load things differently depending on whether we're loading from the currently checked out ref or not. The new method does not have a unit test, because I'm betting that the test would not find a real bug. The test would just set up a git repo and check whether the right ref is checked out in a couple of ways (it is, and it isn't), and the code is simple enough that it's unlikely to break the test. Creating the test, however, is a fair bit of work. What the test would not catch is when we need the method to do something quite different, but then we'll want a new method anyway.
* Add GitDirectory classLars Wirzenius2013-08-061-0/+131