pub struct Diff2<M = Unselected> { /* private fields */ }Expand description
p4 [g-opts] diff2 [-doptions] [-Od -q -t -u] file1[rev] file2[rev]
p4 [g-opts] diff2 [-doptions] [-Od -q -t -u] -b branch [[fromfile[rev]] tofile[rev]]
p4 [g-opts] diff2 [-doptions] [-Od -q -t -u] [-S stream] [-P parent] [[fromfile[rev]] tofile[rev]]
p4 [g-opts] diff2 [-doptions] -As streamname1[@change1] streamname2[@change2]
Diff utility for comparing the content at two depot paths. (For
comparing workspace content to depot content, see p4 diff.) Also
compares two arbitrary stream specs with the -As option.
The M type parameter tracks the command mode at compile time. The
default Unselected state diffs the two depot paths given as spawn
arguments; Self::differing_only, Self::quiet_mode,
Self::diff_nontext, and Self::unified_patch transition to the
DepotContent state, Self::branch and Self::stream transition
to the depot content BranchMode and StreamMode sub-modes, and
Self::stream_spec_mode transitions to the StreamSpecMode state.
Implementations§
Source§impl Diff2<Unselected>
impl Diff2<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 diff2 command.
bin is the path to the Perforce command-line executable.
Sourcepub fn differing_only(self, v: bool) -> Diff2<DepotContent<Unselected>>
pub fn differing_only(self, v: bool) -> Diff2<DepotContent<Unselected>>
§Description
-Od
Limit output to only those files that differ.
Transitions this command to the DepotContent state with -Od
set according to v.
Sourcepub fn quiet_mode(self, v: bool) -> Diff2<DepotContent<Unselected>>
pub fn quiet_mode(self, v: bool) -> Diff2<DepotContent<Unselected>>
§Description
-q
Quiet diff. Display only the header; if file1 and file2 are
identical, display only file1 - no differing files as the output.
Transitions this command to the DepotContent state with -q set
according to v.
Sourcepub fn diff_nontext(self, v: bool) -> Diff2<DepotContent<Unselected>>
pub fn diff_nontext(self, v: bool) -> Diff2<DepotContent<Unselected>>
§Description
-t
Diff the file revisions even if the file(s) are not of type text.
Transitions this command to the DepotContent state with -t set
according to v.
Sourcepub fn unified_patch(self, v: bool) -> Diff2<DepotContent<Unselected>>
pub fn unified_patch(self, v: bool) -> Diff2<DepotContent<Unselected>>
§Description
-u
Generate unified output format, showing added and deleted lines with
sufficient context for compatibility with the patch(1) utility.
Only those files that differ are included. File names and dates
remain in P4 Server syntax.
Transitions this command to the DepotContent state with -u set
according to v.
Sourcepub fn branch(self, name: impl Into<String>) -> Diff2<DepotContent<BranchMode>>
pub fn branch(self, name: impl Into<String>) -> Diff2<DepotContent<BranchMode>>
§Description
-b branch
Use a branch mapping to diff files in two branched codelines. The
files that are compared can be limited by file patterns in either
the from or to file specifications.
Transitions this command to the DepotContent state with the
BranchMode sub-mode selected and the branch mapping set to
name.
Sourcepub fn stream(self, name: impl Into<String>) -> Diff2<DepotContent<StreamMode>>
pub fn stream(self, name: impl Into<String>) -> Diff2<DepotContent<StreamMode>>
§Description
-S stream
Diff a stream with its parent. To diff the stream with a stream
other than its configured parent, specify Diff2::parent or
Diff2::set_parent.
Transitions this command to the DepotContent state with the
StreamMode sub-mode selected and the stream set to name.
Sourcepub fn stream_spec_mode(self) -> Diff2<StreamSpecMode>
pub fn stream_spec_mode(self) -> Diff2<StreamSpecMode>
§Description
-As
Allows two arbitrary stream specs to be diffed against each other. Can be used with a streamname, or with a streamname at a specific changelist number.
Although this option requires the user have at least the list access
to the stream path, it ignores any other entry in the protections
table, including any minus sign (-) that would otherwise block the
operation.
Transitions this command to the StreamSpecMode state. The two
stream specs to compare are passed as the arguments of the spawned
command (ParameterizedSpawn::spawn_with). As the -As form
accepts only -doptions besides g-opts, this transition is
unavailable once the command has entered the DepotContent state.
Source§impl<M> Diff2<M>
impl<M> Diff2<M>
Sourcepub fn get_diff_options(&self) -> Option<&DiffOptions>
pub fn get_diff_options(&self) -> Option<&DiffOptions>
Sourcepub fn set_diff_options(&mut self, v: impl Into<DiffOptions>) -> &mut Self
pub fn set_diff_options(&mut self, v: impl Into<DiffOptions>) -> &mut Self
Sourcepub fn diff_options(self, v: impl Into<DiffOptions>) -> Self
pub fn diff_options(self, v: impl Into<DiffOptions>) -> Self
Source§impl<M: ExclusiveOption> Diff2<M>
impl<M: ExclusiveOption> Diff2<M>
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
Source§impl<M> Diff2<DepotContent<M>>
impl<M> Diff2<DepotContent<M>>
Sourcepub fn get_differing_only(&self) -> bool
pub fn get_differing_only(&self) -> bool
Sourcepub fn set_differing_only(&mut self, v: bool) -> &mut Self
pub fn set_differing_only(&mut self, v: bool) -> &mut Self
Sourcepub fn differing_only(self, v: bool) -> Self
pub fn differing_only(self, v: bool) -> Self
Sourcepub fn get_quiet_mode(&self) -> bool
pub fn get_quiet_mode(&self) -> bool
§Description
-q
Quiet diff. Display only the header; if file1 and file2 are
identical, display only file1 - no differing files as the output.
Sourcepub fn set_quiet_mode(&mut self, v: bool) -> &mut Self
pub fn set_quiet_mode(&mut self, v: bool) -> &mut Self
§Description
-q
Quiet diff. Display only the header; if file1 and file2 are
identical, display only file1 - no differing files as the output.
Sourcepub fn quiet_mode(self, v: bool) -> Self
pub fn quiet_mode(self, v: bool) -> Self
§Description
-q
Quiet diff. Display only the header; if file1 and file2 are
identical, display only file1 - no differing files as the output.
Sourcepub fn get_diff_nontext(&self) -> bool
pub fn get_diff_nontext(&self) -> bool
Sourcepub fn set_diff_nontext(&mut self, v: bool) -> &mut Self
pub fn set_diff_nontext(&mut self, v: bool) -> &mut Self
Sourcepub fn diff_nontext(self, v: bool) -> Self
pub fn diff_nontext(self, v: bool) -> Self
Sourcepub fn get_unified_patch(&self) -> bool
pub fn get_unified_patch(&self) -> bool
§Description
-u
Generate unified output format, showing added and deleted lines with
sufficient context for compatibility with the patch(1) utility.
Only those files that differ are included. File names and dates
remain in P4 Server syntax.
Sourcepub fn set_unified_patch(&mut self, v: bool) -> &mut Self
pub fn set_unified_patch(&mut self, v: bool) -> &mut Self
§Description
-u
Generate unified output format, showing added and deleted lines with
sufficient context for compatibility with the patch(1) utility.
Only those files that differ are included. File names and dates
remain in P4 Server syntax.
Sourcepub fn unified_patch(self, v: bool) -> Self
pub fn unified_patch(self, v: bool) -> Self
§Description
-u
Generate unified output format, showing added and deleted lines with
sufficient context for compatibility with the patch(1) utility.
Only those files that differ are included. File names and dates
remain in P4 Server syntax.
Source§impl Diff2<DepotContent<Unselected>>
impl Diff2<DepotContent<Unselected>>
Sourcepub fn branch(self, name: impl Into<String>) -> Diff2<DepotContent<BranchMode>>
pub fn branch(self, name: impl Into<String>) -> Diff2<DepotContent<BranchMode>>
§Description
-b branch
Use a branch mapping to diff files in two branched codelines. The
files that are compared can be limited by file patterns in either
the from or to file specifications.
Transitions this command to the DepotContent state with the
BranchMode sub-mode selected and the branch mapping set to
name.
Sourcepub fn stream(self, name: impl Into<String>) -> Diff2<DepotContent<StreamMode>>
pub fn stream(self, name: impl Into<String>) -> Diff2<DepotContent<StreamMode>>
§Description
-S stream
Diff a stream with its parent. To diff the stream with a stream
other than its configured parent, specify Diff2::parent or
Diff2::set_parent.
Transitions this command to the DepotContent state with the
StreamMode sub-mode selected and the stream set to name.
Source§impl Diff2<DepotContent<BranchMode>>
impl Diff2<DepotContent<BranchMode>>
Sourcepub fn get_branch(&self) -> &str
pub fn get_branch(&self) -> &str
§Description
-b branch
Use a branch mapping to diff files in two branched codelines. The
files that are compared can be limited by file patterns in either
the from or to file specifications.
Sourcepub fn set_branch(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_branch(&mut self, v: impl Into<String>) -> &mut Self
§Description
-b branch
Use a branch mapping to diff files in two branched codelines. The
files that are compared can be limited by file patterns in either
the from or to file specifications.
Source§impl Diff2<DepotContent<StreamMode>>
impl Diff2<DepotContent<StreamMode>>
Sourcepub fn get_stream(&self) -> &str
pub fn get_stream(&self) -> &str
§Description
-S stream
Diff a stream with its parent. To diff the stream with a stream
other than its configured parent, specify Diff2::parent or
Diff2::set_parent.
Sourcepub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self
§Description
-S stream
Diff a stream with its parent. To diff the stream with a stream
other than its configured parent, specify Diff2::parent or
Diff2::set_parent.
Sourcepub fn stream(self, v: impl Into<String>) -> Self
pub fn stream(self, v: impl Into<String>) -> Self
§Description
-S stream
Diff a stream with its parent. To diff the stream with a stream
other than its configured parent, specify Diff2::parent or
Diff2::set_parent.
Sourcepub fn get_parent(&self) -> Option<&str>
pub fn get_parent(&self) -> Option<&str>
Sourcepub fn set_parent(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_parent(&mut self, v: impl Into<String>) -> &mut Self
Trait Implementations§
Source§impl ParameterizedSpawn for Diff2<Unselected>
impl ParameterizedSpawn for Diff2<Unselected>
Source§fn spawn_with<'a>(
&mut self,
(file1, file2): Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, (file1, file2): Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 for the given pair of file arguments as a child
process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
Each file argument is a file name, optionally with a revision
specifier (for example file#2 or file@34).
type Input<'a> = (&'a OsStr, &'a OsStr)
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Diff2<DepotContent<Unselected>>
impl ParameterizedSpawn for Diff2<DepotContent<Unselected>>
Source§fn spawn_with<'a>(
&mut self,
(file1, file2): Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, (file1, file2): Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 for the given pair of file arguments as a child
process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
Each file argument is a file name, optionally with a revision
specifier (for example file#2 or file@34).
type Input<'a> = (&'a OsStr, &'a OsStr)
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Diff2<DepotContent<BranchMode>>
impl ParameterizedSpawn for Diff2<DepotContent<BranchMode>>
Source§fn spawn_with<'a>(
&mut self,
files: Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, files: Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -b branch as a child process with piped standard
output and error streams; use the returned Child handle to wait
for it or interact with it.
Diff2Parameters::Full limits the files compared to
fromfile[rev] and tofile[rev], Diff2Parameters::To limits
the target side only, and Diff2Parameters::None diffs the whole
branch mapping.
type Input<'a> = Diff2Parameters<'a>
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Diff2<DepotContent<StreamMode>>
impl ParameterizedSpawn for Diff2<DepotContent<StreamMode>>
Source§fn spawn_with<'a>(
&mut self,
files: Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, files: Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -S stream as a child process with piped standard
output and error streams; use the returned Child handle to wait
for it or interact with it.
Diff2Parameters::Full limits the files compared to
fromfile[rev] and tofile[rev], Diff2Parameters::To limits
the target side only, and Diff2Parameters::None diffs the whole
stream with its parent.
type Input<'a> = Diff2Parameters<'a>
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Diff2<StreamSpecMode>
impl ParameterizedSpawn for Diff2<StreamSpecMode>
Source§fn spawn_with<'a>(
&mut self,
(spec1, spec2): Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, (spec1, spec2): Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -As for the given pair of stream specs as a child
process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
Each stream spec is a streamname, optionally at a specific changelist
number: @head selects the head version, @change the version at a
specific change, and @=change the shelved version at a specific
change.
type Input<'a> = (&'a str, &'a str)
type Output<'a> = Child
type Error = Error
Source§impl SpawnExt for Diff2<DepotContent<BranchMode>>
impl SpawnExt for Diff2<DepotContent<BranchMode>>
Source§impl SpawnExt for Diff2<DepotContent<StreamMode>>
impl SpawnExt for Diff2<DepotContent<StreamMode>>
Source§impl<'f> SpawnExt1<&'f OsStr> for Diff2<DepotContent<BranchMode>>
impl<'f> SpawnExt1<&'f OsStr> for Diff2<DepotContent<BranchMode>>
Source§fn spawn<'a>(
&mut self,
tofile: &'f OsStr,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn<'a>( &mut self, tofile: &'f OsStr, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -b branch tofile[rev] as a child process with
piped standard output and error streams; the branch mapping is
diffed with the target side limited to the given file. Use the
returned Child handle to wait for it or interact with it.
Source§impl<'f> SpawnExt1<&'f OsStr> for Diff2<DepotContent<StreamMode>>
impl<'f> SpawnExt1<&'f OsStr> for Diff2<DepotContent<StreamMode>>
Source§fn spawn<'a>(
&mut self,
tofile: &'f OsStr,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn<'a>( &mut self, tofile: &'f OsStr, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -S stream tofile[rev] as a child process with
piped standard output and error streams; the stream is diffed with
its parent with the target side limited to the given file. Use the
returned Child handle to wait for it or interact with it.
Source§impl<'f> SpawnExt2<&'f OsStr, &'f OsStr> for Diff2<DepotContent<BranchMode>>
impl<'f> SpawnExt2<&'f OsStr, &'f OsStr> for Diff2<DepotContent<BranchMode>>
Source§fn spawn<'a>(
&mut self,
fromfile: &'f OsStr,
tofile: &'f OsStr,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn<'a>( &mut self, fromfile: &'f OsStr, tofile: &'f OsStr, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -b branch fromfile[rev] tofile[rev] as a child
process with piped standard output and error streams; the branch
mapping is diffed between the given files. Use the returned
Child handle to wait for it or interact with it.
Source§impl<'f> SpawnExt2<&'f OsStr, &'f OsStr> for Diff2<DepotContent<StreamMode>>
impl<'f> SpawnExt2<&'f OsStr, &'f OsStr> for Diff2<DepotContent<StreamMode>>
Source§fn spawn<'a>(
&mut self,
fromfile: &'f OsStr,
tofile: &'f OsStr,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn<'a>( &mut self, fromfile: &'f OsStr, tofile: &'f OsStr, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 diff2 -S stream fromfile[rev] tofile[rev] as a child
process with piped standard output and error streams; the stream is
diffed with its parent between the given files. Use the returned
Child handle to wait for it or interact with it.