pub fn build_marks<P: AsRef<Path>, S: ::std::hash::BuildHasher>(
    authors: Option<HashMap<String, String, S>>,
    hg_repo: P,
    git_repo: P,
    offset: Option<usize>,
    backup: bool,
) -> Result<(), ErrorKind> {
    let git_repo = GitTargetRepository::open(git_repo);
    let mut git_cmd = git_repo.git_cmd(&[
        "log",
        "--reflog",
        "--all",
        "--reverse",
        "--format=format:%H%n%at%n%an <%ae>",
    ]);
    let git_output = git_cmd.output()?;
    if !git_output.status.success() {
        return Err(ErrorKind::Target(TargetRepositoryError::GitFailure(
            git_output.status,
            "git log failed".into(),
        )));
    }

    let (git_repo_mapping, revlog) = load_git_revlog_lines(&git_output.stdout);

    let hg_repo = MercurialRepository::open(hg_repo)?;

    let marks_file = git_repo.path().join(".git/hg-git-fast-import.marks");

    if backup && marks_file.exists() {
        let now = SystemTime::now()
            .duration_since(UNIX_EPOCH)
            .unwrap()
            .as_secs();
        let backup_marks_file = marks_file.with_extension(format!("marks.backup.{}", now));
        eprintln!("Save backup to {}", backup_marks_file.to_string_lossy());
        copy(&marks_file, backup_marks_file)?;
    }

    let mut build_marks = BuildMarks {
        git_repo,
        marks_file,
        hg_repo,
        git_repo_mapping,
        revlog,
    };

    build_marks.process(authors, offset)
}
/// Build or update marks.
///
/// Useful if target Git repository was updated.
Build or update marks.
Useful if target Git repository was updated.
Build or update marks . Useful if target Git repository was updated .
pub fn build_marks<P: AsRef<Path>, S: ::std::hash::BuildHasher>(
    authors: Option<HashMap<String, String, S>>,
    hg_repo: P,
    git_repo: P,
    offset: Option<usize>,
    backup: bool,
) -> Result<(), ErrorKind> {
    let git_repo = GitTargetRepository::open(git_repo);
    let mut git_cmd = git_repo.git_cmd(&[
        "log",
        "--reflog",
        "--all",
        "--reverse",
        "--format=format:%H%n%at%n%an <%ae>",
    ]);
    let git_output = git_cmd.output()?;
    if !git_output.status.success() {
        return Err(ErrorKind::Target(TargetRepositoryError::GitFailure(
            git_output.status,
            "git log failed".into(),
        )));
    }
    let (git_repo_mapping, revlog) = load_git_revlog_lines(&git_output.stdout);
    let hg_repo = MercurialRepository::open(hg_repo)?;
    let marks_file = git_repo.path().join(".git/hg-git-fast-import.marks");
    if backup && marks_file.exists() {
        let now = SystemTime::now()
            .duration_since(UNIX_EPOCH)
            .unwrap()
            .as_secs();
        let backup_marks_file = marks_file.with_extension(format!("marks.backup.{}", now));
        eprintln!("Save backup to {}", backup_marks_file.to_string_lossy());
        copy(&marks_file, backup_marks_file)?;
    }
    let mut build_marks = BuildMarks {
        git_repo,
        marks_file,
        hg_repo,
        git_repo_mapping,
        revlog,
    };
    build_marks.process(authors, offset)
}
pub fn build_marks < P : AsRef < Path > , S : :: std :: hash :: BuildHasher > ( authors : Option < HashMap < String , String , S > > , hg_repo : P , git_repo : P , offset : Option < usize > , backup : bool , ) -> Result < ( ) , ErrorKind > { let git_repo = GitTargetRepository :: open ( git_repo ) ; let mut git_cmd = git_repo . git_cmd ( & [ " " , " " , " " , " " , " " , ] ) ; let git_output = git_cmd . output ( ) ? ; if ! git_output . status . success ( ) { return Err ( ErrorKind :: Target ( TargetRepositoryError :: GitFailure ( git_output . status , " " . into ( ) , ) ) ) ; } let ( git_repo_mapping , revlog ) = load_git_revlog_lines ( & git_output . stdout ) ; let hg_repo = MercurialRepository :: open ( hg_repo ) ? ; let marks_file = git_repo . path ( ) . join ( " " ) ; if backup && marks_file . exists ( ) { let now = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) ; let backup_marks_file = marks_file . with_extension ( format ! ( " " now ) ) ; eprintln ! ( " " backup_marks_file to_string_lossy ( ) ) ; copy ( & marks_file , backup_marks_file ) ? ; } let mut build_marks = BuildMarks { git_repo , marks_file , hg_repo , git_repo_mapping , revlog , } ; build_marks . process ( authors , offset ) }
Build or update marks.
Build or update marks .
authors
Option<HashMap<String, String, S>>
hg_repo
P
git_repo
P
offset
Option<usize>
backup
bool
authors
Option<HashMap<String, String, S>>
hg_repo
P
git_repo
P
offset
Option<usize>
backup
bool