public class SvnDiff extends SvnOperation<java.lang.Void>
target
in its pegRevision
, as it changed between startRevision
and endRevision
,
or between first target
at startRevision
and second target
at endRevision
.
Writes the output of the diff to output
stream.
startRevision
and endRevision
of one target
:
Target
can be either working copy path or URL.
If pegRevision
is invalid
, behaves identically to
diff between two targets, using target
's path for both targets.
target
and second target
:
First and second targets
can be either working copy path or URL, but cannot be both URLs.
If so UnsupportedOperationException
is thrown.
Both targets
must represent the same node kind -- that is, if first target
is a directory,
second target
must also be, and if first target
is a file,
second target
must also be.
DefaultSVNDiffGenerator
and there was
a non-null
base path
provided to
it, the original path and modified path will have this base path stripped
from the front of the respective paths. If the base path is not SVNErrorCode.BAD_RELATIVE_PATH
error code
is thrown.
If noDiffDeleted
or old ISVNDiffGenerator.isDiffDeleted()
is true, then no diff output will be generated on
deleted files.
Generated headers are encoded using ISvnDiffGenerator.getEncoding()
.
Diffs output will not be generated for binary files, unless
ISvnDiffGenerator.isForcedBinaryDiff()
is true
, in which case diffs will be shown
regardless of the content types.
If this operation object uses DefaultSVNDiffGenerator
then a caller
can set SVNDiffOptions
to it which will be used to pass
additional options to the diff processes invoked to compare files.
If depth
is SVNDepth.INFINITY
, diffs fully
recursively. Else if it is SVNDepth.IMMEDIATES
, diffs the named
paths and their file children (if any), and diffs properties of
subdirectories, but does not descend further into the subdirectories.
Else if SVNDepth.FILES
, behaves as if for
SVNDepth.IMMEDIATES
except doesn't diff properties of
subdirectories. If SVNDepth.EMPTY
, diffs exactly the named paths
but nothing underneath them.
ignoreAncestry
controls whether or not items being diffed will
be checked for relatedness first. Unrelated items are typically
transmitted to the editor as a deletion of one thing and the addition of
another, but if this flag is false
,
unrelated items will be diffed as if they were related.
changeLists
is a collection of String
changelist names, used as a restrictive filter on items whose differences
are reported; that is, doesn't generate diffs about any item unless it's
a member of one of those changelists. If changeLists
is
empty (or null
), no changelist filtering
occurs.
Note: changelist filtering only applies to diffs in which at least one
side of the diff represents working copy data.
If both startRevision
and endRevision
is either SVNRevision.WORKING
or
SVNRevision.BASE
, then it will be a url-against-wc; otherwise, a
url-against-url diff.
If startRevision
is neither SVNRevision.BASE
, nor
SVNRevision.WORKING
, nor SVNRevision.COMMITTED
, and if,
on the contrary, endRevision
is one of the aforementioned revisions,
then a wc-against-url diff is performed; if endRevision
also is not
one of those revision constants, then a url-against-url diff is
performed. Otherwise it's a url-against-wc diff.
SvnOperation.run()
method throws SVNException
if one of the following is true:
- exception with
SVNErrorCode.CLIENT_BAD_REVISION
error code - if either of startRevision
and endRevision
is invalid
; if both startRevision
and endRevision
are either
SVNRevision.WORKING
or SVNRevision.BASE
- exception with
SVNErrorCode.FS_NOT_FOUND
error code -
target
can not be found in either startRevision
or endRevision
Modifier | Constructor and Description |
---|---|
protected |
SvnDiff(SvnOperationFactory factory) |
Modifier and Type | Method and Description |
---|---|
protected void |
ensureArgumentsAreValid() |
ISvnDiffGenerator |
getDiffGenerator()
Returns operation's diff generator.
|
SVNDiffOptions |
getDiffOptions()
Returns the operation's diff options controlling white-spaces and eol-styles.
|
SVNRevision |
getEndRevision() |
SvnTarget |
getFirstSource() |
protected int |
getMaximumTargetsCount() |
protected int |
getMinimumTargetsCount() |
protected java.io.File |
getOperationalWorkingCopy() |
java.io.OutputStream |
getOutput()
Returns output stream where the differences will be written to.
|
java.io.File |
getRelativeToDirectory() |
SvnTarget |
getSecondSource() |
SvnTarget |
getSource()
Gets the diff's
source with start and end revisions for one-target type of operation. |
SVNRevision |
getStartRevision() |
boolean |
isChangesWorkingCopy()
Gets whether the operation changes working copy
|
boolean |
isIgnoreAncestry()
Returns the paths ancestry should not be noticed while calculating differences.
|
boolean |
isIgnoreContentType() |
boolean |
isNoDiffDeleted()
Returns whether to generate differences for deleted files.
|
boolean |
isShowCopiesAsAdds()
Returns whether to report copies and moves as it were adds.
|
boolean |
isUseGitDiffFormat()
Returns whether to report in Git diff format.
|
void |
setDiffGenerator(ISvnDiffGenerator diffGenerator)
Sets operation's diff generator.
|
void |
setDiffGenerator(ISVNDiffGenerator diffGenerator)
Sets operation's diff generator of type ISVNDiffGenerator.
|
void |
setDiffOptions(SVNDiffOptions diffOptions)
Sets the operation's diff options controlling white-spaces and eol-styles.
|
void |
setIgnoreAncestry(boolean ignoreAncestry)
Sets whether or not items being diffed should
be checked for relatedness first.
|
void |
setIgnoreContentType(boolean ignoreContentType) |
void |
setNoDiffDeleted(boolean noDiffDeleted)
Sets whether to generate differences for deleted files.
|
void |
setOutput(java.io.OutputStream output)
Sets output stream where the differences will be written to.
|
void |
setRelativeToDirectory(java.io.File relativeToDirectory) |
void |
setShowCopiesAsAdds(boolean showCopiesAsAdds)
Sets whether to report copies and moves as it were adds.
|
void |
setSource(SvnTarget source,
SVNRevision start,
SVNRevision end)
Sets the diff's
source with start and end revisions for one-source type of operation. |
void |
setSources(SvnTarget source1,
SvnTarget source2)
Sets both diff's
sources . |
void |
setUseGitDiffFormat(boolean useGitDiffFormat)
Sets whether to report in Git diff format.
|
addTarget, cancel, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, initDefaults, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, run, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
protected SvnDiff(SvnOperationFactory factory)
public void setSource(SvnTarget source, SVNRevision start, SVNRevision end)
source
with start and end revisions for one-source type of operation.source
- source of the diffstart
- start revision of the diffend
- end revision of the diffpublic void setSources(SvnTarget source1, SvnTarget source2)
sources
.source1
- first source of the diffsource2
- second source of the diffpublic SvnTarget getSource()
source
with start and end revisions for one-target type of operation.public SVNRevision getStartRevision()
public SVNRevision getEndRevision()
public SvnTarget getFirstSource()
public SvnTarget getSecondSource()
public void setRelativeToDirectory(java.io.File relativeToDirectory)
public java.io.File getRelativeToDirectory()
public ISvnDiffGenerator getDiffGenerator()
DefaultSVNDiffGenerator
is used.public void setDiffGenerator(ISVNDiffGenerator diffGenerator)
diffGenerator
- diff generator of the operation of type ISVNDiffGeneratorpublic void setDiffGenerator(ISvnDiffGenerator diffGenerator)
diffGenerator
- diff generator of the operationpublic SVNDiffOptions getDiffOptions()
public void setDiffOptions(SVNDiffOptions diffOptions)
diffOptions
- diff options of the operationpublic java.io.OutputStream getOutput()
public void setOutput(java.io.OutputStream output)
output
- output stream of the diff's resultpublic boolean isIgnoreAncestry()
true
if the paths ancestry should not be noticed while calculating differences, otherwise false
setIgnoreAncestry(boolean)
public void setIgnoreAncestry(boolean ignoreAncestry)
false
,
unrelated items will be diffed as if they were related.ignoreAncestry
- true
if the paths ancestry should not be noticed while calculating differences, otherwise false
public boolean isNoDiffDeleted()
ISVNDiffGenerator.isDiffDeleted()
.true
if deleted files should not be diffed, otherwise false
public void setNoDiffDeleted(boolean noDiffDeleted)
ISVNDiffGenerator.setDiffDeleted(boolean)
.noDiffDeleted
- true
if deleted files should not be diffed, otherwise false
public boolean isShowCopiesAsAdds()
true
if copies and moves should be reported as adds, otherwise false
public void setShowCopiesAsAdds(boolean showCopiesAsAdds)
showCopiesAsAdds
- true
if copies and moves should be reported as adds, otherwise false
public boolean isIgnoreContentType()
public void setIgnoreContentType(boolean ignoreContentType)
public boolean isUseGitDiffFormat()
true
if report should be in report in Git diff format, otherwise false
public void setUseGitDiffFormat(boolean useGitDiffFormat)
useGitDiffFormat
- true
if report should be in report in Git diff format, otherwise false
protected int getMinimumTargetsCount()
getMinimumTargetsCount
in class SvnOperation<java.lang.Void>
protected int getMaximumTargetsCount()
getMaximumTargetsCount
in class SvnOperation<java.lang.Void>
protected void ensureArgumentsAreValid() throws SVNException
ensureArgumentsAreValid
in class SvnOperation<java.lang.Void>
SVNException
protected java.io.File getOperationalWorkingCopy()
getOperationalWorkingCopy
in class SvnOperation<java.lang.Void>
public boolean isChangesWorkingCopy()
isChangesWorkingCopy
in class SvnOperation<java.lang.Void>
true
if the operation changes the working copy, otherwise false
Copyright © 2004-2012 TMate Software Ltd. All Rights Reserved.