Add debugging output in CreateHook
This commit is contained in:
parent
30c672821d
commit
79b0693fe8
1 changed files with 13 additions and 0 deletions
|
@ -82,24 +82,31 @@ impl StoreIdAccessor for CreateHook {
|
||||||
use vcs::git::config::commit_message;
|
use vcs::git::config::commit_message;
|
||||||
|
|
||||||
debug!("[GIT CREATE HOOK]: {:?}", id);
|
debug!("[GIT CREATE HOOK]: {:?}", id);
|
||||||
|
|
||||||
|
debug!("[GIT CREATE HOOK]: Ensuring branch checkout");
|
||||||
try!(self
|
try!(self
|
||||||
.runtime
|
.runtime
|
||||||
.ensure_cfg_branch_is_checked_out()
|
.ensure_cfg_branch_is_checked_out()
|
||||||
.map_err(Box::new)
|
.map_err(Box::new)
|
||||||
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e)));
|
.map_err(|e| HEK::HookExecutionError.into_error_with_cause(e)));
|
||||||
|
debug!("[GIT CREATE HOOK]: Branch checked out");
|
||||||
|
|
||||||
self.runtime
|
self.runtime
|
||||||
.config_value_or_err()
|
.config_value_or_err()
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't get Value object from config"); e })
|
||||||
.and_then(|cfg| {
|
.and_then(|cfg| {
|
||||||
|
debug!("[GIT CREATE HOOK]: Getting repository");
|
||||||
self.runtime
|
self.runtime
|
||||||
.repository()
|
.repository()
|
||||||
.map(|r| (r, cfg))
|
.map(|r| (r, cfg))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't fetch Repository"); e })
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
})
|
})
|
||||||
.and_then(|(repo, cfg)| {
|
.and_then(|(repo, cfg)| {
|
||||||
repo.signature()
|
repo.signature()
|
||||||
.map(|s| (repo, cfg, s))
|
.map(|s| (repo, cfg, s))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't fetch Signature"); e })
|
||||||
.map_err_into(GHEK::RepositorySignatureFetchingError)
|
.map_err_into(GHEK::RepositorySignatureFetchingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
@ -107,6 +114,7 @@ impl StoreIdAccessor for CreateHook {
|
||||||
.and_then(|(repo, cfg, sig)| {
|
.and_then(|(repo, cfg, sig)| {
|
||||||
repo.index()
|
repo.index()
|
||||||
.map(|idx| (repo, cfg, sig, idx))
|
.map(|idx| (repo, cfg, sig, idx))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't fetch Index"); e })
|
||||||
.map_err_into(GHEK::RepositoryIndexFetchingError)
|
.map_err_into(GHEK::RepositoryIndexFetchingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
@ -114,6 +122,7 @@ impl StoreIdAccessor for CreateHook {
|
||||||
.and_then(|(repo, cfg, sig, mut idx)| {
|
.and_then(|(repo, cfg, sig, mut idx)| {
|
||||||
idx.add_path(id)
|
idx.add_path(id)
|
||||||
.map(|_| (repo, cfg, sig, idx))
|
.map(|_| (repo, cfg, sig, idx))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't add Path"); e })
|
||||||
.map_err_into(GHEK::RepositoryPathAddingError)
|
.map_err_into(GHEK::RepositoryPathAddingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
@ -121,6 +130,7 @@ impl StoreIdAccessor for CreateHook {
|
||||||
.and_then(|(repo, cfg, sig, mut idx)| {
|
.and_then(|(repo, cfg, sig, mut idx)| {
|
||||||
idx.write_tree()
|
idx.write_tree()
|
||||||
.map(|oid| (repo, cfg, sig, idx, oid))
|
.map(|oid| (repo, cfg, sig, idx, oid))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't write Tree"); e })
|
||||||
.map_err_into(GHEK::RepositoryTreeWritingError)
|
.map_err_into(GHEK::RepositoryTreeWritingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
@ -128,6 +138,7 @@ impl StoreIdAccessor for CreateHook {
|
||||||
.and_then(|(repo, cfg, sig, idx, oid)| {
|
.and_then(|(repo, cfg, sig, idx, oid)| {
|
||||||
repo.find_tree(oid)
|
repo.find_tree(oid)
|
||||||
.map(|tree| (repo, cfg, sig, idx, oid, tree))
|
.map(|tree| (repo, cfg, sig, idx, oid, tree))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't find Tree"); e })
|
||||||
.map_err_into(GHEK::RepositoryTreeFindingError)
|
.map_err_into(GHEK::RepositoryTreeFindingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
@ -136,12 +147,14 @@ impl StoreIdAccessor for CreateHook {
|
||||||
let cmtmsg = commit_message(cfg, StoreAction::Create);
|
let cmtmsg = commit_message(cfg, StoreAction::Create);
|
||||||
repo.find_commit(oid)
|
repo.find_commit(oid)
|
||||||
.map(|cmt| (repo, sig, tree, cmt, cmtmsg))
|
.map(|cmt| (repo, sig, tree, cmt, cmtmsg))
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't find Commit"); e })
|
||||||
.map_err_into(GHEK::RepositoryCommitFindingError)
|
.map_err_into(GHEK::RepositoryCommitFindingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
})
|
})
|
||||||
.and_then(|(repo, sig, tree, cmt, commitmsg)| {
|
.and_then(|(repo, sig, tree, cmt, commitmsg)| {
|
||||||
repo.commit(Some("HEAD"), &sig, &sig, &commitmsg[..], &tree, &[&cmt])
|
repo.commit(Some("HEAD"), &sig, &sig, &commitmsg[..], &tree, &[&cmt])
|
||||||
|
.map_err(|e| { debug!("[GIT CREATE HOOK]: Couldn't create Commit"); e })
|
||||||
.map_err_into(GHEK::RepositoryCommittingError)
|
.map_err_into(GHEK::RepositoryCommittingError)
|
||||||
.map_err_into(GHEK::RepositoryError)
|
.map_err_into(GHEK::RepositoryError)
|
||||||
.map_err(|e| e.into())
|
.map_err(|e| e.into())
|
||||||
|
|
Loading…
Reference in a new issue