diff --git a/types/nodegit/checkout-options.d.ts b/types/nodegit/checkout-options.d.ts index cd23a70ede..c799ce2047 100644 --- a/types/nodegit/checkout-options.d.ts +++ b/types/nodegit/checkout-options.d.ts @@ -11,9 +11,9 @@ export interface CheckoutOptions { fileOpenFlags?: number; notifyFlags?: number; notifyCb?: any; - notifyPayload?: void; + notifyPayload?: undefined; progressCb?: any; - progressPayload?: void; + progressPayload?: undefined; paths?: Strarray; baseline?: Tree; baselineIndex?: Index; @@ -22,5 +22,5 @@ export interface CheckoutOptions { ourLabel?: string; theirLabel?: string; perfdataCb?: any; - perfdataPayload?: void; + perfdataPayload?: undefined; } diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 3980ce080e..24ee08cc48 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -1,3 +1,5 @@ +import { EventEmitter } from 'events'; + import { Repository } from './repository'; import { Signature } from './signature'; import { Oid } from './oid'; diff --git a/types/nodegit/config.d.ts b/types/nodegit/config.d.ts new file mode 100644 index 0000000000..ad8df1a327 --- /dev/null +++ b/types/nodegit/config.d.ts @@ -0,0 +1,22 @@ +import { Buf } from './buf'; + +export namespace Config { + enum LEVEL { + SYSTEM = 1, + XDG = 2, + GLOBAL = 3, + LOCAL = 4, + APP = 5, + HIGHEST_LEVEL = -1 + } +} + +export class Config { + static openDefault(): Promise; + + getStringBuf(name: string): Promise; + setInt64(name: string, value: number): number; + setMultivar(name: string, regexp: string, value: string): number; + setString(name: string, value: string): Promise; + snapshot(): Promise; +} diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index ab3b3aa2c8..d8b60e1c6a 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -22,7 +22,7 @@ export interface DiffOptions { ignoreSubmodules: number; pathspec: Strarray; notifyCb: Function; - notifyPayload: void; + notifyPayload: undefined; contextLines: number; interhunkLines: number; idAbbrev: number; @@ -139,7 +139,8 @@ export namespace Diff { } export class Diff { - static blobToBuffer(old_blob: Blob, old_as_path: string, buffer: string, buffer_as_path: string, opts: DiffOptions, file_cb: Function, binary_cb: Function, hunk_cb: Function, line_cb: Function): Promise; + static blobToBuffer(old_blob: Blob, oldAsPath: string, + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; diff --git a/types/nodegit/index-entry.d.ts b/types/nodegit/index-entry.d.ts index a6591e37b9..f2ac5cad8a 100644 --- a/types/nodegit/index-entry.d.ts +++ b/types/nodegit/index-entry.d.ts @@ -1,6 +1,6 @@ import { Oid } from './oid'; -interface IndexTime { +export interface IndexTime { seconds: number; nanoseconds: number; } diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 92307a1abb..10e7c3483a 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -8,25 +8,35 @@ export { Blob } from './blob'; export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; +export { Config } from './config'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; -export { IndexEntry } from './index-entry'; export { Index } from './index_'; +export { IndexEntry } from './index-entry'; +export { MergeFileInput } from './merge-file-input'; +export { MergeOptions } from './merge-options'; +export { Merge } from './merge'; export { Object } from './object'; export { OdbObject } from './odb-object'; export { Odb } from './odb'; +export { Oidarray } from './oid-array'; export { Oid } from './oid'; +export { PushOptions } from './push-options'; +export { Refdb } from './ref-db'; +import { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; export { Strarray } from './str-array'; +export { Tag } from './tag'; export { Time } from './time'; +export { TransferProgress } from './transfer-progress'; export { Treebuilder } from './tree-builder'; export { TreeEntry } from './tree-entry'; export { Tree } from './tree'; diff --git a/types/nodegit/merge-file-input.d.ts b/types/nodegit/merge-file-input.d.ts new file mode 100644 index 0000000000..f49bd446ca --- /dev/null +++ b/types/nodegit/merge-file-input.d.ts @@ -0,0 +1,7 @@ +export interface MergeFileInput { + version: number; + ptr: string; + size: number; + path: string; + mode: number; +} diff --git a/types/nodegit/merge-options.d.ts b/types/nodegit/merge-options.d.ts new file mode 100644 index 0000000000..a4108c767d --- /dev/null +++ b/types/nodegit/merge-options.d.ts @@ -0,0 +1,8 @@ +export interface MergeOptions { + version: number; + treeFlags: number; + renameThreshold: number; + targetLimit: number; + fileFavor: number; + fileFlags: number; +} diff --git a/types/nodegit/merge.d.ts b/types/nodegit/merge.d.ts new file mode 100644 index 0000000000..fb135e178f --- /dev/null +++ b/types/nodegit/merge.d.ts @@ -0,0 +1,59 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Tree } from './tree'; +import { Commit } from './commit'; +import { Index } from './index'; +import { AnnotatedCommit } from './annotated-commit'; +import { CheckoutOptions } from './checkout-options'; +import { Oidarray } from './oid-array'; +import { MergeOptions } from './merge-options'; +import { MergeFileInput } from './merge-file-input'; + +export namespace Merge { + enum ANALYSIS { + NONE = 0, + NORMAL = 1, + UP_TO_DATE = 2, + FASTFORWARD = 4, + UNBORN = 8 + } + + enum FILE_FAVOR { + NORMAL = 0, + OURS = 1, + THEIRS = 2, + UNION = 3 + } + + enum FILE_FLAGS { + FILE_DEFAULT = 0, + FILE_STYLE_MERGE = 1, + FILE_STYLE_DIFF3 = 2, + FILE_SIMPLIFY_ALNUM = 4, + FILE_IGNORE_WHITESPACE = 8, + FILE_IGNORE_WHITESPACE_CHANGE = 16, + FILE_IGNORE_WHITESPACE_EOL = 32, + FILE_DIFF_PATIENCE = 64, + FILE_DIFF_MINIMAL = 128 + } + + enum PREFERENCE { + NONE = 0, + NO_FASTFORWARD = 1, + FASTFORWARD_ONLY = 2 + } + + enum TREE_FLAG { + TREE_FIND_RENAMES = 1 + } +} + +export class Merge { + static merge(repo: Repository, theirHead: AnnotatedCommit, mergeOpts?: MergeOptions, checkoutOpts?: CheckoutOptions): any; + static base(repo: Repository, one: Oid, two: Oid): Promise; + static bases(repo: Repository, one: Oid, two: Oid): Promise; + static commits(repo: Repository, ourCommit: Commit, theirCommit: Commit, options?: MergeOptions): any; + static fileInitInput(opts: MergeFileInput, version: number): number; + static initOptions(opts: MergeOptions, version: number): number; + static trees(repo: Repository, ancestor_tree: Tree, our_tree: Tree, their_tree: Tree, opts: MergeOptions): Promise; +} diff --git a/types/nodegit/oid-array.d.ts b/types/nodegit/oid-array.d.ts new file mode 100644 index 0000000000..7a96f24a7a --- /dev/null +++ b/types/nodegit/oid-array.d.ts @@ -0,0 +1,7 @@ +import { Oid } from './oid'; + +export class Oidarray { + free(): void; + ids: Oid; + count: number; +} diff --git a/types/nodegit/push-options.d.ts b/types/nodegit/push-options.d.ts new file mode 100644 index 0000000000..5187548b8f --- /dev/null +++ b/types/nodegit/push-options.d.ts @@ -0,0 +1,7 @@ +import { RemoteCallbacks } from './remote-callbacks'; + +export interface PushOptions { + version: number; + pbParallelism: number; + callbacks: RemoteCallbacks; +} diff --git a/types/nodegit/ref-db.d.ts b/types/nodegit/ref-db.d.ts new file mode 100644 index 0000000000..8c9046d48d --- /dev/null +++ b/types/nodegit/ref-db.d.ts @@ -0,0 +1,8 @@ +import { Repository } from './repository'; + +export class Refdb { + static open(repo: Repository): Promise; + + compress(): number; + free(): void; +} diff --git a/types/nodegit/ref-spec.d.ts b/types/nodegit/ref-spec.d.ts new file mode 100644 index 0000000000..bf40f21ac2 --- /dev/null +++ b/types/nodegit/ref-spec.d.ts @@ -0,0 +1,8 @@ +export class Refspec { + direction(): number; + dst(): string; + dstMatches(refname: string): number; + force(): number; + src(): string; + srcMatches(refname: string): number; +} diff --git a/types/nodegit/remote-callbacks.d.ts b/types/nodegit/remote-callbacks.d.ts index 0987b6259f..ca244e5c5e 100644 --- a/types/nodegit/remote-callbacks.d.ts +++ b/types/nodegit/remote-callbacks.d.ts @@ -1,8 +1,8 @@ -export interface RemoteCallbacks { +export class RemoteCallbacks { version?: number; credentials?: Function; certificateCheck?: Function; transferProgress?: Function; transport?: Function; - payload?: void; + payload?: undefined; } diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts index 3fc10534d4..0c3923c57c 100644 --- a/types/nodegit/remote.d.ts +++ b/types/nodegit/remote.d.ts @@ -4,6 +4,9 @@ import { Strarray } from './str-array'; import { FetchOptions } from './fetch-options'; import { Buf } from './buf'; import { Enums } from './enums'; +import { TransferProgress } from './transfer-progress'; +import { PushOptions } from './push-options'; +import { Refspec } from './ref-spec'; export namespace Remote { enum AUTOTAG_OPTION { diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index e18984bbcb..acf5f5b83a 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -12,19 +12,23 @@ import { AnnotatedCommit } from './annotated-commit'; import { FetchOptions } from './fetch-options'; import { CheckoutOptions } from './checkout-options'; import { Remote } from './remote'; +import { Tag } from './tag'; +import { Config } from './config'; +import { Merge } from './merge'; +import { MergeOptions } from './merge-options'; +import { Refdb } from './ref-db'; -interface RepositoryInitOptions { - description: string, - flags: number, - initialHead: string, - mode: number, - originUrl: string, - templatePath: string, - version: number, - workdirPath: string +export interface RepositoryInitOptions { + description: string; + flags: number; + initialHead: string; + mode: number; + originUrl: string; + templatePath: string; + version: number; + workdirPath: string; } - export class Repository { /** * Creates a branch with the passed in name pointing to the commit @@ -84,8 +88,8 @@ export class Repository { static wrapOdb(odb: Odb): Promise; cleanup(): void; - config(): Promise; - configSnapshot(): Promise; + config(): Promise; + configSnapshot(): Promise; detachHead(): number; fetchheadForeach(callback: Function): Promise; free(): void; @@ -101,7 +105,7 @@ export class Repository { messageRemove(): number; odb(): Promise; path(): string; - refdb(): Promise; + refdb(): Promise; setHead(refname: string): Promise; setHeadDetached(commitish: Oid): number; setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number; @@ -122,10 +126,10 @@ export class Repository { getCommit(string: string | Oid): Promise; getBlob(string: string | Oid): Promise; getTree(string: string | Oid): Promise; - createTag(string: string | Oid, name: string, message: string): Promise; + createTag(string: string | Oid, name: string, message: string): Promise; createLightweightTag(string: string | Oid, name: string): Promise; - getTag(string: string | Oid): Promise; - getTagByName(Short: string): Promise; + getTag(string: string | Oid): Promise; + getTagByName(Short: string): Promise; deleteTagByName(Short: string): Promise; createRevWalk(string: string | Oid): any; getMasterCommit(): Promise; @@ -139,7 +143,7 @@ export class Repository { getRemote(remote: string | Remote, callback: Function): Promise; fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; - mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: NodeGit.Merge.PREFERENCE, mergeOptions: NodeGit.MergeOptions): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: Merge.PREFERENCE, mergeOptions: MergeOptions): Promise; rebaseBranches(branch: string, upstream: string, onto: string, signature: Signature, beforeNextFn: Function): Promise; continueRebase(signature: Signature, beforeNextFn: Function): Promise; getStatus(opts: any): Promise; diff --git a/types/nodegit/tag.d.ts b/types/nodegit/tag.d.ts new file mode 100644 index 0000000000..d8f98953a0 --- /dev/null +++ b/types/nodegit/tag.d.ts @@ -0,0 +1,27 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Object } from './object'; +import { Signature } from './signature'; +import { Strarray } from './str-array'; + +export class Tag { + static annotationCreate(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string): Promise; + static create(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string, force: number): Promise; + static createLightweight(repo: Repository, tag_name: string, target: Object, force: number): Promise; + static delete(repo: Repository, tag_name: string): Promise; + static list(repo: Repository): Promise; + static listMatch(tag_names: Strarray, pattern: string, repo: Repository): number; + static lookup(repo: Repository, id: string | Oid | Tag): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + free(): void; + id(): Oid; + message(): string; + name(): string; + owner(): Repository; + peel(tag_target_out: Object): number; + tagger(): Signature; + target(): Object; + targetId(): Oid; + targetType(): number; +} diff --git a/types/nodegit/transfer-progress.d.ts b/types/nodegit/transfer-progress.d.ts new file mode 100644 index 0000000000..1589d4b6c6 --- /dev/null +++ b/types/nodegit/transfer-progress.d.ts @@ -0,0 +1,9 @@ +export class TransferProgress { + totalObjects: number; + indexedObjects: number; + receivedObjects: number; + localObjects: number; + totalDeltas: number; + indexedDeltas: number; + receivedBytes: number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index eec4787935..bfb1077c61 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -21,6 +21,7 @@ "buf.d.ts", "checkout-options.d.ts", "commit.d.ts", + "config.d.ts", "diff-delta.d.ts", "diff-file.d.ts", "diff-perf-data.d.ts", @@ -29,18 +30,27 @@ "fetch-options.d.ts", "index-entry.d.ts", "index.d.ts", + "merge-file-input.d.ts", + "merge-options.d.ts", + "merge.d.ts", "nodegit-tests.ts", "object.d.ts", "odb-object.d.ts", "odb.d.ts", + "oid-array.d.ts", "oid.d.ts", + "push-options.d.ts", + "ref-db.d.ts", + "ref-spec.d.ts", "reference.d.ts", "remote-callbacks.d.ts", "remote.d.ts", "repository.d.ts", "signature.d.ts", "str-array.d.ts", + "tag.d.ts", "time.d.ts", + "transfer-progress.d.ts", "tree-builder.d.ts", "tree-entry.d.ts", "tree.d.ts"