Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/ofborg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 83d748169c2d
Choose a base ref
...
head repository: NixOS/ofborg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a095c366688d
Choose a head ref
  • 3 commits
  • 3 files changed
  • 2 contributors

Commits on Apr 9, 2020

  1. {checkout,clone}: redirect output to /dev/null

    It fills the logs with typically-useless information. We don't really
    care about the novels people write in their commit messages.
    
    The only `git` commands that were left unmodified are the ones where we
    use their output in some way (and thus, it isn't printed to stdout/err
    anyways).
    cole-h committed Apr 9, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    cole-h Cole Helbling
    Copy the full SHA
    db19020 View commit details
  2. tasks/evaluate: show issue number not id

    The `id` field is not the GitHub PR or issue number; the `number` field
    is.
    cole-h committed Apr 9, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    cole-h Cole Helbling
    Copy the full SHA
    b33d3de View commit details
  3. Merge pull request #458 from cole-h/logging

    {checkout,clone}: redirect output to /dev/null
    grahamc authored Apr 9, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a095c36 View commit details
Showing with 19 additions and 7 deletions.
  1. +7 −2 ofborg/src/checkout.rs
  2. +9 −2 ofborg/src/clone.rs
  3. +3 −3 ofborg/src/tasks/evaluate.rs
9 changes: 7 additions & 2 deletions ofborg/src/checkout.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use std::ffi::{OsStr, OsString};
use std::fs;
use std::io::{Error, ErrorKind};
use std::path::{Path, PathBuf};
use std::process::Command;
use std::process::{Command, Stdio};

pub struct CachedCloner {
root: PathBuf,
@@ -95,11 +95,13 @@ impl CachedProjectCo {
pub fn fetch_pr(&self, pr_id: u64) -> Result<(), Error> {
let mut lock = self.lock()?;

info!("Fetching PR #{}", pr_id);
let result = Command::new("git")
.arg("fetch")
.arg("origin")
.arg(format!("+refs/pull/{}/head:pr", pr_id))
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
@@ -114,12 +116,13 @@ impl CachedProjectCo {
pub fn commit_exists(&self, commit: &OsStr) -> bool {
let mut lock = self.lock().expect("Failed to lock");

info!("Checking if commit '{:?}' exists", commit);
let result = Command::new("git")
.arg("--no-pager")
.arg("show")
.arg("--no-patch")
.arg(commit)
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()
.expect("git show <commit> failed");

@@ -131,13 +134,15 @@ impl CachedProjectCo {
pub fn merge_commit(&self, commit: &OsStr) -> Result<(), Error> {
let mut lock = self.lock()?;

info!("Merging commit '{:?}'", commit);
let result = Command::new("git")
.arg("merge")
.arg("--no-gpg-sign")
.arg("-m")
.arg("Automatic merge for GrahamCOfBorg")
.arg(commit)
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
11 changes: 9 additions & 2 deletions ofborg/src/clone.rs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ use std::ffi::OsStr;
use std::fs;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use std::process::Command;
use std::process::{Command, Stdio};

pub struct Lock {
lock: Option<fs::File>,
@@ -67,6 +67,7 @@ pub trait GitClonable {
.args(self.extra_clone_args())
.arg(&self.clone_from())
.arg(&self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
@@ -93,6 +94,7 @@ pub trait GitClonable {
.arg("fetch")
.arg("origin")
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
@@ -112,20 +114,25 @@ pub trait GitClonable {
.arg("am")
.arg("--abort")
.current_dir(self.clone_to())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()?;

info!("git merge --abort");
Command::new("git")
.arg("merge")
.arg("--abort")
.current_dir(self.clone_to())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()?;

info!("git reset --hard");
Command::new("git")
.arg("reset")
.arg("--hard")
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
@@ -137,11 +144,11 @@ pub trait GitClonable {
let mut lock = self.lock()?;

debug!("git checkout {:?}", git_ref);

let result = Command::new("git")
.arg("checkout")
.arg(git_ref)
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();
6 changes: 3 additions & 3 deletions ofborg/src/tasks/evaluate.rs
Original file line number Diff line number Diff line change
@@ -544,21 +544,21 @@ pub fn update_labels(issueref: &hubcaps::issues::IssueRef, add: &[String], remov

info!(
"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| {
panic!(
"Failed to add labels {:?} to issue #{}: {:?}",
to_add, issue.id, e
to_add, issue.number, e
)
});

for label in to_remove {
l.remove(&label).unwrap_or_else(|e| {
panic!(
"Failed to remove label {:?} from issue #{}: {:?}",
label, issue.id, e
label, issue.number, e
)
});
}