@statewalker/vcs-commands 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +591 -0
- package/dist/commands/add-command.d.ts +170 -0
- package/dist/commands/add-command.d.ts.map +1 -0
- package/dist/commands/blame-command.d.ts +267 -0
- package/dist/commands/blame-command.d.ts.map +1 -0
- package/dist/commands/branch-command.d.ts +211 -0
- package/dist/commands/branch-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +261 -0
- package/dist/commands/checkout-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +128 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -0
- package/dist/commands/clean-command.d.ts +91 -0
- package/dist/commands/clean-command.d.ts.map +1 -0
- package/dist/commands/clone-command.d.ts +233 -0
- package/dist/commands/clone-command.d.ts.map +1 -0
- package/dist/commands/commit-command.d.ts +199 -0
- package/dist/commands/commit-command.d.ts.map +1 -0
- package/dist/commands/describe-command.d.ts +175 -0
- package/dist/commands/describe-command.d.ts.map +1 -0
- package/dist/commands/diff-command.d.ts +96 -0
- package/dist/commands/diff-command.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +266 -0
- package/dist/commands/fetch-command.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +83 -0
- package/dist/commands/gc-command.d.ts.map +1 -0
- package/dist/commands/index.d.ts +32 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/init-command.d.ts +175 -0
- package/dist/commands/init-command.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +246 -0
- package/dist/commands/log-command.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +122 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +169 -0
- package/dist/commands/merge-command.d.ts.map +1 -0
- package/dist/commands/pack-refs-command.d.ts +57 -0
- package/dist/commands/pack-refs-command.d.ts.map +1 -0
- package/dist/commands/pull-command.d.ts +111 -0
- package/dist/commands/pull-command.d.ts.map +1 -0
- package/dist/commands/push-command.d.ts +220 -0
- package/dist/commands/push-command.d.ts.map +1 -0
- package/dist/commands/rebase-command.d.ts +186 -0
- package/dist/commands/rebase-command.d.ts.map +1 -0
- package/dist/commands/reflog-command.d.ts +45 -0
- package/dist/commands/reflog-command.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +205 -0
- package/dist/commands/remote-command.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +114 -0
- package/dist/commands/reset-command.d.ts.map +1 -0
- package/dist/commands/revert-command.d.ts +129 -0
- package/dist/commands/revert-command.d.ts.map +1 -0
- package/dist/commands/rm-command.d.ts +72 -0
- package/dist/commands/rm-command.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +132 -0
- package/dist/commands/stash-apply-command.d.ts.map +1 -0
- package/dist/commands/stash-create-command.d.ts +137 -0
- package/dist/commands/stash-create-command.d.ts.map +1 -0
- package/dist/commands/stash-drop-command.d.ts +63 -0
- package/dist/commands/stash-drop-command.d.ts.map +1 -0
- package/dist/commands/stash-list-command.d.ts +42 -0
- package/dist/commands/stash-list-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +55 -0
- package/dist/commands/status-command.d.ts.map +1 -0
- package/dist/commands/tag-command.d.ts +155 -0
- package/dist/commands/tag-command.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +51 -0
- package/dist/commands/tree-restore.d.ts.map +1 -0
- package/dist/commands-COO4tJhv.js +10274 -0
- package/dist/core-commands/add.command.d.ts +71 -0
- package/dist/core-commands/add.command.d.ts.map +1 -0
- package/dist/core-commands/add.command.impl.d.ts +53 -0
- package/dist/core-commands/add.command.impl.d.ts.map +1 -0
- package/dist/core-commands/checkout.command.d.ts +103 -0
- package/dist/core-commands/checkout.command.d.ts.map +1 -0
- package/dist/core-commands/checkout.command.impl.d.ts +114 -0
- package/dist/core-commands/checkout.command.impl.d.ts.map +1 -0
- package/dist/core-commands/index.d.ts +6 -0
- package/dist/core-commands/index.d.ts.map +1 -0
- package/dist/errors/add-errors.d.ts +16 -0
- package/dist/errors/add-errors.d.ts.map +1 -0
- package/dist/errors/checkout-errors.d.ts +24 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -0
- package/dist/errors/command-errors.d.ts +38 -0
- package/dist/errors/command-errors.d.ts.map +1 -0
- package/dist/errors/commit-errors.d.ts +27 -0
- package/dist/errors/commit-errors.d.ts.map +1 -0
- package/dist/errors/git-api-error.d.ts +9 -0
- package/dist/errors/git-api-error.d.ts.map +1 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +509 -0
- package/dist/errors/merge-errors.d.ts +63 -0
- package/dist/errors/merge-errors.d.ts.map +1 -0
- package/dist/errors/rebase-errors.d.ts +21 -0
- package/dist/errors/rebase-errors.d.ts.map +1 -0
- package/dist/errors/ref-errors.d.ts +63 -0
- package/dist/errors/ref-errors.d.ts.map +1 -0
- package/dist/errors/remote-errors.d.ts +16 -0
- package/dist/errors/remote-errors.d.ts.map +1 -0
- package/dist/errors/stash-errors.d.ts +24 -0
- package/dist/errors/stash-errors.d.ts.map +1 -0
- package/dist/errors/tag-errors.d.ts +11 -0
- package/dist/errors/tag-errors.d.ts.map +1 -0
- package/dist/errors/transport-errors.d.ts +42 -0
- package/dist/errors/transport-errors.d.ts.map +1 -0
- package/dist/git-command.d.ts +139 -0
- package/dist/git-command.d.ts.map +1 -0
- package/dist/git.d.ts +637 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/pack-import/index.d.ts +8 -0
- package/dist/pack-import/index.d.ts.map +1 -0
- package/dist/pack-import/pack-import.d.ts +11 -0
- package/dist/pack-import/pack-import.d.ts.map +1 -0
- package/dist/remote-config/index.d.ts +7 -0
- package/dist/remote-config/index.d.ts.map +1 -0
- package/dist/remote-config/remote-config-store.d.ts +93 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -0
- package/dist/rename/index.d.ts +5 -0
- package/dist/rename/index.d.ts.map +1 -0
- package/dist/rename/similarity-index.d.ts +64 -0
- package/dist/rename/similarity-index.d.ts.map +1 -0
- package/dist/results/cherry-pick-result.d.ts +33 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -0
- package/dist/results/clone-result.d.ts +24 -0
- package/dist/results/clone-result.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +77 -0
- package/dist/results/diff-entry.d.ts.map +1 -0
- package/dist/results/diff-formatter.d.ts +149 -0
- package/dist/results/diff-formatter.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +78 -0
- package/dist/results/fetch-result.d.ts.map +1 -0
- package/dist/results/index.d.ts +14 -0
- package/dist/results/index.d.ts.map +1 -0
- package/dist/results/index.js +247 -0
- package/dist/results/init-result.d.ts +23 -0
- package/dist/results/init-result.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +117 -0
- package/dist/results/merge-result.d.ts.map +1 -0
- package/dist/results/pull-result.d.ts +24 -0
- package/dist/results/pull-result.d.ts.map +1 -0
- package/dist/results/push-result.d.ts +71 -0
- package/dist/results/push-result.d.ts.map +1 -0
- package/dist/results/rebase-result.d.ts +108 -0
- package/dist/results/rebase-result.d.ts.map +1 -0
- package/dist/results/revert-result.d.ts +33 -0
- package/dist/results/revert-result.d.ts.map +1 -0
- package/dist/results/stash-result.d.ts +48 -0
- package/dist/results/stash-result.d.ts.map +1 -0
- package/dist/results/status-result.d.ts +48 -0
- package/dist/results/status-result.d.ts.map +1 -0
- package/dist/status-result-BwAyxq6R.js +409 -0
- package/dist/transport-command.d.ts +83 -0
- package/dist/transport-command.d.ts.map +1 -0
- package/dist/tree-merge/index.d.ts +8 -0
- package/dist/tree-merge/index.d.ts.map +1 -0
- package/dist/tree-merge/tree-merge.d.ts +41 -0
- package/dist/tree-merge/tree-merge.d.ts.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AddCommand - Stage files from working tree to index.
|
|
3
|
+
*
|
|
4
|
+
* Implements JGit-compatible fluent API for `git add` command:
|
|
5
|
+
* - Add new files to index
|
|
6
|
+
* - Update modified files in index
|
|
7
|
+
* - Optionally remove deleted files (--all mode)
|
|
8
|
+
* - Support for update-only mode (-u flag)
|
|
9
|
+
*
|
|
10
|
+
* Reference: jgit/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Add specific files
|
|
15
|
+
* await git.add()
|
|
16
|
+
* .addFilepattern("src/")
|
|
17
|
+
* .addFilepattern("lib/")
|
|
18
|
+
* .call();
|
|
19
|
+
*
|
|
20
|
+
* // Update only tracked files (git add -u)
|
|
21
|
+
* await git.add()
|
|
22
|
+
* .addFilepattern(".")
|
|
23
|
+
* .setUpdate(true)
|
|
24
|
+
* .call();
|
|
25
|
+
*
|
|
26
|
+
* // Add all changes including deletions (git add -A)
|
|
27
|
+
* await git.add()
|
|
28
|
+
* .addFilepattern(".")
|
|
29
|
+
* .setAll(true)
|
|
30
|
+
* .call();
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import { type Worktree } from "@statewalker/vcs-working-tree";
|
|
34
|
+
import { GitCommand } from "../git-command.js";
|
|
35
|
+
/**
|
|
36
|
+
* Result of AddCommand execution.
|
|
37
|
+
*
|
|
38
|
+
* Contains lists of affected paths.
|
|
39
|
+
*/
|
|
40
|
+
export interface AddResult {
|
|
41
|
+
/** Paths that were added or updated in the index */
|
|
42
|
+
readonly added: string[];
|
|
43
|
+
/** Paths that were skipped (ignored files) */
|
|
44
|
+
readonly skipped: string[];
|
|
45
|
+
/** Paths that were removed from index (deleted files in --all mode) */
|
|
46
|
+
readonly removed: string[];
|
|
47
|
+
/** Total number of files processed */
|
|
48
|
+
readonly totalProcessed: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Command to stage files from working tree to index.
|
|
52
|
+
*
|
|
53
|
+
* Based on JGit's AddCommand. Provides fluent builder API
|
|
54
|
+
* for staging files with various options.
|
|
55
|
+
*/
|
|
56
|
+
export declare class AddCommand extends GitCommand<AddResult> {
|
|
57
|
+
private filepatterns;
|
|
58
|
+
private update;
|
|
59
|
+
private all;
|
|
60
|
+
private force;
|
|
61
|
+
private intentToAdd;
|
|
62
|
+
private worktreeIterator;
|
|
63
|
+
/**
|
|
64
|
+
* Add a path to a file/directory whose content should be added.
|
|
65
|
+
*
|
|
66
|
+
* A directory name (e.g., "src" to add "src/file1" and "src/file2")
|
|
67
|
+
* can also be given to add all files in the directory recursively.
|
|
68
|
+
*
|
|
69
|
+
* If pattern "." is added, all changes in the repository will be added.
|
|
70
|
+
*
|
|
71
|
+
* @param filepattern Repository-relative path (with "/" as separator)
|
|
72
|
+
* @returns this for chaining
|
|
73
|
+
*/
|
|
74
|
+
addFilepattern(filepattern: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set whether to only match against already tracked files.
|
|
77
|
+
*
|
|
78
|
+
* If true, stages modified tracked files and removes deleted
|
|
79
|
+
* tracked files from index, but never adds new files.
|
|
80
|
+
*
|
|
81
|
+
* Equivalent to `git add -u`.
|
|
82
|
+
*
|
|
83
|
+
* @param update Whether to only update tracked files
|
|
84
|
+
* @returns this for chaining
|
|
85
|
+
*/
|
|
86
|
+
setUpdate(update: boolean): this;
|
|
87
|
+
/**
|
|
88
|
+
* Whether update mode is enabled.
|
|
89
|
+
*/
|
|
90
|
+
isUpdate(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Set whether to also stage deletions.
|
|
93
|
+
*
|
|
94
|
+
* If true, removed files in the working tree will be
|
|
95
|
+
* removed from the index as well.
|
|
96
|
+
*
|
|
97
|
+
* Equivalent to `git add -A` or `git add --all`.
|
|
98
|
+
*
|
|
99
|
+
* @param all Whether to stage deletions
|
|
100
|
+
* @returns this for chaining
|
|
101
|
+
*/
|
|
102
|
+
setAll(all: boolean): this;
|
|
103
|
+
/**
|
|
104
|
+
* Whether --all mode is enabled.
|
|
105
|
+
*/
|
|
106
|
+
isAll(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Set whether to add ignored files.
|
|
109
|
+
*
|
|
110
|
+
* If true, files normally ignored by .gitignore will be added.
|
|
111
|
+
*
|
|
112
|
+
* Equivalent to `git add -f` or `git add --force`.
|
|
113
|
+
*
|
|
114
|
+
* @param force Whether to add ignored files
|
|
115
|
+
* @returns this for chaining
|
|
116
|
+
*/
|
|
117
|
+
setForce(force: boolean): this;
|
|
118
|
+
/**
|
|
119
|
+
* Whether force mode is enabled.
|
|
120
|
+
*/
|
|
121
|
+
isForce(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Set whether to only record intent to add.
|
|
124
|
+
*
|
|
125
|
+
* If true, files are added as "intent to add" placeholders
|
|
126
|
+
* without staging their content.
|
|
127
|
+
*
|
|
128
|
+
* Equivalent to `git add -N` or `git add --intent-to-add`.
|
|
129
|
+
*
|
|
130
|
+
* @param intentToAdd Whether to only record intent
|
|
131
|
+
* @returns this for chaining
|
|
132
|
+
*/
|
|
133
|
+
setIntentToAdd(intentToAdd: boolean): this;
|
|
134
|
+
/**
|
|
135
|
+
* Whether intent-to-add mode is enabled.
|
|
136
|
+
*/
|
|
137
|
+
isIntentToAdd(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Set a custom working tree iterator.
|
|
140
|
+
*
|
|
141
|
+
* Allows using a custom implementation for filesystem access.
|
|
142
|
+
*
|
|
143
|
+
* @param iterator Custom working tree iterator
|
|
144
|
+
* @returns this for chaining
|
|
145
|
+
*/
|
|
146
|
+
setWorktreeStore(iterator: Worktree): this;
|
|
147
|
+
/**
|
|
148
|
+
* Execute the add command.
|
|
149
|
+
*
|
|
150
|
+
* @returns Result with lists of added, skipped, and removed paths
|
|
151
|
+
* @throws NoFilepatternError if no file patterns specified and not in update/all mode
|
|
152
|
+
* @throws Error if working tree iterator not available
|
|
153
|
+
*/
|
|
154
|
+
call(): Promise<AddResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Get working tree iterator from store or explicitly set.
|
|
157
|
+
*/
|
|
158
|
+
private getWorktreeIterator;
|
|
159
|
+
/**
|
|
160
|
+
* Process files for staging.
|
|
161
|
+
*/
|
|
162
|
+
private processFiles;
|
|
163
|
+
/**
|
|
164
|
+
* Store file content as blob and return object ID.
|
|
165
|
+
*
|
|
166
|
+
* Note: The object store handles blob header internally.
|
|
167
|
+
*/
|
|
168
|
+
private storeFileContent;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=add-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-command.d.ts","sourceRoot":"","sources":["../../src/commands/add-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAEzB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAE3B,sCAAsC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAsED;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,UAAU,CAAC,SAAS,CAAC;IACnD,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAuB;IAE/C;;;;;;;;;;OAUG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIxC;IAED;;;;;;;;;;OAUG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAI/B;IAED;;OAEG;IACH,QAAQ,IAAI,OAAO,CAElB;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAIzB;IAED;;OAEG;IACH,KAAK,IAAI,OAAO,CAEf;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI7B;IAED;;OAEG;IACH,OAAO,IAAI,OAAO,CAEjB;IAED;;;;;;;;;;OAUG;IACH,cAAc,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAIzC;IAED;;OAEG;IACH,aAAa,IAAI,OAAO,CAEvB;IAED;;;;;;;OAOG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIzC;IAED;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,CAAC,CA0C/B;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;OAEG;YACW,YAAY;IA0I1B;;;;OAIG;YACW,gBAAgB;CAU/B"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import type { Commit, ObjectId, PersonIdent } from "@statewalker/vcs-core";
|
|
2
|
+
import { type SupportedAlgorithm } from "@statewalker/vcs-utils";
|
|
3
|
+
import { GitCommand } from "../git-command.js";
|
|
4
|
+
/**
|
|
5
|
+
* A single blame entry - represents authorship of one or more consecutive lines.
|
|
6
|
+
*/
|
|
7
|
+
export interface BlameEntry {
|
|
8
|
+
/** The commit that introduced these lines */
|
|
9
|
+
commit: Commit;
|
|
10
|
+
/** The commit ID */
|
|
11
|
+
commitId: ObjectId;
|
|
12
|
+
/** Original path in the source commit (may differ due to renames) */
|
|
13
|
+
sourcePath: string;
|
|
14
|
+
/** Starting line number in the original file (1-based) */
|
|
15
|
+
sourceStart: number;
|
|
16
|
+
/** Starting line number in the result file (1-based) */
|
|
17
|
+
resultStart: number;
|
|
18
|
+
/** Number of lines in this region */
|
|
19
|
+
lineCount: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Detailed tracking information for a single line.
|
|
23
|
+
*
|
|
24
|
+
* Based on JGit's per-line tracking arrays in BlameResult.
|
|
25
|
+
* This provides complete origin information for each line in the result file.
|
|
26
|
+
*/
|
|
27
|
+
export interface LineTracking {
|
|
28
|
+
/** Line number in the result file (1-based) */
|
|
29
|
+
resultLine: number;
|
|
30
|
+
/** The commit that introduced this line */
|
|
31
|
+
commit: Commit;
|
|
32
|
+
/** The commit ID */
|
|
33
|
+
commitId: ObjectId;
|
|
34
|
+
/** Path in the source commit where this line originated (may differ due to renames) */
|
|
35
|
+
sourcePath: string;
|
|
36
|
+
/** Line number in the source file (1-based) */
|
|
37
|
+
sourceLine: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Result of a blame operation.
|
|
41
|
+
*
|
|
42
|
+
* Contains per-line authorship information for a file.
|
|
43
|
+
*/
|
|
44
|
+
export interface BlameResult {
|
|
45
|
+
/** Path of the blamed file */
|
|
46
|
+
path: string;
|
|
47
|
+
/** Total number of lines in the file */
|
|
48
|
+
lineCount: number;
|
|
49
|
+
/** Blame entries covering all lines */
|
|
50
|
+
entries: BlameEntry[];
|
|
51
|
+
/**
|
|
52
|
+
* Get the blame entry for a specific line (1-based).
|
|
53
|
+
*
|
|
54
|
+
* @param line Line number (1-based)
|
|
55
|
+
* @returns Blame entry for that line, or undefined if out of range
|
|
56
|
+
*/
|
|
57
|
+
getEntry(line: number): BlameEntry | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get the commit that introduced a specific line.
|
|
60
|
+
*
|
|
61
|
+
* @param line Line number (1-based)
|
|
62
|
+
* @returns Commit or undefined if out of range
|
|
63
|
+
*/
|
|
64
|
+
getSourceCommit(line: number): Commit | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Get the author of a specific line.
|
|
67
|
+
*
|
|
68
|
+
* @param line Line number (1-based)
|
|
69
|
+
* @returns PersonIdent or undefined if out of range
|
|
70
|
+
*/
|
|
71
|
+
getSourceAuthor(line: number): PersonIdent | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Get the source line number in the original file.
|
|
74
|
+
*
|
|
75
|
+
* This returns the line number in the source commit where this line originated.
|
|
76
|
+
* When a file has been modified through history with insertions/deletions,
|
|
77
|
+
* the source line number may differ from the result line number.
|
|
78
|
+
*
|
|
79
|
+
* @param line Line number in the result file (1-based)
|
|
80
|
+
* @returns Source line number (1-based), or undefined if out of range
|
|
81
|
+
*/
|
|
82
|
+
getSourceLine(line: number): number | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Get the source path for a specific line.
|
|
85
|
+
*
|
|
86
|
+
* This returns the file path in the source commit. When rename tracking
|
|
87
|
+
* is enabled, this may differ from the result path if the line originated
|
|
88
|
+
* from a file with a different name.
|
|
89
|
+
*
|
|
90
|
+
* @param line Line number in the result file (1-based)
|
|
91
|
+
* @returns Source path, or undefined if out of range
|
|
92
|
+
*/
|
|
93
|
+
getSourcePath(line: number): string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Get detailed tracking information for all lines.
|
|
96
|
+
*
|
|
97
|
+
* Returns an array of LineTracking objects, one per line in the result file.
|
|
98
|
+
* Each object contains complete origin information including the commit,
|
|
99
|
+
* source path, and source line number.
|
|
100
|
+
*
|
|
101
|
+
* @returns Array of LineTracking objects ordered by result line number
|
|
102
|
+
*/
|
|
103
|
+
getLineTracking(): LineTracking[];
|
|
104
|
+
}
|
|
105
|
+
export declare class BlameCommand extends GitCommand<BlameResult> {
|
|
106
|
+
private filePath?;
|
|
107
|
+
private startCommit?;
|
|
108
|
+
private followRenames;
|
|
109
|
+
private renameScore;
|
|
110
|
+
private diffAlgorithm;
|
|
111
|
+
/**
|
|
112
|
+
* Set the file path to blame.
|
|
113
|
+
*
|
|
114
|
+
* @param path Repository-relative path to the file
|
|
115
|
+
*/
|
|
116
|
+
setFilePath(path: string): this;
|
|
117
|
+
/**
|
|
118
|
+
* Set the starting commit for blame.
|
|
119
|
+
*
|
|
120
|
+
* If not set, defaults to HEAD.
|
|
121
|
+
*
|
|
122
|
+
* @param commit ObjectId of the starting commit
|
|
123
|
+
*/
|
|
124
|
+
setStartCommit(commit: ObjectId): this;
|
|
125
|
+
/**
|
|
126
|
+
* Set whether to follow file renames.
|
|
127
|
+
*
|
|
128
|
+
* When enabled, the blame will track lines through renames.
|
|
129
|
+
* This is more accurate but slower.
|
|
130
|
+
*
|
|
131
|
+
* @param follow Whether to follow renames
|
|
132
|
+
*/
|
|
133
|
+
setFollowRenames(follow: boolean): this;
|
|
134
|
+
/**
|
|
135
|
+
* Set the minimum similarity score for rename detection.
|
|
136
|
+
*
|
|
137
|
+
* @param score Similarity threshold (0-100, default 50)
|
|
138
|
+
*/
|
|
139
|
+
setRenameScore(score: number): this;
|
|
140
|
+
/**
|
|
141
|
+
* Set the diff algorithm to use.
|
|
142
|
+
*
|
|
143
|
+
* @param algorithm The algorithm to use (default: histogram)
|
|
144
|
+
*/
|
|
145
|
+
setAlgorithm(algorithm: SupportedAlgorithm): this;
|
|
146
|
+
/**
|
|
147
|
+
* Execute the blame command.
|
|
148
|
+
*
|
|
149
|
+
* Uses a queue-based algorithm similar to JGit's BlameGenerator.
|
|
150
|
+
* For merge commits, checks all parents to correctly attribute lines.
|
|
151
|
+
*
|
|
152
|
+
* @returns BlameResult with per-line authorship
|
|
153
|
+
*/
|
|
154
|
+
call(): Promise<BlameResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Process a commit with a single parent.
|
|
157
|
+
*
|
|
158
|
+
* @returns Number of lines blamed to this commit
|
|
159
|
+
*/
|
|
160
|
+
private processOneParent;
|
|
161
|
+
/**
|
|
162
|
+
* Process a merge commit with multiple parents.
|
|
163
|
+
* Based on JGit's processMerge() algorithm.
|
|
164
|
+
*
|
|
165
|
+
* Key algorithm:
|
|
166
|
+
* 1. If any parent has identical blob, pass all blame to that parent
|
|
167
|
+
* 2. Otherwise, for each parent that has the file, compute diff
|
|
168
|
+
* 3. Lines that match a parent go to that parent's history
|
|
169
|
+
* 4. Lines that don't match any parent (conflict resolution) are blamed to merge commit
|
|
170
|
+
*
|
|
171
|
+
* @returns Number of lines blamed to the merge commit
|
|
172
|
+
*/
|
|
173
|
+
private processMerge;
|
|
174
|
+
/**
|
|
175
|
+
* Split blame between a candidate and its parent using diff edits.
|
|
176
|
+
* Based on JGit's Candidate.takeBlame() method.
|
|
177
|
+
*
|
|
178
|
+
* For each line in the child that is unchanged (not covered by an edit),
|
|
179
|
+
* we need to find where that line came from in the parent. Due to insertions
|
|
180
|
+
* and deletions, unchanged lines in the child may not be contiguous in the parent.
|
|
181
|
+
*
|
|
182
|
+
* @returns Object with regions for parent and regions remaining with child
|
|
183
|
+
*/
|
|
184
|
+
private takeBlame;
|
|
185
|
+
/**
|
|
186
|
+
* Add parent regions for an unchanged block of lines.
|
|
187
|
+
* Since lines may map to non-contiguous positions in the parent
|
|
188
|
+
* (due to deletions), we need to create separate regions for each
|
|
189
|
+
* contiguous block in the parent.
|
|
190
|
+
*/
|
|
191
|
+
private addParentRegionsForUnchangedBlock;
|
|
192
|
+
/**
|
|
193
|
+
* Map a position in the child file back to the corresponding position in the parent.
|
|
194
|
+
* Takes into account insertions and deletions.
|
|
195
|
+
*
|
|
196
|
+
* @param childPos 0-based position in child
|
|
197
|
+
* @param edits Edit list from diff
|
|
198
|
+
* @returns 0-based position in parent
|
|
199
|
+
*/
|
|
200
|
+
private mapPositionToParent;
|
|
201
|
+
/**
|
|
202
|
+
* Split blame between a candidate and a single parent.
|
|
203
|
+
*
|
|
204
|
+
* @returns Number of lines blamed to the candidate
|
|
205
|
+
*/
|
|
206
|
+
private splitBlame;
|
|
207
|
+
/**
|
|
208
|
+
* Push a candidate onto the queue, maintaining descending time order.
|
|
209
|
+
* Handles merging of candidates for the same commit.
|
|
210
|
+
*/
|
|
211
|
+
private pushCandidate;
|
|
212
|
+
/**
|
|
213
|
+
* Merge two region lists, maintaining sorted order by resultStart.
|
|
214
|
+
*/
|
|
215
|
+
private mergeBlameRegions;
|
|
216
|
+
/**
|
|
217
|
+
* Blame all regions in a candidate to its commit.
|
|
218
|
+
*/
|
|
219
|
+
private blameRegions;
|
|
220
|
+
/**
|
|
221
|
+
* Count total lines in a list of regions.
|
|
222
|
+
*/
|
|
223
|
+
private countRegionLines;
|
|
224
|
+
/**
|
|
225
|
+
* Find a rename candidate for a file that doesn't exist in the parent commit.
|
|
226
|
+
*
|
|
227
|
+
* Searches for deleted files in the parent that have similar content to the
|
|
228
|
+
* file in the current commit.
|
|
229
|
+
*
|
|
230
|
+
* @param parentTreeId Tree ID of the parent commit
|
|
231
|
+
* @param currentTreeId Tree ID of the current commit
|
|
232
|
+
* @param newPath Path of the file in the current commit
|
|
233
|
+
* @param newContent Content of the file in the current commit
|
|
234
|
+
* @returns Rename information if found, undefined otherwise
|
|
235
|
+
*/
|
|
236
|
+
private findRename;
|
|
237
|
+
/**
|
|
238
|
+
* Collect all blob entries from a tree recursively.
|
|
239
|
+
*/
|
|
240
|
+
private collectTreeEntries;
|
|
241
|
+
/**
|
|
242
|
+
* Collect blob content into a single buffer.
|
|
243
|
+
*/
|
|
244
|
+
private collectBlob;
|
|
245
|
+
/**
|
|
246
|
+
* Get blob ID for a file in a tree.
|
|
247
|
+
*/
|
|
248
|
+
private getFileBlob;
|
|
249
|
+
/**
|
|
250
|
+
* Count lines in content.
|
|
251
|
+
*
|
|
252
|
+
* Recognizes three types of line endings:
|
|
253
|
+
* - LF (\n) - Unix style
|
|
254
|
+
* - CRLF (\r\n) - Windows style (counts as one line ending)
|
|
255
|
+
* - CR (\r) - Classic Mac style (standalone CR without following LF)
|
|
256
|
+
*/
|
|
257
|
+
private countLines;
|
|
258
|
+
/**
|
|
259
|
+
* Merge adjacent entries from the same commit and source path.
|
|
260
|
+
*/
|
|
261
|
+
private mergeAdjacentEntries;
|
|
262
|
+
/**
|
|
263
|
+
* Create a BlameResult from entries.
|
|
264
|
+
*/
|
|
265
|
+
private createBlameResult;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=blame-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blame-command.d.ts","sourceRoot":"","sources":["../../src/commands/blame-command.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { ObjectId, Ref } from "@statewalker/vcs-core";
|
|
2
|
+
import { GitCommand } from "../git-command.js";
|
|
3
|
+
import { ListBranchMode } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Create a new branch.
|
|
6
|
+
*
|
|
7
|
+
* Equivalent to `git branch <name>`.
|
|
8
|
+
*
|
|
9
|
+
* Based on JGit's CreateBranchCommand.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Create branch from HEAD
|
|
14
|
+
* await git.branchCreate().setName("feature").call();
|
|
15
|
+
*
|
|
16
|
+
* // Create branch from specific commit
|
|
17
|
+
* await git.branchCreate()
|
|
18
|
+
* .setName("hotfix")
|
|
19
|
+
* .setStartPoint("abc123")
|
|
20
|
+
* .call();
|
|
21
|
+
*
|
|
22
|
+
* // Force create (overwrite existing)
|
|
23
|
+
* await git.branchCreate()
|
|
24
|
+
* .setName("existing")
|
|
25
|
+
* .setForce(true)
|
|
26
|
+
* .call();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class CreateBranchCommand extends GitCommand<Ref> {
|
|
30
|
+
private name?;
|
|
31
|
+
private startPoint?;
|
|
32
|
+
private force;
|
|
33
|
+
/**
|
|
34
|
+
* Set the name of the branch to create.
|
|
35
|
+
*
|
|
36
|
+
* @param name Branch name (without refs/heads/ prefix)
|
|
37
|
+
*/
|
|
38
|
+
setName(name: string): this;
|
|
39
|
+
/**
|
|
40
|
+
* Set the starting point for the new branch.
|
|
41
|
+
*
|
|
42
|
+
* Can be a commit ID, branch name, or tag name.
|
|
43
|
+
* If not set, defaults to HEAD.
|
|
44
|
+
*
|
|
45
|
+
* @param startPoint Commit-ish to start from
|
|
46
|
+
*/
|
|
47
|
+
setStartPoint(startPoint: string): this;
|
|
48
|
+
/**
|
|
49
|
+
* Set whether to force create the branch.
|
|
50
|
+
*
|
|
51
|
+
* If true, overwrites an existing branch.
|
|
52
|
+
*
|
|
53
|
+
* @param force Whether to force create
|
|
54
|
+
*/
|
|
55
|
+
setForce(force: boolean): this;
|
|
56
|
+
/**
|
|
57
|
+
* Execute the branch creation.
|
|
58
|
+
*
|
|
59
|
+
* @returns The created branch ref
|
|
60
|
+
* @throws InvalidRefNameError if branch name is invalid
|
|
61
|
+
* @throws RefAlreadyExistsError if branch exists and force is false
|
|
62
|
+
*/
|
|
63
|
+
call(): Promise<Ref>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Delete branches.
|
|
67
|
+
*
|
|
68
|
+
* Equivalent to `git branch -d` or `git branch -D`.
|
|
69
|
+
*
|
|
70
|
+
* Based on JGit's DeleteBranchCommand.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Delete a single branch
|
|
75
|
+
* await git.branchDelete().setBranchNames("feature").call();
|
|
76
|
+
*
|
|
77
|
+
* // Delete multiple branches
|
|
78
|
+
* await git.branchDelete()
|
|
79
|
+
* .setBranchNames("feature", "hotfix")
|
|
80
|
+
* .call();
|
|
81
|
+
*
|
|
82
|
+
* // Force delete (even if not merged)
|
|
83
|
+
* await git.branchDelete()
|
|
84
|
+
* .setBranchNames("feature")
|
|
85
|
+
* .setForce(true)
|
|
86
|
+
* .call();
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare class DeleteBranchCommand extends GitCommand<string[]> {
|
|
90
|
+
private branchNames;
|
|
91
|
+
private force;
|
|
92
|
+
/**
|
|
93
|
+
* Set the branches to delete.
|
|
94
|
+
*
|
|
95
|
+
* @param names Branch names (without refs/heads/ prefix)
|
|
96
|
+
*/
|
|
97
|
+
setBranchNames(...names: string[]): this;
|
|
98
|
+
/**
|
|
99
|
+
* Set whether to force delete.
|
|
100
|
+
*
|
|
101
|
+
* If true, deletes even if branch is not fully merged.
|
|
102
|
+
*
|
|
103
|
+
* @param force Whether to force delete
|
|
104
|
+
*/
|
|
105
|
+
setForce(force: boolean): this;
|
|
106
|
+
/**
|
|
107
|
+
* Execute the branch deletion.
|
|
108
|
+
*
|
|
109
|
+
* @returns List of deleted branch names (full ref names)
|
|
110
|
+
* @throws CannotDeleteCurrentBranchError if trying to delete current branch
|
|
111
|
+
* @throws RefNotFoundError if branch doesn't exist
|
|
112
|
+
* @throws NotMergedError if branch is not merged and force is false
|
|
113
|
+
*/
|
|
114
|
+
call(): Promise<string[]>;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a branch is fully merged into HEAD or upstream.
|
|
117
|
+
*/
|
|
118
|
+
private isBranchMerged;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* List branches.
|
|
122
|
+
*
|
|
123
|
+
* Equivalent to `git branch -l`.
|
|
124
|
+
*
|
|
125
|
+
* Based on JGit's ListBranchCommand.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* // List local branches
|
|
130
|
+
* const branches = await git.branchList().call();
|
|
131
|
+
*
|
|
132
|
+
* // List remote branches
|
|
133
|
+
* const remote = await git.branchList()
|
|
134
|
+
* .setListMode(ListBranchMode.REMOTE)
|
|
135
|
+
* .call();
|
|
136
|
+
*
|
|
137
|
+
* // List all branches
|
|
138
|
+
* const all = await git.branchList()
|
|
139
|
+
* .setListMode(ListBranchMode.ALL)
|
|
140
|
+
* .call();
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare class ListBranchCommand extends GitCommand<Ref[]> {
|
|
144
|
+
private listMode;
|
|
145
|
+
private containsCommit?;
|
|
146
|
+
/**
|
|
147
|
+
* Set the listing mode.
|
|
148
|
+
*
|
|
149
|
+
* @param mode Which branches to list
|
|
150
|
+
*/
|
|
151
|
+
setListMode(mode: ListBranchMode): this;
|
|
152
|
+
/**
|
|
153
|
+
* Filter to branches containing the given commit.
|
|
154
|
+
*
|
|
155
|
+
* @param commit Commit that must be in branch history
|
|
156
|
+
*/
|
|
157
|
+
setContains(commit: ObjectId): this;
|
|
158
|
+
/**
|
|
159
|
+
* Execute the branch listing.
|
|
160
|
+
*
|
|
161
|
+
* @returns List of branch refs
|
|
162
|
+
*/
|
|
163
|
+
call(): Promise<Ref[]>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Rename a branch.
|
|
167
|
+
*
|
|
168
|
+
* Equivalent to `git branch -m`.
|
|
169
|
+
*
|
|
170
|
+
* Based on JGit's RenameBranchCommand.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* // Rename current branch
|
|
175
|
+
* await git.branchRename().setNewName("new-name").call();
|
|
176
|
+
*
|
|
177
|
+
* // Rename specific branch
|
|
178
|
+
* await git.branchRename()
|
|
179
|
+
* .setOldName("old-branch")
|
|
180
|
+
* .setNewName("new-branch")
|
|
181
|
+
* .call();
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
export declare class RenameBranchCommand extends GitCommand<Ref> {
|
|
185
|
+
private oldName?;
|
|
186
|
+
private newName?;
|
|
187
|
+
/**
|
|
188
|
+
* Set the old branch name.
|
|
189
|
+
*
|
|
190
|
+
* If not set, uses the current branch.
|
|
191
|
+
*
|
|
192
|
+
* @param oldName Current branch name
|
|
193
|
+
*/
|
|
194
|
+
setOldName(oldName: string): this;
|
|
195
|
+
/**
|
|
196
|
+
* Set the new branch name.
|
|
197
|
+
*
|
|
198
|
+
* @param newName New branch name
|
|
199
|
+
*/
|
|
200
|
+
setNewName(newName: string): this;
|
|
201
|
+
/**
|
|
202
|
+
* Execute the branch rename.
|
|
203
|
+
*
|
|
204
|
+
* @returns The renamed branch ref
|
|
205
|
+
* @throws InvalidRefNameError if new name is invalid
|
|
206
|
+
* @throws RefNotFoundError if old branch doesn't exist
|
|
207
|
+
* @throws RefAlreadyExistsError if new branch already exists
|
|
208
|
+
*/
|
|
209
|
+
call(): Promise<Ref>;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=branch-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch-command.d.ts","sourceRoot":"","sources":["../../src/commands/branch-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAU3D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqD7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,GAAG,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,KAAK,CAAS;IAEtB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;;;;;;OAOG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAItC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI7B;IAED;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CA6BzB;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,MAAM,EAAE,CAAC;IAC3D,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,KAAK,CAAS;IAEtB;;;;OAIG;IACH,cAAc,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAIvC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI7B;IAED;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAiC9B;IAED;;OAEG;YACW,cAAc;CAe7B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,GAAG,EAAE,CAAC;IACtD,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,cAAc,CAAC,CAAW;IAElC;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAItC;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAIlC;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAqC3B;CACF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,GAAG,CAAC;IACtD,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAkDzB;CACF"}
|