isomorphic-jj 1.1.3 → 1.3.0

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/src/types.d.ts CHANGED
@@ -330,6 +330,24 @@ export interface MoveFileArgs {
330
330
  to: string;
331
331
  }
332
332
 
333
+ /**
334
+ * Move change (rebase) arguments
335
+ */
336
+ export interface MoveChangeArgs {
337
+ /** Change ID to move (also accepts 'from' or 'source') */
338
+ changeId?: ChangeID;
339
+ /** Source change ID (alias for changeId) */
340
+ from?: ChangeID;
341
+ /** Source change ID (alias for changeId) */
342
+ source?: ChangeID;
343
+ /** New parent change ID (also accepts 'to' or 'destination') */
344
+ newParent?: ChangeID;
345
+ /** Destination change ID (alias for newParent) */
346
+ to?: ChangeID;
347
+ /** Destination change ID (alias for newParent) */
348
+ destination?: ChangeID;
349
+ }
350
+
333
351
  /**
334
352
  * Remove file arguments
335
353
  */
@@ -460,6 +478,8 @@ export interface UnabandonArgs {
460
478
  export interface LogOptions {
461
479
  revset?: Revset;
462
480
  limit?: number;
481
+ /** If true, return count of commits instead of commit objects */
482
+ count?: boolean;
463
483
  }
464
484
 
465
485
  /**
@@ -856,6 +876,122 @@ export interface MergeResult {
856
876
  conflicts: Conflict[];
857
877
  }
858
878
 
879
+ /**
880
+ * Absorb operation arguments
881
+ */
882
+ export interface AbsorbArgs {
883
+ /** Change to absorb into (optional, defaults to working copy parent) */
884
+ changeId?: ChangeID;
885
+ /** Destination change to absorb into (alias for changeId) */
886
+ destination?: ChangeID;
887
+ /** Dry run mode - don't apply changes */
888
+ dryRun?: boolean;
889
+ /** Specific paths to absorb */
890
+ paths?: string[];
891
+ }
892
+
893
+ /**
894
+ * Absorb operation result
895
+ */
896
+ export interface AbsorbResult {
897
+ /** Changes that were absorbed */
898
+ absorbed: Array<{
899
+ path: string;
900
+ hunks: number;
901
+ destination: ChangeID;
902
+ }>;
903
+ /** Changes affected by the absorb */
904
+ affectedChanges: ChangeID[];
905
+ /** Changes that would be absorbed (dry run mode) */
906
+ wouldAbsorb?: Array<{
907
+ path: string;
908
+ hunks: number;
909
+ destination: ChangeID;
910
+ }>;
911
+ }
912
+
913
+ /**
914
+ * Bisect start arguments
915
+ */
916
+ export interface BisectStartArgs {
917
+ /** Good change ID */
918
+ good: ChangeID;
919
+ /** Bad change ID */
920
+ bad: ChangeID;
921
+ }
922
+
923
+ /**
924
+ * Bisect state
925
+ */
926
+ export interface BisectState {
927
+ /** Whether bisect is active */
928
+ active: boolean;
929
+ /** Good change */
930
+ good?: ChangeID;
931
+ /** Bad change */
932
+ bad?: ChangeID;
933
+ /** Current change being tested */
934
+ current?: ChangeID;
935
+ /** Remaining changes to test */
936
+ remaining?: number;
937
+ }
938
+
939
+ /**
940
+ * Sparse checkout set arguments
941
+ */
942
+ export interface SparseSetArgs {
943
+ /** Patterns to set (replaces existing patterns) */
944
+ patterns: string[];
945
+ }
946
+
947
+ /**
948
+ * Sparse checkout add arguments
949
+ */
950
+ export interface SparseAddArgs {
951
+ /** Patterns to add to existing sparse checkout */
952
+ patterns: string[];
953
+ }
954
+
955
+ /**
956
+ * Sparse checkout remove arguments
957
+ */
958
+ export interface SparseRemoveArgs {
959
+ /** Patterns to remove from sparse checkout */
960
+ patterns: string[];
961
+ }
962
+
963
+ /**
964
+ * Merge driver for custom file merging
965
+ */
966
+ export interface MergeDriver {
967
+ /** Driver name */
968
+ name: string;
969
+ /** Detect if this driver should handle a file */
970
+ detect(path: string, content: string): boolean;
971
+ /** Merge three versions of a file */
972
+ merge(args: {
973
+ path: string;
974
+ base: string;
975
+ ours: string;
976
+ theirs: string;
977
+ }): {
978
+ merged: string;
979
+ conflicts?: Array<{ line: number; message: string }>;
980
+ };
981
+ }
982
+
983
+ /**
984
+ * Merge driver registry
985
+ */
986
+ export interface MergeDriverRegistry {
987
+ /** Register a custom merge driver */
988
+ register(driver: MergeDriver): void;
989
+ /** Get driver for a file path */
990
+ getDriver(path: string, content: string): MergeDriver | null;
991
+ /** List all registered drivers */
992
+ list(): MergeDriver[];
993
+ }
994
+
859
995
  // ============================================================================
860
996
  // Main JJ Repository Interface
861
997
  // ============================================================================
@@ -875,6 +1011,7 @@ export interface JJ {
875
1011
  revset: any;
876
1012
  gitBackend?: any;
877
1013
  backgroundOps?: any;
1014
+ mergeDrivers: MergeDriverRegistry;
878
1015
 
879
1016
  // Repository lifecycle
880
1017
  init(opts?: InitOptions): Promise<void>;
@@ -883,7 +1020,12 @@ export interface JJ {
883
1020
  write(args: WriteArgs): Promise<WriteResult>;
884
1021
  read(args: ReadArgs): Promise<string | Uint8Array>;
885
1022
  cat(args: ReadArgs): Promise<string | Uint8Array>;
886
- move(args: MoveFileArgs): Promise<MoveResult>;
1023
+ moveFile(args: MoveFileArgs): Promise<MoveResult>;
1024
+ moveChange(args: MoveChangeArgs): Promise<Change>;
1025
+ /**
1026
+ * @deprecated Use moveFile() for files or moveChange() for history operations
1027
+ */
1028
+ move(args: MoveFileArgs | MoveChangeArgs): Promise<MoveResult | Change>;
887
1029
  remove(args: RemoveArgs): Promise<RemoveResult>;
888
1030
  listFiles(args?: ListFilesArgs): Promise<string[]>;
889
1031
  readStream(args: ReadStreamArgs): Promise<any>;
@@ -904,9 +1046,11 @@ export interface JJ {
904
1046
  rebase(args: RebaseArgs): Promise<Change>;
905
1047
  abandon(args: AbandonArgs): Promise<void>;
906
1048
  unabandon(args: UnabandonArgs): Promise<void>;
1049
+ absorb(args?: AbsorbArgs): Promise<AbsorbResult>;
907
1050
 
908
1051
  // Queries
909
- log(opts?: LogOptions): Promise<LogEntry[]>;
1052
+ log(opts?: LogOptions & { count?: false }): Promise<LogEntry[]>;
1053
+ log(opts: LogOptions & { count: true }): Promise<number>;
910
1054
  show(args: ShowArgs): Promise<Change>;
911
1055
  obslog(opts?: ObslogOptions): Promise<Operation[]>;
912
1056
 
@@ -1104,6 +1248,25 @@ export interface JJ {
1104
1248
  }>;
1105
1249
  parent: ChangeID;
1106
1250
  }>;
1251
+
1252
+ // Bisect operations
1253
+ bisect: {
1254
+ start(args: BisectStartArgs): Promise<void>;
1255
+ good(): Promise<void>;
1256
+ bad(): Promise<void>;
1257
+ status(): Promise<BisectState>;
1258
+ reset(): Promise<void>;
1259
+ };
1260
+
1261
+ // Sparse checkout
1262
+ sparse: {
1263
+ list(): Promise<string[]>;
1264
+ set(args: SparseSetArgs): Promise<void>;
1265
+ add(args: SparseAddArgs): Promise<void>;
1266
+ remove(args: SparseRemoveArgs): Promise<void>;
1267
+ reset(): Promise<void>;
1268
+ clear(): Promise<void>;
1269
+ };
1107
1270
  }
1108
1271
 
1109
1272
  // ============================================================================