Merge pull request #458 from cole-h/logging
{checkout,clone}: redirect output to /dev/null
This commit is contained in:
commit
a095c36668
|
@ -4,7 +4,7 @@ use std::ffi::{OsStr, OsString};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::Command;
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
pub struct CachedCloner {
|
pub struct CachedCloner {
|
||||||
root: PathBuf,
|
root: PathBuf,
|
||||||
|
@ -95,11 +95,13 @@ impl CachedProjectCo {
|
||||||
pub fn fetch_pr(&self, pr_id: u64) -> Result<(), Error> {
|
pub fn fetch_pr(&self, pr_id: u64) -> Result<(), Error> {
|
||||||
let mut lock = self.lock()?;
|
let mut lock = self.lock()?;
|
||||||
|
|
||||||
|
info!("Fetching PR #{}", pr_id);
|
||||||
let result = Command::new("git")
|
let result = Command::new("git")
|
||||||
.arg("fetch")
|
.arg("fetch")
|
||||||
.arg("origin")
|
.arg("origin")
|
||||||
.arg(format!("+refs/pull/{}/head:pr", pr_id))
|
.arg(format!("+refs/pull/{}/head:pr", pr_id))
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -114,12 +116,13 @@ impl CachedProjectCo {
|
||||||
pub fn commit_exists(&self, commit: &OsStr) -> bool {
|
pub fn commit_exists(&self, commit: &OsStr) -> bool {
|
||||||
let mut lock = self.lock().expect("Failed to lock");
|
let mut lock = self.lock().expect("Failed to lock");
|
||||||
|
|
||||||
|
info!("Checking if commit '{:?}' exists", commit);
|
||||||
let result = Command::new("git")
|
let result = Command::new("git")
|
||||||
.arg("--no-pager")
|
.arg("--no-pager")
|
||||||
.arg("show")
|
.arg("show")
|
||||||
.arg("--no-patch")
|
|
||||||
.arg(commit)
|
.arg(commit)
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()
|
.status()
|
||||||
.expect("git show <commit> failed");
|
.expect("git show <commit> failed");
|
||||||
|
|
||||||
|
@ -131,6 +134,7 @@ impl CachedProjectCo {
|
||||||
pub fn merge_commit(&self, commit: &OsStr) -> Result<(), Error> {
|
pub fn merge_commit(&self, commit: &OsStr) -> Result<(), Error> {
|
||||||
let mut lock = self.lock()?;
|
let mut lock = self.lock()?;
|
||||||
|
|
||||||
|
info!("Merging commit '{:?}'", commit);
|
||||||
let result = Command::new("git")
|
let result = Command::new("git")
|
||||||
.arg("merge")
|
.arg("merge")
|
||||||
.arg("--no-gpg-sign")
|
.arg("--no-gpg-sign")
|
||||||
|
@ -138,6 +142,7 @@ impl CachedProjectCo {
|
||||||
.arg("Automatic merge for GrahamCOfBorg")
|
.arg("Automatic merge for GrahamCOfBorg")
|
||||||
.arg(commit)
|
.arg(commit)
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
|
@ -4,7 +4,7 @@ use std::ffi::OsStr;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
pub struct Lock {
|
pub struct Lock {
|
||||||
lock: Option<fs::File>,
|
lock: Option<fs::File>,
|
||||||
|
@ -67,6 +67,7 @@ pub trait GitClonable {
|
||||||
.args(self.extra_clone_args())
|
.args(self.extra_clone_args())
|
||||||
.arg(&self.clone_from())
|
.arg(&self.clone_from())
|
||||||
.arg(&self.clone_to())
|
.arg(&self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -93,6 +94,7 @@ pub trait GitClonable {
|
||||||
.arg("fetch")
|
.arg("fetch")
|
||||||
.arg("origin")
|
.arg("origin")
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -112,6 +114,8 @@ pub trait GitClonable {
|
||||||
.arg("am")
|
.arg("am")
|
||||||
.arg("--abort")
|
.arg("--abort")
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
info!("git merge --abort");
|
info!("git merge --abort");
|
||||||
|
@ -119,6 +123,8 @@ pub trait GitClonable {
|
||||||
.arg("merge")
|
.arg("merge")
|
||||||
.arg("--abort")
|
.arg("--abort")
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
info!("git reset --hard");
|
info!("git reset --hard");
|
||||||
|
@ -126,6 +132,7 @@ pub trait GitClonable {
|
||||||
.arg("reset")
|
.arg("reset")
|
||||||
.arg("--hard")
|
.arg("--hard")
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -137,11 +144,11 @@ pub trait GitClonable {
|
||||||
let mut lock = self.lock()?;
|
let mut lock = self.lock()?;
|
||||||
|
|
||||||
debug!("git checkout {:?}", git_ref);
|
debug!("git checkout {:?}", git_ref);
|
||||||
|
|
||||||
let result = Command::new("git")
|
let result = Command::new("git")
|
||||||
.arg("checkout")
|
.arg("checkout")
|
||||||
.arg(git_ref)
|
.arg(git_ref)
|
||||||
.current_dir(self.clone_to())
|
.current_dir(self.clone_to())
|
||||||
|
.stdout(Stdio::null())
|
||||||
.status()?;
|
.status()?;
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
|
@ -544,13 +544,13 @@ pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remov
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"Labeling issue #{}: + {:?} , - {:?}, = {:?}",
|
"Labeling issue #{}: + {:?} , - {:?}, = {:?}",
|
||||||
issue.id, to_add, to_remove, existing
|
issue.number, to_add, to_remove, existing
|
||||||
);
|
);
|
||||||
|
|
||||||
l.add(to_add.clone()).unwrap_or_else(|e| {
|
l.add(to_add.clone()).unwrap_or_else(|e| {
|
||||||
panic!(
|
panic!(
|
||||||
"Failed to add labels {:?} to issue #{}: {:?}",
|
"Failed to add labels {:?} to issue #{}: {:?}",
|
||||||
to_add, issue.id, e
|
to_add, issue.number, e
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remov
|
||||||
l.remove(&label).unwrap_or_else(|e| {
|
l.remove(&label).unwrap_or_else(|e| {
|
||||||
panic!(
|
panic!(
|
||||||
"Failed to remove label {:?} from issue #{}: {:?}",
|
"Failed to remove label {:?} from issue #{}: {:?}",
|
||||||
label, issue.id, e
|
label, issue.number, e
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue