Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
subversive
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Florent Angebault
subversive
Commits
80ca5ed3
Commit
80ca5ed3
authored
Nov 18, 2016
by
Florent Angebault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OTRS#2016093010000012 : svn diff before svn summarize + ignore ancestry.
parent
f80aa1f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
7 deletions
+65
-7
org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/operation/CompareResourcesInternalOperation.java
...m/svn/ui/operation/CompareResourcesInternalOperation.java
+65
-7
No files found.
org.eclipse.team.svn.ui/src/org/eclipse/team/svn/ui/operation/CompareResourcesInternalOperation.java
View file @
80ca5ed3
...
...
@@ -11,10 +11,13 @@
package
org
.
eclipse
.
team
.
svn
.
ui
.
operation
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
org.eclipse.compare.CompareConfiguration
;
import
org.eclipse.compare.CompareEditorInput
;
...
...
@@ -216,7 +219,10 @@ public class CompareResourcesInternalOperation extends AbstractActionOperation {
SVNEntryRevisionReference
refPrev
=
new
SVNEntryRevisionReference
(
FileUtility
.
getWorkingCopyPath
(
CompareResourcesInternalOperation
.
this
.
local
.
getResource
()),
null
,
SVNRevision
.
WORKING
);
final
SVNEntryRevisionReference
refNext
=
SVNUtility
.
getEntryRevisionReference
(
CompareResourcesInternalOperation
.
this
.
remote
);
proxy
.
diffStatusTwo
(
refPrev
,
refNext
,
SVNDepth
.
INFINITY
,
ISVNConnector
.
Options
.
NONE
,
null
,
new
ISVNDiffStatusCallback
()
{
// does not work with BASE working copy revision (not implemented yet exception)
final
FakeOutputStream
diffPathCollector
=
new
FakeOutputStream
();
proxy
.
diffTwo
(
refPrev
,
refNext
,
rootPath
.
toFile
().
getAbsolutePath
(),
diffPathCollector
,
SVNDepth
.
INFINITY
,
ISVNConnector
.
Options
.
IGNORE_ANCESTRY
,
null
,
ISVNConnector
.
DiffOptions
.
IGNORE_WHITESPACE
,
new
SVNProgressMonitor
(
CompareResourcesInternalOperation
.
this
,
monitor
,
null
,
false
));
proxy
.
diffStatusTwo
(
refPrev
,
refNext
,
SVNDepth
.
INFINITY
,
ISVNConnector
.
Options
.
IGNORE_ANCESTRY
,
null
,
new
ISVNDiffStatusCallback
()
{
public
void
next
(
SVNDiffStatus
status
)
{
IPath
tPath
=
new
Path
(
status
.
pathPrev
);
tPath
=
tPath
.
removeFirstSegments
(
rootPath
.
segmentCount
());
...
...
@@ -224,19 +230,71 @@ public class CompareResourcesInternalOperation extends AbstractActionOperation {
if
(
resource
==
null
)
{
resource
=
status
.
nodeKind
==
SVNEntry
.
Kind
.
FILE
?
compareRoot
.
getFile
(
tPath
)
:
compareRoot
.
getFolder
(
tPath
);
}
if
(
IStateFilter
.
SF_ANY_CHANGE
.
accept
(
SVNRemoteStorage
.
instance
().
asLocalResource
(
resource
)))
{
localChanges
.
add
(
status
);
}
else
{
String
pathPrev
=
CompareResourcesInternalOperation
.
this
.
ancestor
.
getUrl
()
+
status
.
pathNext
.
substring
(
refNext
.
path
.
length
());
remoteChanges
.
add
(
new
SVNDiffStatus
(
pathPrev
,
status
.
pathNext
,
status
.
nodeKind
,
status
.
textStatus
,
status
.
propStatus
));
ILocalResource
local
=
SVNRemoteStorage
.
instance
().
asLocalResource
(
resource
);
if
(!
IStateFilter
.
SF_ANY_CHANGE
.
accept
(
local
)
||
IStateFilter
.
SF_NOTEXISTS
.
accept
(
local
))
{
// it seems the status is calculated relatively to the working copy, so deletion and addition changes should actually be reversed
// TODO could there be a case when relative paths are reported? If so - looks like a bug to me...
String
pathPrev
=
status
.
pathNext
.
startsWith
(
refNext
.
path
)
?
status
.
pathNext
.
substring
(
refNext
.
path
.
length
())
:
status
.
pathNext
;
if
(!
diffPathCollector
.
contains
(
pathPrev
))
{
System
.
out
.
println
(
"ignoring path: "
+
pathPrev
);
}
else
{
pathPrev
=
CompareResourcesInternalOperation
.
this
.
ancestor
.
getUrl
()
+
pathPrev
;
remoteChanges
.
add
(
new
SVNDiffStatus
(
pathPrev
,
status
.
pathNext
,
status
.
nodeKind
,
status
.
textStatus
,
status
.
propStatus
));
}
}
}
},
new
SVNProgressMonitor
(
CompareResourcesInternalOperation
.
this
,
monitor
,
null
,
false
));
}
},
monitor
,
100
,
50
);
}
/**
* Workaround.
*
* This {@link OutputStream} parses the output of "svn diff" and only catches paths from
* the lines beginning with "Index: ".
*
* @author fangebault
*/
private
static
class
FakeOutputStream
extends
OutputStream
{
boolean
lineStart
=
true
;
boolean
indexLine
=
false
;
Set
<
String
>
paths
=
new
LinkedHashSet
<
String
>();
StringBuilder
w
=
new
StringBuilder
();
@Override
public
void
write
(
int
b
)
throws
IOException
{
char
c
=
(
char
)
b
;
System
.
out
.
print
(
c
);
if
(
c
==
'I'
&&
this
.
lineStart
)
{
this
.
indexLine
=
true
;
this
.
w
.
append
(
c
);
}
else
if
(
c
==
'\n'
||
c
==
'\r'
)
{
if
(
this
.
indexLine
)
{
this
.
paths
.
add
(
"/"
+
this
.
w
.
toString
().
substring
(
"Index: "
.
length
()));
this
.
w
.
replace
(
0
,
this
.
w
.
length
(),
""
);
}
this
.
lineStart
=
true
;
this
.
indexLine
=
false
;
}
else
{
this
.
lineStart
=
false
;
if
(
this
.
indexLine
)
{
this
.
w
.
append
(
c
);
}
}
}
private
Set
<
String
>
getPaths
()
{
return
this
.
paths
;
}
public
boolean
contains
(
String
path
)
{
return
this
.
getPaths
().
contains
(
path
);
}
}
protected
boolean
compareResultOK
(
CompareEditorInput
input
)
{
final
Shell
shell
=
UIMonitorUtility
.
getShell
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment