Skip to content

Commit 0745e4f

Browse files
filter unchanged objects in transports
1 parent de00675 commit 0745e4f

File tree

9 files changed

+423
-219
lines changed

9 files changed

+423
-219
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [1.7.2] 2023-10-31
4+
5+
### Added
6+
7+
- filter changes in transport revisions
8+
39
## [1.7.1] 2023-10-25
410

511
### Added

client/images/dark/icon-delete.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

client/images/light/icon-delete.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

client/package-lock.json

Lines changed: 350 additions & 186 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"webpack-cli": "^5.0.1"
5959
},
6060
"dependencies": {
61-
"@abaplint/core": "^2.95.18",
61+
"@abaplint/core": "^2.102.65",
6262
"@types/tmp": "0.2.3",
6363
"abap_cloud_platform": "^1.1.3",
6464
"abap-adt-api": "^5.0.6",

client/src/commands/registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const AbapFsCommands = {
3939
runClass: "abapfs.runClass",
4040
// revisions
4141
clearScmGroup: "abapfs.clearScmGroup",
42+
filterScmGroup: "abapfs.filterScmGroup",
4243
openrevstate: "abapfs.openrevstate",
4344
opendiff: "abapfs.opendiff",
4445
opendiffNormalized: "abapfs.opendiffNormalized",

client/src/scm/abaprevisions/abapscm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export class AbapScm {
6969
return this.emitter.event
7070
}
7171

72+
public async getGroup(label: string) {
73+
return this.groups.get(label)
74+
}
75+
7276
public async addRecentDocument(uri: Uri) {
7377
const recent = this.groups.get(RECENT)
7478
const state = findState(recent, uri)

client/src/scm/abaprevisions/commands.ts

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { command, AbapFsCommands } from "../../commands"
2-
import { Uri, QuickPickItem, window, commands, workspace } from "vscode"
3-
import { abapUri, uriRoot, getOrCreateRoot } from "../../adt/conections"
2+
import { Uri, QuickPickItem, window, commands, workspace, ProgressLocation } from "vscode"
3+
import { abapUri, uriRoot, getOrCreateRoot, getClient } from "../../adt/conections"
44
import { AbapRevisionService, revLabel } from "./abaprevisionservice"
5-
import { Revision } from "abap-adt-api"
5+
import { ADTClient, Revision } from "abap-adt-api"
66
import { AbapQuickDiff } from "./quickdiff"
77
import { revisionUri } from "./documentprovider"
88
import { RemoteManager, formatKey } from "../../config"
@@ -58,6 +58,17 @@ const pickCommonAncestor = (locals: Revision[], localVer: Revision, remotes: Rev
5858
return pickRevision(possibleLocals, "Unable to determine common ancestor, please select base for comparison")
5959
}
6060

61+
const wasChanged = async (client: ADTClient, state: AState): Promise<boolean> => {
62+
try {
63+
if (!state.refRevision) return false
64+
const ref = await client.getObjectSource(state.refRevision.uri)
65+
const rev = await client.getObjectSource(state.mainRevision.uri)
66+
if (ref !== rev) return true
67+
} catch (error) {
68+
return true // safer to assume it was changed
69+
}
70+
return false
71+
}
6172

6273
export const displayRevDiff = (
6374
rightRev: Revision | undefined,
@@ -184,6 +195,37 @@ export class AbapRevisionCommands {
184195
private static clearGroup(group: AGroup) {
185196
group.resourceStates = []
186197
}
198+
@command(AbapFsCommands.filterScmGroup)
199+
private static filterGroup(group: AGroup) {
200+
window.withProgress({ location: ProgressLocation.Notification, cancellable: true, title: "checking diffs" }, async (prog, tok) => {
201+
const nextState: AState[] = []
202+
const unchanged: AState[] = []
203+
let count = 0
204+
const scm = group.resourceStates[0]?.ascm
205+
if (!scm) return
206+
const client = getClient(scm.connId)
207+
for (const s of group.resourceStates) {
208+
if (tok.isCancellationRequested) return
209+
const increment = count * 100 / group.resourceStates.length
210+
const message = s.resourceUri.path.replace(/.*\//, "")
211+
prog.report({ message, increment })
212+
const found = await wasChanged(client, s)
213+
if (found) nextState.push(s)
214+
else unchanged.push(s)
215+
count++
216+
}
217+
218+
group.resourceStates = nextState
219+
if (unchanged.length) {
220+
const label = `unchanged ${group.label}`
221+
const ugroup = await scm.getGroup(label)
222+
const toAdd = unchanged.filter(s => !ugroup.resourceStates.includes(s))
223+
ugroup.resourceStates = [...ugroup.resourceStates, ...toAdd]
224+
}
225+
226+
})
227+
}
228+
187229
@command(AbapFsCommands.opendiff)
188230
private static async openDiff(state: AState, select = true) {
189231
const uri = state.resourceUri

package.json

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,7 @@
234234
{
235235
"command": "abapfs.deletefavourite",
236236
"title": "AbapFs delete favourite",
237-
"icon": {
238-
"dark": "client/images/dark/icon-delete.svg",
239-
"light": "client/images/light/icon-delete.svg"
240-
}
237+
"icon": "$(trash)"
241238
},
242239
{
243240
"command": "abapfs.activate",
@@ -282,10 +279,7 @@
282279
{
283280
"command": "abapfs.unlinkRepo",
284281
"title": "Unlink abapGit Repo",
285-
"icon": {
286-
"dark": "client/images/dark/icon-delete.svg",
287-
"light": "client/images/light/icon-delete.svg"
288-
}
282+
"icon": "$(trash)"
289283
},
290284
{
291285
"command": "abapfs.registerSCM",
@@ -383,10 +377,7 @@
383377
{
384378
"command": "abapfs.deleteTransport",
385379
"title": "Delete transport",
386-
"icon": {
387-
"dark": "client/images/dark/icon-delete.svg",
388-
"light": "client/images/light/icon-delete.svg"
389-
}
380+
"icon": "$(trash)"
390381
},
391382
{
392383
"command": "abapfs.revealPackage",
@@ -467,18 +458,17 @@
467458
{
468459
"command": "abapfs.transportRevision",
469460
"title": "Add transport to source control",
470-
"icon": {
471-
"dark": "client/images/dark/icon-repo.svg",
472-
"light": "client/images/light/icon-repo.svg"
473-
}
461+
"icon": "$(versions)"
474462
},
475463
{
476464
"command": "abapfs.clearScmGroup",
477465
"title": "Clear",
478-
"icon": {
479-
"dark": "client/images/dark/icon-delete.svg",
480-
"light": "client/images/light/icon-delete.svg"
481-
}
466+
"icon": "$(trash)"
467+
},
468+
{
469+
"command": "abapfs.filterScmGroup",
470+
"title": "Filter unchanged",
471+
"icon": "$(filter)"
482472
},
483473
{
484474
"command": "abapfs.showdocu",
@@ -1020,6 +1010,11 @@
10201010
}
10211011
],
10221012
"scm/resourceGroup/context": [
1013+
{
1014+
"command": "abapfs.filterScmGroup",
1015+
"group": "inline",
1016+
"when": "scmProvider =~ /^ABAP/ && scmResourceGroup != recent && scmResourceGroup =~ /^(?!unchanged)/"
1017+
},
10231018
{
10241019
"command": "abapfs.clearScmGroup",
10251020
"group": "inline",
@@ -1298,4 +1293,4 @@
12981293
}
12991294
}
13001295
}
1301-
}
1296+
}

0 commit comments

Comments
 (0)