Skip to content

Commit a923a09

Browse files
committed
feat(prompts): support for computing diff for svn vcs
1 parent 6e30496 commit a923a09

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Added
6+
7+
- Support for SVN.
8+
59
## [2.10.1] - 2025-04-13
610

711
### Fixed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ platformVersion = 2023.3
1515

1616
# https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1717
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
18-
platformPlugins = org.jetbrains.kotlin, org.jetbrains.plugins.github, Git4Idea
18+
platformPlugins = org.jetbrains.kotlin, org.jetbrains.plugins.github, Git4Idea, Subversion
1919

2020
# If targeting 2022.3+, Java 17 is required.
2121
javaVersion = 17

src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsUtils.kt

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ object AICommitsUtils {
105105
reversePatch: Boolean,
106106
project: Project
107107
): String {
108-
109-
val gitRepositoryManager = GitRepositoryManager.getInstance(project)
110-
111108
// go through included changes, create a map of repository to changes and discard nulls
112109
val changesByRepository = includedChanges
113110
.filter {
@@ -117,9 +114,9 @@ object AICommitsUtils {
117114
}
118115
.mapNotNull { change ->
119116
change.filePath()?.let { filePath ->
120-
gitRepositoryManager.getRepositoryForFileQuick(
121-
filePath
122-
) to change
117+
VcsUtil.getVcsRootFor(project, filePath)?.let { vcsRoot ->
118+
vcsRoot to change
119+
}
123120
}
124121
}
125122
.filter { !it.second.isSubmoduleChange(project) }
@@ -128,19 +125,17 @@ object AICommitsUtils {
128125

129126
// compute diff for each repository
130127
return changesByRepository
131-
.map { (repository, changes) ->
132-
repository?.let {
133-
val filePatches = IdeaTextPatchBuilder.buildPatch(
134-
project,
135-
changes,
136-
repository.root.toNioPath(), reversePatch, true
137-
)
138-
139-
val stringWriter = StringWriter()
140-
stringWriter.write("Repository: ${repository.root.path}\n")
141-
UnifiedDiffWriter.write(project, filePatches, stringWriter, "\n", null)
142-
stringWriter.toString()
143-
}
128+
.map { (vcsRoot, changes) ->
129+
val filePatches = IdeaTextPatchBuilder.buildPatch(
130+
project,
131+
changes,
132+
vcsRoot.toNioPath(), reversePatch, true
133+
)
134+
135+
val stringWriter = StringWriter()
136+
stringWriter.write("Repository: ${vcsRoot.path}\n")
137+
UnifiedDiffWriter.write(project, filePatches, stringWriter, "\n", null)
138+
stringWriter.toString()
144139
}
145140
.joinToString("\n")
146141
}

0 commit comments

Comments
 (0)