Skip to main content

FileLog

Struct FileLog 

Source
pub struct FileLog<L = Unselected, H = Unselected> { /* private fields */ }
Expand description

Print detailed information about the revisions of files.

The L type parameter tracks the changelist description output at compile time: Self::full_description transitions to the FullDescription state and Self::truncated_description transitions to the TruncatedDescription state. The H type parameter tracks whether file content history is displayed: Self::content_history transitions to the DisplayContentHistory state.

Implementations§

Source§

impl FileLog<Unselected, Unselected>

Source

pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self

Creates a new p4 filelog command.

bin is the path to the Perforce command-line executable.

Source§

impl<H: ExclusiveOption> FileLog<Unselected, H>

Source

pub fn full_description(self) -> FileLog<FullDescription, H>

§Description

-l

List long output, with the full text of each changelist description.

Transitions this command to the FullDescription state.

Examples found in repository?
examples/filelog.rs (line 44)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source

pub fn truncated_description(self) -> FileLog<TruncatedDescription, H>

§Description

-L

List long output, with the full text of each changelist description truncated at 250 characters.

Transitions this command to the TruncatedDescription state.

Source§

impl<L: ExclusiveOption> FileLog<L, Unselected>

Source

pub fn content_history(self) -> FileLog<L, DisplayContentHistory>

§Description

-h

Display file content history instead of file name history.

Transitions this command to the DisplayContentHistory state, which unlocks the -p option.

Examples found in repository?
examples/filelog.rs (line 55)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source§

impl<L: ExclusiveOption, H: ExclusiveOption> FileLog<L, H>

Source

pub fn get_bin(&self) -> &Path

Get the Perforce command path.

Source

pub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self

Set the Perforce command path.

Source

pub fn bin(self, bin: impl Into<PathBuf>) -> Self

Set the Perforce command path.

Source

pub fn get_global_opts(&self) -> &GlobalOpts

§Description

g-opts

See Global options.

Source

pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self

§Description

g-opts

See Global options.

Source

pub fn global_opts(self, v: GlobalOpts) -> Self

§Description

g-opts

See Global options.

Source

pub fn get_changelist(&self) -> Option<&String>

§Description

-c change

Display only files submitted at the specified changelist number.

Source

pub fn set_changelist(&mut self, v: impl Into<String>) -> &mut Self

§Description

-c change

Display only files submitted at the specified changelist number.

Source

pub fn changelist(self, v: impl Into<String>) -> Self

§Description

-c change

Display only files submitted at the specified changelist number.

Examples found in repository?
examples/filelog.rs (line 57)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source

pub fn get_follow_branches(&self) -> bool

§Description

-i

Follow file history across branches.

Source

pub fn set_follow_branches(&mut self, v: bool) -> &mut Self

§Description

-i

Follow file history across branches.

Source

pub fn follow_branches(self, v: bool) -> Self

§Description

-i

Follow file history across branches.

Examples found in repository?
examples/filelog.rs (line 32)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source

pub fn get_limit(&self) -> Option<u64>

§Description

-m max

List only the first max changes per file output.

Source

pub fn set_limit(&mut self, v: u64) -> &mut Self

§Description

-m max

List only the first max changes per file output.

Source

pub fn limit(self, v: u64) -> Self

§Description

-m max

List only the first max changes per file output.

Examples found in repository?
examples/filelog.rs (line 34)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source

pub fn get_ignore_non_contributory(&self) -> bool

§Description

-s

Display a shortened form of output by ignoring non-contributory integrations.

Source

pub fn set_ignore_non_contributory(&mut self, v: bool) -> &mut Self

§Description

-s

Display a shortened form of output by ignoring non-contributory integrations.

Source

pub fn ignore_non_contributory(self, v: bool) -> Self

§Description

-s

Display a shortened form of output by ignoring non-contributory integrations.

Source

pub fn get_include_time(&self) -> bool

§Description

-t

Display the time as well as the date.

Source

pub fn set_include_time(&mut self, v: bool) -> &mut Self

§Description

-t

Display the time as well as the date.

Source

pub fn include_time(self, v: bool) -> Self

§Description

-t

Display the time as well as the date.

Examples found in repository?
examples/filelog.rs (line 33)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}
Source§

impl<L: ExclusiveOption> FileLog<L, DisplayContentHistory>

Source

pub fn get_skip_promoted_tasks(&self) -> bool

§Description

-p

When used with the -h option, do not follow content of promoted task streams.

Source

pub fn set_skip_promoted_tasks(&mut self, v: bool) -> &mut Self

§Description

-p

When used with the -h option, do not follow content of promoted task streams.

Source

pub fn skip_promoted_tasks(self, v: bool) -> Self

§Description

-p

When used with the -h option, do not follow content of promoted task streams.

Examples found in repository?
examples/filelog.rs (line 56)
24fn main() -> std::io::Result<()> {
25    let p4 = P4Cli::default();
26
27    // Revision history for every file under //depot/project: follow the file
28    // history across branches (`-i`), display the time as well as the date
29    // (`-t`), and list only the first 10 changes per file (`-m 10`).
30    let mut filelog = p4
31        .filelog()
32        .follow_branches(true)
33        .include_time(true)
34        .limit(10);
35
36    let files = [OsStr::new("//depot/project/...")];
37    let output = filelog.output(&files)?;
38    println!("{}", String::from_utf8_lossy(&output.stdout));
39
40    // Long output: `full_description()` transitions the command into the
41    // `FullDescription` state (`-l`), printing the full text of each
42    // changelist description. A revision range limits the listed revisions,
43    // e.g. changelists 100 through 120.
44    let mut long_log = p4.filelog().full_description();
45
46    let output = long_log.output(&["//depot/project/main.c@100,@120"])?;
47    println!("{}", String::from_utf8_lossy(&output.stdout));
48
49    // Content history: `content_history()` transitions the command into the
50    // `DisplayContentHistory` state (`-h`), which unlocks `-p` to skip the
51    // content of promoted task streams. Only revisions submitted at
52    // changelist 4321 are displayed (`-c 4321`).
53    let mut history = p4
54        .filelog()
55        .content_history()
56        .skip_promoted_tasks(true)
57        .changelist("4321");
58
59    let mut child = history.spawn_with((&files,))?;
60    child.wait()?;
61
62    Ok(())
63}

Trait Implementations§

Source§

impl<L: Clone, H: Clone> Clone for FileLog<L, H>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<L: Debug, H: Debug> Debug for FileLog<L, H>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<L: Default, H: Default> Default for FileLog<L, H>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<L: ExclusiveOption, H: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for FileLog<L, H>
where S: IntoIterator<Item = I>, I: AsRef<OsStr>,

Source§

fn spawn_with(&mut self, (files): (S,)) -> Result<Self::Output, Self::Error>

Spawns p4 filelog for the given files as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

At least one file or file pattern must be provided.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<L: ExclusiveOption, H: ExclusiveOption> SubCommand for FileLog<L, H>

Source§

fn name(&self) -> &str

Source§

fn inject_local_args(&self, command: &mut Command)

Source§

fn global_opts(&self) -> Option<&GlobalOpts>

Source§

fn inject_args(&self, command: &mut Command)

Source§

fn setup_command<S: AsRef<OsStr>>(&self, bin: S) -> Command

Auto Trait Implementations§

§

impl<L, H> Freeze for FileLog<L, H>
where H: Freeze, L: Freeze,

§

impl<L, H> RefUnwindSafe for FileLog<L, H>

§

impl<L, H> Send for FileLog<L, H>
where H: Send, L: Send,

§

impl<L, H> Sync for FileLog<L, H>
where H: Sync, L: Sync,

§

impl<L, H> Unpin for FileLog<L, H>
where H: Unpin, L: Unpin,

§

impl<L, H> UnsafeUnpin for FileLog<L, H>
where H: UnsafeUnpin, L: UnsafeUnpin,

§

impl<L, H> UnwindSafe for FileLog<L, H>
where H: UnwindSafe, L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, T1> OutputExt1<T1> for T
where T: SpawnExt1<T1, Output = Child, Error = Error>,

Source§

fn output( &mut self, a: T1, ) -> Result<Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T, I> ParameterizedOutput<I> for T
where T: ParameterizedSpawn<I, Output = Child, Error = Error>,

Source§

type Error = Error

Source§

fn output_with( &mut self, input: I, ) -> Result<Output, <T as ParameterizedOutput<I>>::Error>

Source§

impl<T, T1> SpawnExt1<T1> for T

Source§

fn spawn( &mut self, a: T1, ) -> Result<<T as ParameterizedSpawn<(T1,)>>::Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.