-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move 'assume yes' cli option under individual content commands, added cli delete/remove option, scaffolded functionality for this * make cache settings of get_subfolders configurable * CLI info + logic * refactored wiki history management, more tests * fix history * utils refactored, redirects handling, tests * added dangling references check to delete * cleanup * move git code and nits * fix history * nit * rename --------- Co-authored-by: Florian Dieminger <[email protected]>
- Loading branch information
Showing
15 changed files
with
791 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[env] | ||
TESTING_CONTENT_ROOT = { value = "tests/data/content/files", relative = true } | ||
TESTING_CONTENT_TRANSLATED_ROOT = { value = "tests/data/translated_content/files", relative = true } | ||
TESTING_CACHE_CONTENT = "0" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use std::ffi::OsStr; | ||
use std::path::Path; | ||
use std::process::{Command, Output}; | ||
|
||
/// Run `git` with `args` wiht `root` as current directory. | ||
/// For tests this will run the first arg as command, eg.: | ||
/// Instead of `git mv foo bar` -> `mv foo bar`. | ||
pub fn exec_git_with_test_fallback(args: &[impl AsRef<OsStr>], root: impl AsRef<Path>) -> Output { | ||
let git = OsStr::new("git"); | ||
let echo = OsStr::new("echo"); | ||
|
||
let (command, args) = if cfg!(test) { | ||
( | ||
args.first().map(AsRef::as_ref).unwrap_or(echo), | ||
&args[if args.is_empty() { 0 } else { 1 }..], | ||
) | ||
} else { | ||
(git, args) | ||
}; | ||
exec_git_internal(command, args, root) | ||
} | ||
|
||
pub fn exec_git(args: &[impl AsRef<OsStr>], root: impl AsRef<Path>) -> Output { | ||
let output = Command::new("git") | ||
.args(args) | ||
.current_dir(root) | ||
.output() | ||
.expect("failed to execute process"); | ||
output | ||
} | ||
|
||
fn exec_git_internal( | ||
command: impl AsRef<OsStr>, | ||
args: &[impl AsRef<OsStr>], | ||
root: impl AsRef<Path>, | ||
) -> Output { | ||
let output = Command::new(command) | ||
.args(args) | ||
.current_dir(root) | ||
.output() | ||
.expect("failed to execute process"); | ||
output | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
pub mod error; | ||
pub mod git; | ||
pub mod history; | ||
pub mod r#move; | ||
pub mod popularities; | ||
pub mod redirects; | ||
pub mod remove; | ||
#[cfg(test)] | ||
pub mod tests; | ||
mod utils; | ||
pub mod wikihistory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.