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>
impl FileLog<Unselected, Unselected>
Sourcepub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
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>
impl<H: ExclusiveOption> FileLog<Unselected, H>
Sourcepub fn full_description(self) -> FileLog<FullDescription, H>
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?
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}Sourcepub fn truncated_description(self) -> FileLog<TruncatedDescription, H>
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>
impl<L: ExclusiveOption> FileLog<L, Unselected>
Sourcepub fn content_history(self) -> FileLog<L, DisplayContentHistory>
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?
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>
impl<L: ExclusiveOption, H: ExclusiveOption> FileLog<L, H>
Sourcepub fn get_global_opts(&self) -> &GlobalOpts
pub fn get_global_opts(&self) -> &GlobalOpts
Sourcepub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
Sourcepub fn global_opts(self, v: GlobalOpts) -> Self
pub fn global_opts(self, v: GlobalOpts) -> Self
Sourcepub fn get_changelist(&self) -> Option<&String>
pub fn get_changelist(&self) -> Option<&String>
Sourcepub fn set_changelist(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_changelist(&mut self, v: impl Into<String>) -> &mut Self
Sourcepub fn changelist(self, v: impl Into<String>) -> Self
pub fn changelist(self, v: impl Into<String>) -> Self
Examples found in repository?
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}Sourcepub fn get_follow_branches(&self) -> bool
pub fn get_follow_branches(&self) -> bool
Sourcepub fn set_follow_branches(&mut self, v: bool) -> &mut Self
pub fn set_follow_branches(&mut self, v: bool) -> &mut Self
Sourcepub fn follow_branches(self, v: bool) -> Self
pub fn follow_branches(self, v: bool) -> Self
Examples found in repository?
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}Sourcepub fn limit(self, v: u64) -> Self
pub fn limit(self, v: u64) -> Self
Examples found in repository?
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}Sourcepub fn get_ignore_non_contributory(&self) -> bool
pub fn get_ignore_non_contributory(&self) -> bool
Sourcepub fn set_ignore_non_contributory(&mut self, v: bool) -> &mut Self
pub fn set_ignore_non_contributory(&mut self, v: bool) -> &mut Self
Sourcepub fn ignore_non_contributory(self, v: bool) -> Self
pub fn ignore_non_contributory(self, v: bool) -> Self
Sourcepub fn get_include_time(&self) -> bool
pub fn get_include_time(&self) -> bool
Sourcepub fn set_include_time(&mut self, v: bool) -> &mut Self
pub fn set_include_time(&mut self, v: bool) -> &mut Self
Sourcepub fn include_time(self, v: bool) -> Self
pub fn include_time(self, v: bool) -> Self
Examples found in repository?
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>
impl<L: ExclusiveOption> FileLog<L, DisplayContentHistory>
Sourcepub fn get_skip_promoted_tasks(&self) -> bool
pub fn get_skip_promoted_tasks(&self) -> bool
Sourcepub fn set_skip_promoted_tasks(&mut self, v: bool) -> &mut Self
pub fn set_skip_promoted_tasks(&mut self, v: bool) -> &mut Self
Sourcepub fn skip_promoted_tasks(self, v: bool) -> Self
pub fn skip_promoted_tasks(self, v: bool) -> Self
Examples found in repository?
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: ExclusiveOption, H: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for FileLog<L, H>
impl<L: ExclusiveOption, H: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for FileLog<L, H>
Source§fn spawn_with(&mut self, (files): (S,)) -> Result<Self::Output, Self::Error>
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.