git-chopstick-core 0.1.1 → 0.1.3

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.
Files changed (461) hide show
  1. package/README.md +324 -32
  2. package/dist/git/add.d.ts +9 -0
  3. package/dist/git/add.js +11 -0
  4. package/dist/git/add.js.map +1 -0
  5. package/dist/git/apply.d.ts +33 -0
  6. package/dist/git/apply.js +103 -0
  7. package/dist/git/apply.js.map +1 -0
  8. package/dist/git/authentication.d.ts +5 -0
  9. package/dist/git/authentication.js +19 -0
  10. package/dist/git/authentication.js.map +1 -0
  11. package/dist/git/branch.d.ts +43 -0
  12. package/dist/git/branch.js +150 -0
  13. package/dist/git/branch.js.map +1 -0
  14. package/dist/git/checkout-index.d.ts +19 -0
  15. package/{src/git/checkout-index.ts → dist/git/checkout-index.js} +11 -22
  16. package/dist/git/checkout-index.js.map +1 -0
  17. package/dist/git/checkout.d.ts +46 -0
  18. package/dist/git/checkout.js +126 -0
  19. package/dist/git/checkout.js.map +1 -0
  20. package/dist/git/cherry-pick.d.ts +82 -0
  21. package/dist/git/cherry-pick.js +371 -0
  22. package/dist/git/cherry-pick.js.map +1 -0
  23. package/dist/git/clean.d.ts +5 -0
  24. package/dist/git/clean.js +8 -0
  25. package/dist/git/clean.js.map +1 -0
  26. package/dist/git/clone.d.ts +22 -0
  27. package/dist/git/clone.js +58 -0
  28. package/dist/git/clone.js.map +1 -0
  29. package/dist/git/coerce-to-buffer.d.ts +1 -0
  30. package/dist/git/coerce-to-buffer.js +2 -0
  31. package/dist/git/coerce-to-buffer.js.map +1 -0
  32. package/dist/git/coerce-to-string.d.ts +1 -0
  33. package/dist/git/coerce-to-string.js +2 -0
  34. package/dist/git/coerce-to-string.js.map +1 -0
  35. package/dist/git/commit.d.ts +25 -0
  36. package/dist/git/commit.js +99 -0
  37. package/dist/git/commit.js.map +1 -0
  38. package/dist/git/config.d.ts +98 -0
  39. package/dist/git/config.js +249 -0
  40. package/dist/git/config.js.map +1 -0
  41. package/dist/git/core.d.ts +167 -0
  42. package/dist/git/core.js +368 -0
  43. package/dist/git/core.js.map +1 -0
  44. package/dist/git/create-tail-stream.d.ts +4 -0
  45. package/dist/git/create-tail-stream.js +30 -0
  46. package/dist/git/create-tail-stream.js.map +1 -0
  47. package/dist/git/credential.d.ts +5 -0
  48. package/dist/git/credential.js +64 -0
  49. package/dist/git/credential.js.map +1 -0
  50. package/dist/git/description.d.ts +5 -0
  51. package/dist/git/description.js +24 -0
  52. package/dist/git/description.js.map +1 -0
  53. package/dist/git/diff-check.d.ts +7 -0
  54. package/dist/git/diff-check.js +17 -0
  55. package/dist/git/diff-check.js.map +1 -0
  56. package/dist/git/diff-index.d.ts +31 -0
  57. package/dist/git/diff-index.js +76 -0
  58. package/dist/git/diff-index.js.map +1 -0
  59. package/dist/git/diff.d.ts +81 -0
  60. package/dist/git/diff.js +611 -0
  61. package/dist/git/diff.js.map +1 -0
  62. package/dist/git/environment.d.ts +51 -0
  63. package/dist/git/environment.js +97 -0
  64. package/dist/git/environment.js.map +1 -0
  65. package/dist/git/exec.d.ts +109 -0
  66. package/dist/git/exec.js +224 -0
  67. package/dist/git/exec.js.map +1 -0
  68. package/dist/git/fetch.d.ts +25 -0
  69. package/dist/git/fetch.js +100 -0
  70. package/dist/git/fetch.js.map +1 -0
  71. package/dist/git/for-each-ref.d.ts +13 -0
  72. package/dist/git/for-each-ref.js +114 -0
  73. package/dist/git/for-each-ref.js.map +1 -0
  74. package/dist/git/format-patch.d.ts +10 -0
  75. package/dist/git/format-patch.js +16 -0
  76. package/dist/git/format-patch.js.map +1 -0
  77. package/dist/git/git-delimiter-parser.d.ts +38 -0
  78. package/dist/git/git-delimiter-parser.js +79 -0
  79. package/dist/git/git-delimiter-parser.js.map +1 -0
  80. package/dist/git/gitignore.d.ts +26 -0
  81. package/dist/git/gitignore.js +124 -0
  82. package/dist/git/gitignore.js.map +1 -0
  83. package/dist/git/index.d.ts +46 -0
  84. package/dist/git/index.js +47 -0
  85. package/dist/git/index.js.map +1 -0
  86. package/dist/git/init.d.ts +2 -0
  87. package/dist/git/init.js +7 -0
  88. package/dist/git/init.js.map +1 -0
  89. package/{src/git/interpret-trailers.ts → dist/git/interpret-trailers.d.ts} +9 -97
  90. package/dist/git/interpret-trailers.js +130 -0
  91. package/dist/git/interpret-trailers.js.map +1 -0
  92. package/dist/git/lfs.d.ts +25 -0
  93. package/dist/git/lfs.js +73 -0
  94. package/dist/git/lfs.js.map +1 -0
  95. package/dist/git/log.d.ts +56 -0
  96. package/dist/git/log.js +258 -0
  97. package/dist/git/log.js.map +1 -0
  98. package/dist/git/merge-tree.d.ts +13 -0
  99. package/dist/git/merge-tree.js +24 -0
  100. package/dist/git/merge-tree.js.map +1 -0
  101. package/dist/git/merge.d.ts +50 -0
  102. package/dist/git/merge.js +111 -0
  103. package/dist/git/merge.js.map +1 -0
  104. package/dist/git/multi-operation-terminal-output.d.ts +20 -0
  105. package/dist/git/multi-operation-terminal-output.js +56 -0
  106. package/dist/git/multi-operation-terminal-output.js.map +1 -0
  107. package/dist/git/pull.d.ts +24 -0
  108. package/dist/git/pull.js +91 -0
  109. package/dist/git/pull.js.map +1 -0
  110. package/{src/git/push-terminal-chunk.ts → dist/git/push-terminal-chunk.d.ts} +1 -23
  111. package/dist/git/push-terminal-chunk.js +36 -0
  112. package/dist/git/push-terminal-chunk.js.map +1 -0
  113. package/dist/git/push.d.ts +42 -0
  114. package/dist/git/push.js +80 -0
  115. package/dist/git/push.js.map +1 -0
  116. package/dist/git/rebase.d.ts +119 -0
  117. package/dist/git/rebase.js +415 -0
  118. package/dist/git/rebase.js.map +1 -0
  119. package/dist/git/reflog.d.ts +14 -0
  120. package/dist/git/reflog.js +88 -0
  121. package/dist/git/reflog.js.map +1 -0
  122. package/dist/git/refs.d.ts +26 -0
  123. package/dist/git/refs.js +53 -0
  124. package/dist/git/refs.js.map +1 -0
  125. package/dist/git/remote.d.ts +31 -0
  126. package/dist/git/remote.js +81 -0
  127. package/dist/git/remote.js.map +1 -0
  128. package/dist/git/reorder.d.ts +23 -0
  129. package/dist/git/reorder.js +111 -0
  130. package/dist/git/reorder.js.map +1 -0
  131. package/dist/git/reset.d.ts +41 -0
  132. package/dist/git/reset.js +86 -0
  133. package/dist/git/reset.js.map +1 -0
  134. package/dist/git/rev-list.d.ts +67 -0
  135. package/dist/git/rev-list.js +157 -0
  136. package/dist/git/rev-list.js.map +1 -0
  137. package/dist/git/rev-parse.d.ts +24 -0
  138. package/dist/git/rev-parse.js +65 -0
  139. package/dist/git/rev-parse.js.map +1 -0
  140. package/dist/git/revert.d.ts +12 -0
  141. package/dist/git/revert.js +30 -0
  142. package/dist/git/revert.js.map +1 -0
  143. package/dist/git/rm.d.ts +12 -0
  144. package/dist/git/rm.js +22 -0
  145. package/dist/git/rm.js.map +1 -0
  146. package/dist/git/show.d.ts +42 -0
  147. package/{src/git/show.ts → dist/git/show.js} +17 -46
  148. package/dist/git/show.js.map +1 -0
  149. package/dist/git/spawn.d.ts +18 -0
  150. package/dist/git/spawn.js +16 -0
  151. package/dist/git/spawn.js.map +1 -0
  152. package/dist/git/squash.d.ts +28 -0
  153. package/dist/git/squash.js +127 -0
  154. package/dist/git/squash.js.map +1 -0
  155. package/dist/git/stage.d.ts +21 -0
  156. package/dist/git/stage.js +72 -0
  157. package/dist/git/stage.js.map +1 -0
  158. package/dist/git/stash.d.ts +53 -0
  159. package/dist/git/stash.js +204 -0
  160. package/dist/git/stash.js.map +1 -0
  161. package/dist/git/status.d.ts +39 -0
  162. package/dist/git/status.js +293 -0
  163. package/dist/git/status.js.map +1 -0
  164. package/dist/git/submodule.d.ts +20 -0
  165. package/dist/git/submodule.js +153 -0
  166. package/dist/git/submodule.js.map +1 -0
  167. package/dist/git/tag.d.ts +32 -0
  168. package/dist/git/tag.js +101 -0
  169. package/dist/git/tag.js.map +1 -0
  170. package/dist/git/update-index.d.ts +11 -0
  171. package/dist/git/update-index.js +99 -0
  172. package/dist/git/update-index.js.map +1 -0
  173. package/dist/git/update-ref.d.ts +23 -0
  174. package/{src/git/update-ref.ts → dist/git/update-ref.js} +10 -28
  175. package/dist/git/update-ref.js.map +1 -0
  176. package/dist/git/var.d.ts +18 -0
  177. package/{src/git/var.ts → dist/git/var.js} +16 -25
  178. package/dist/git/var.js.map +1 -0
  179. package/dist/git/worktree-include.d.ts +42 -0
  180. package/dist/git/worktree-include.js +109 -0
  181. package/dist/git/worktree-include.js.map +1 -0
  182. package/dist/git/worktree.d.ts +25 -0
  183. package/dist/git/worktree.js +139 -0
  184. package/dist/git/worktree.js.map +1 -0
  185. package/dist/index.d.ts +4 -0
  186. package/dist/index.js +7 -0
  187. package/dist/index.js.map +1 -0
  188. package/dist/lib/api.d.ts +2 -0
  189. package/dist/lib/api.js +7 -0
  190. package/dist/lib/api.js.map +1 -0
  191. package/dist/lib/diff-parser.d.ts +20 -0
  192. package/dist/lib/diff-parser.js +184 -0
  193. package/dist/lib/diff-parser.js.map +1 -0
  194. package/dist/lib/directory-exists.d.ts +1 -0
  195. package/dist/lib/directory-exists.js +11 -0
  196. package/dist/lib/directory-exists.js.map +1 -0
  197. package/dist/lib/errno-exception.d.ts +6 -0
  198. package/dist/lib/errno-exception.js +6 -0
  199. package/dist/lib/errno-exception.js.map +1 -0
  200. package/dist/lib/fatal-error.d.ts +4 -0
  201. package/dist/lib/fatal-error.js +18 -0
  202. package/dist/lib/fatal-error.js.map +1 -0
  203. package/dist/lib/feature-flag.d.ts +14 -0
  204. package/dist/lib/feature-flag.js +25 -0
  205. package/dist/lib/feature-flag.js.map +1 -0
  206. package/dist/lib/file-system.d.ts +1 -0
  207. package/dist/lib/file-system.js +7 -0
  208. package/dist/lib/file-system.js.map +1 -0
  209. package/dist/lib/get-old-path.d.ts +2 -0
  210. package/dist/lib/get-old-path.js +9 -0
  211. package/dist/lib/get-old-path.js.map +1 -0
  212. package/dist/lib/git/environment.d.ts +3 -0
  213. package/dist/lib/git/environment.js +7 -0
  214. package/dist/lib/git/environment.js.map +1 -0
  215. package/dist/lib/git-perf.d.ts +1 -0
  216. package/dist/lib/git-perf.js +4 -0
  217. package/dist/lib/git-perf.js.map +1 -0
  218. package/dist/lib/helpers/default-branch.d.ts +1 -0
  219. package/dist/lib/helpers/default-branch.js +4 -0
  220. package/dist/lib/helpers/default-branch.js.map +1 -0
  221. package/dist/lib/helpers/path.d.ts +1 -0
  222. package/dist/lib/helpers/path.js +5 -0
  223. package/dist/lib/helpers/path.js.map +1 -0
  224. package/dist/lib/hooks/with-hooks-env.d.ts +3 -0
  225. package/dist/lib/hooks/with-hooks-env.js +4 -0
  226. package/dist/lib/hooks/with-hooks-env.js.map +1 -0
  227. package/dist/lib/merge.d.ts +1 -0
  228. package/dist/lib/merge.js +4 -0
  229. package/dist/lib/merge.js.map +1 -0
  230. package/dist/lib/noop.d.ts +1 -0
  231. package/dist/lib/noop.js +2 -0
  232. package/dist/lib/noop.js.map +1 -0
  233. package/dist/lib/patch-formatter.d.ts +5 -0
  234. package/dist/lib/patch-formatter.js +7 -0
  235. package/dist/lib/patch-formatter.js.map +1 -0
  236. package/dist/lib/path-exists.d.ts +1 -0
  237. package/dist/lib/path-exists.js +3 -0
  238. package/dist/lib/path-exists.js.map +1 -0
  239. package/dist/lib/progress/from-process.d.ts +2 -0
  240. package/dist/lib/progress/from-process.js +4 -0
  241. package/dist/lib/progress/from-process.js.map +1 -0
  242. package/dist/lib/progress/index.d.ts +49 -0
  243. package/dist/lib/progress/index.js +32 -0
  244. package/dist/lib/progress/index.js.map +1 -0
  245. package/dist/lib/progress/revert.d.ts +8 -0
  246. package/dist/lib/progress/revert.js +15 -0
  247. package/dist/lib/progress/revert.js.map +1 -0
  248. package/dist/lib/rebase.d.ts +1 -0
  249. package/dist/lib/rebase.js +4 -0
  250. package/dist/lib/rebase.js.map +1 -0
  251. package/dist/lib/remove-remote-prefix.d.ts +1 -0
  252. package/dist/lib/remove-remote-prefix.js +5 -0
  253. package/dist/lib/remove-remote-prefix.js.map +1 -0
  254. package/dist/lib/resolve-git-proxy.d.ts +1 -0
  255. package/dist/lib/resolve-git-proxy.js +4 -0
  256. package/dist/lib/resolve-git-proxy.js.map +1 -0
  257. package/dist/lib/round.d.ts +1 -0
  258. package/dist/lib/round.js +5 -0
  259. package/dist/lib/round.js.map +1 -0
  260. package/dist/lib/split-buffer.d.ts +1 -0
  261. package/dist/lib/split-buffer.js +15 -0
  262. package/dist/lib/split-buffer.js.map +1 -0
  263. package/dist/lib/status-parser.d.ts +19 -0
  264. package/dist/lib/status-parser.js +125 -0
  265. package/dist/lib/status-parser.js.map +1 -0
  266. package/dist/lib/stores/helpers/find-default-remote.d.ts +1 -0
  267. package/dist/lib/stores/helpers/find-default-remote.js +4 -0
  268. package/dist/lib/stores/helpers/find-default-remote.js.map +1 -0
  269. package/dist/lib/trampoline/trampoline-environment.d.ts +1 -0
  270. package/dist/lib/trampoline/trampoline-environment.js +4 -0
  271. package/dist/lib/trampoline/trampoline-environment.js.map +1 -0
  272. package/dist/models/branch.d.ts +44 -0
  273. package/dist/models/branch.js +59 -0
  274. package/dist/models/branch.js.map +1 -0
  275. package/dist/models/cherry-pick.d.ts +11 -0
  276. package/dist/models/cherry-pick.js +2 -0
  277. package/dist/models/cherry-pick.js.map +1 -0
  278. package/dist/models/clone-options.d.ts +6 -0
  279. package/dist/models/clone-options.js +2 -0
  280. package/dist/models/clone-options.js.map +1 -0
  281. package/dist/models/commit-identity.d.ts +9 -0
  282. package/dist/models/commit-identity.js +34 -0
  283. package/dist/models/commit-identity.js.map +1 -0
  284. package/dist/models/commit.d.ts +30 -0
  285. package/dist/models/commit.js +32 -0
  286. package/dist/models/commit.js.map +1 -0
  287. package/dist/models/computed-action.d.ts +6 -0
  288. package/dist/models/computed-action.js +8 -0
  289. package/dist/models/computed-action.js.map +1 -0
  290. package/dist/models/diff/diff-data.d.ts +53 -0
  291. package/dist/models/diff/diff-data.js +19 -0
  292. package/dist/models/diff/diff-data.js.map +1 -0
  293. package/dist/models/diff/diff-line.d.ts +18 -0
  294. package/dist/models/diff/diff-line.js +33 -0
  295. package/dist/models/diff/diff-line.js.map +1 -0
  296. package/dist/models/diff/diff-selection.d.ts +22 -0
  297. package/dist/models/diff/diff-selection.js +127 -0
  298. package/dist/models/diff/diff-selection.js.map +1 -0
  299. package/dist/models/diff/image-diff.d.ts +6 -0
  300. package/dist/models/diff/image-diff.js +8 -0
  301. package/dist/models/diff/image-diff.js.map +1 -0
  302. package/dist/models/diff/image.d.ts +7 -0
  303. package/dist/models/diff/image.js +13 -0
  304. package/dist/models/diff/image.js.map +1 -0
  305. package/dist/models/diff/index.d.ts +6 -0
  306. package/dist/models/diff/index.js +7 -0
  307. package/dist/models/diff/index.js.map +1 -0
  308. package/dist/models/diff/raw-diff.d.ts +32 -0
  309. package/dist/models/diff/raw-diff.js +38 -0
  310. package/dist/models/diff/raw-diff.js.map +1 -0
  311. package/dist/models/git-author.d.ts +7 -0
  312. package/dist/models/git-author.js +18 -0
  313. package/dist/models/git-author.js.map +1 -0
  314. package/dist/models/index.d.ts +21 -0
  315. package/dist/models/index.js +20 -0
  316. package/dist/models/index.js.map +1 -0
  317. package/dist/models/manual-conflict-resolution.d.ts +4 -0
  318. package/dist/models/manual-conflict-resolution.js +6 -0
  319. package/dist/models/manual-conflict-resolution.js.map +1 -0
  320. package/dist/models/merge.d.ts +6 -0
  321. package/dist/models/merge.js +2 -0
  322. package/dist/models/merge.js.map +1 -0
  323. package/dist/models/multi-commit-operation.d.ts +6 -0
  324. package/dist/models/multi-commit-operation.js +8 -0
  325. package/dist/models/multi-commit-operation.js.map +1 -0
  326. package/dist/models/progress.d.ts +41 -0
  327. package/dist/models/progress.js +7 -0
  328. package/dist/models/progress.js.map +1 -0
  329. package/dist/models/rebase.d.ts +17 -0
  330. package/dist/models/rebase.js +8 -0
  331. package/dist/models/rebase.js.map +1 -0
  332. package/dist/models/remote.d.ts +5 -0
  333. package/dist/models/remote.js +8 -0
  334. package/dist/models/remote.js.map +1 -0
  335. package/dist/models/repository.d.ts +7 -0
  336. package/dist/models/repository.js +15 -0
  337. package/dist/models/repository.js.map +1 -0
  338. package/dist/models/stash-entry.d.ts +20 -0
  339. package/dist/models/stash-entry.js +7 -0
  340. package/dist/models/stash-entry.js.map +1 -0
  341. package/dist/models/status.d.ts +166 -0
  342. package/dist/models/status.js +135 -0
  343. package/dist/models/status.js.map +1 -0
  344. package/dist/models/submodule.d.ts +12 -0
  345. package/dist/models/submodule.js +2 -0
  346. package/dist/models/submodule.js.map +1 -0
  347. package/dist/models/worktree.d.ts +10 -0
  348. package/dist/models/worktree.js +2 -0
  349. package/dist/models/worktree.js.map +1 -0
  350. package/package.json +44 -5
  351. package/examples/get-status.ts +0 -84
  352. package/src/git/add.ts +0 -16
  353. package/src/git/apply.ts +0 -154
  354. package/src/git/authentication.ts +0 -19
  355. package/src/git/branch.ts +0 -206
  356. package/src/git/checkout.ts +0 -235
  357. package/src/git/cherry-pick.ts +0 -504
  358. package/src/git/clean.ts +0 -9
  359. package/src/git/clone.ts +0 -86
  360. package/src/git/coerce-to-buffer.ts +0 -4
  361. package/src/git/coerce-to-string.ts +0 -4
  362. package/src/git/commit.ts +0 -136
  363. package/src/git/config.ts +0 -392
  364. package/src/git/core.ts +0 -625
  365. package/src/git/create-tail-stream.ts +0 -36
  366. package/src/git/credential.ts +0 -83
  367. package/src/git/description.ts +0 -33
  368. package/src/git/diff-check.ts +0 -27
  369. package/src/git/diff-index.ts +0 -116
  370. package/src/git/diff.ts +0 -880
  371. package/src/git/environment.ts +0 -116
  372. package/src/git/exec.ts +0 -285
  373. package/src/git/fetch.ts +0 -141
  374. package/src/git/for-each-ref.ts +0 -160
  375. package/src/git/format-patch.ts +0 -17
  376. package/src/git/git-delimiter-parser.ts +0 -95
  377. package/src/git/gitignore.ts +0 -157
  378. package/src/git/index.ts +0 -36
  379. package/src/git/init.ts +0 -11
  380. package/src/git/lfs.ts +0 -100
  381. package/src/git/log.ts +0 -376
  382. package/src/git/merge-tree.ts +0 -42
  383. package/src/git/merge.ts +0 -154
  384. package/src/git/multi-operation-terminal-output.ts +0 -68
  385. package/src/git/pull.ts +0 -130
  386. package/src/git/push.ts +0 -119
  387. package/src/git/rebase.ts +0 -627
  388. package/src/git/reflog.ts +0 -127
  389. package/src/git/refs.ts +0 -63
  390. package/src/git/remote.ts +0 -143
  391. package/src/git/reorder.ts +0 -153
  392. package/src/git/reset.ts +0 -101
  393. package/src/git/rev-list.ts +0 -201
  394. package/src/git/rev-parse.ts +0 -92
  395. package/src/git/revert.ts +0 -55
  396. package/src/git/rm.ts +0 -31
  397. package/src/git/spawn.ts +0 -38
  398. package/src/git/squash.ts +0 -173
  399. package/src/git/stage.ts +0 -97
  400. package/src/git/stash.ts +0 -302
  401. package/src/git/status.ts +0 -502
  402. package/src/git/submodule.ts +0 -212
  403. package/src/git/tag.ts +0 -134
  404. package/src/git/update-index.ts +0 -169
  405. package/src/git/worktree-include.ts +0 -146
  406. package/src/git/worktree.ts +0 -219
  407. package/src/index.ts +0 -23
  408. package/src/lib/api.ts +0 -7
  409. package/src/lib/diff-parser.ts +0 -249
  410. package/src/lib/directory-exists.ts +0 -10
  411. package/src/lib/errno-exception.ts +0 -12
  412. package/src/lib/fatal-error.ts +0 -23
  413. package/src/lib/feature-flag.ts +0 -29
  414. package/src/lib/file-system.ts +0 -7
  415. package/src/lib/get-old-path.ts +0 -11
  416. package/src/lib/git/environment.ts +0 -14
  417. package/src/lib/git-perf.ts +0 -3
  418. package/src/lib/helpers/default-branch.ts +0 -3
  419. package/src/lib/helpers/path.ts +0 -5
  420. package/src/lib/hooks/with-hooks-env.ts +0 -7
  421. package/src/lib/merge.ts +0 -3
  422. package/src/lib/noop.ts +0 -1
  423. package/src/lib/patch-formatter.ts +0 -18
  424. package/src/lib/path-exists.ts +0 -7
  425. package/src/lib/progress/from-process.ts +0 -10
  426. package/src/lib/progress/index.ts +0 -43
  427. package/src/lib/progress/revert.ts +0 -17
  428. package/src/lib/rebase.ts +0 -3
  429. package/src/lib/remove-remote-prefix.ts +0 -4
  430. package/src/lib/resolve-git-proxy.ts +0 -3
  431. package/src/lib/round.ts +0 -4
  432. package/src/lib/split-buffer.ts +0 -14
  433. package/src/lib/status-parser.ts +0 -188
  434. package/src/lib/stores/helpers/find-default-remote.ts +0 -3
  435. package/src/lib/trampoline/trampoline-environment.ts +0 -8
  436. package/src/models/branch.ts +0 -78
  437. package/src/models/cherry-pick.ts +0 -12
  438. package/src/models/clone-options.ts +0 -6
  439. package/src/models/commit-identity.ts +0 -35
  440. package/src/models/commit.ts +0 -44
  441. package/src/models/computed-action.ts +0 -6
  442. package/src/models/diff/diff-data.ts +0 -78
  443. package/src/models/diff/diff-line.ts +0 -36
  444. package/src/models/diff/diff-selection.ts +0 -165
  445. package/src/models/diff/image-diff.ts +0 -6
  446. package/src/models/diff/image.ts +0 -8
  447. package/src/models/diff/index.ts +0 -6
  448. package/src/models/diff/raw-diff.ts +0 -41
  449. package/src/models/git-author.ts +0 -16
  450. package/src/models/manual-conflict-resolution.ts +0 -4
  451. package/src/models/merge.ts +0 -6
  452. package/src/models/multi-commit-operation.ts +0 -6
  453. package/src/models/progress.ts +0 -67
  454. package/src/models/rebase.ts +0 -20
  455. package/src/models/remote.ts +0 -10
  456. package/src/models/repository.ts +0 -16
  457. package/src/models/stash-entry.ts +0 -25
  458. package/src/models/status.ts +0 -275
  459. package/src/models/submodule.ts +0 -13
  460. package/src/models/worktree.ts +0 -11
  461. package/tsconfig.json +0 -17
@@ -1,188 +0,0 @@
1
- import {
2
- FileEntry,
3
- GitStatusEntry,
4
- SubmoduleStatus,
5
- UnmergedEntrySummary,
6
- } from '../models/status'
7
- import { splitBuffer } from './split-buffer'
8
-
9
- type StatusItem = IStatusHeader | IStatusEntry
10
-
11
- export interface IStatusHeader {
12
- readonly kind: 'header'
13
- readonly value: string
14
- }
15
-
16
- export interface IStatusEntry {
17
- readonly kind: 'entry'
18
- readonly path: string
19
- readonly statusCode: string
20
- readonly submoduleStatusCode: string
21
- readonly oldPath?: string
22
- readonly renameOrCopyScore?: number
23
- }
24
-
25
- export function isStatusHeader(
26
- statusItem: StatusItem
27
- ): statusItem is IStatusHeader {
28
- return statusItem.kind === 'header'
29
- }
30
-
31
- export function isStatusEntry(
32
- statusItem: StatusItem
33
- ): statusItem is IStatusEntry {
34
- return statusItem.kind === 'entry'
35
- }
36
-
37
- const ChangedEntryType = '1'
38
- const RenamedOrCopiedEntryType = '2'
39
- const UnmergedEntryType = 'u'
40
- const UntrackedEntryType = '?'
41
-
42
- const changedEntryRe =
43
- /^1 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
44
-
45
- const renamedOrCopiedEntryRe =
46
- /^2 ([MADRCUTX?!.]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([RC]\d+) ([\s\S]*?)$/
47
-
48
- const unmergedEntryRe =
49
- /^u ([DAU]{2}) (N\.\.\.|S[C.][M.][U.]) (\d+) (\d+) (\d+) (\d+) ([a-f0-9]+) ([a-f0-9]+) ([a-f0-9]+) ([\s\S]*?)$/
50
-
51
- export function parsePorcelainStatus(
52
- output: Buffer
53
- ): ReadonlyArray<StatusItem> {
54
- const entries = new Array<StatusItem>()
55
- const tokens = splitBuffer(output, '\0')
56
-
57
- for (let i = 0; i < tokens.length; i++) {
58
- const field = tokens[i].toString()
59
- if (field.startsWith('# ') && field.length > 2) {
60
- entries.push({ kind: 'header', value: field.substring(2) })
61
- continue
62
- }
63
-
64
- const entryKind = field.substring(0, 1)
65
-
66
- if (entryKind === ChangedEntryType) {
67
- entries.push(parseChangedEntry(field))
68
- } else if (entryKind === RenamedOrCopiedEntryType) {
69
- entries.push(parsedRenamedOrCopiedEntry(field, tokens[++i].toString()))
70
- } else if (entryKind === UnmergedEntryType) {
71
- entries.push(parseUnmergedEntry(field))
72
- } else if (entryKind === UntrackedEntryType) {
73
- entries.push(parseUntrackedEntry(field))
74
- }
75
- }
76
-
77
- return entries
78
- }
79
-
80
- function parseChangedEntry(field: string): IStatusEntry {
81
- const match = changedEntryRe.exec(field)
82
- if (!match) throw new Error(`Failed to parse status line for changed entry`)
83
- return {
84
- kind: 'entry',
85
- statusCode: match[1],
86
- submoduleStatusCode: match[2],
87
- path: match[8],
88
- }
89
- }
90
-
91
- function parsedRenamedOrCopiedEntry(
92
- field: string,
93
- oldPath: string | undefined
94
- ): IStatusEntry {
95
- const match = renamedOrCopiedEntryRe.exec(field)
96
- if (!match) throw new Error(`Failed to parse status line for renamed or copied entry`)
97
- if (!oldPath) throw new Error('Failed to parse renamed or copied entry, could not parse old path')
98
-
99
- return {
100
- kind: 'entry',
101
- statusCode: match[1],
102
- submoduleStatusCode: match[2],
103
- oldPath,
104
- renameOrCopyScore: parseInt(match[8].substring(1), 10),
105
- path: match[9],
106
- }
107
- }
108
-
109
- function parseUnmergedEntry(field: string): IStatusEntry {
110
- const match = unmergedEntryRe.exec(field)
111
- if (!match) throw new Error(`Failed to parse status line for unmerged entry`)
112
- return {
113
- kind: 'entry',
114
- statusCode: match[1],
115
- submoduleStatusCode: match[2],
116
- path: match[10],
117
- }
118
- }
119
-
120
- function parseUntrackedEntry(field: string): IStatusEntry {
121
- const path = field.substring(2)
122
- return {
123
- kind: 'entry',
124
- statusCode: '??',
125
- submoduleStatusCode: '????',
126
- path,
127
- }
128
- }
129
-
130
- function mapSubmoduleStatus(
131
- submoduleStatusCode: string
132
- ): SubmoduleStatus | undefined {
133
- if (!submoduleStatusCode.startsWith('S')) return undefined
134
- return {
135
- commitChanged: submoduleStatusCode[1] === 'C',
136
- modifiedChanges: submoduleStatusCode[2] === 'M',
137
- untrackedChanges: submoduleStatusCode[3] === 'U',
138
- }
139
- }
140
-
141
- export function mapStatus(
142
- statusCode: string,
143
- submoduleStatusCode: string,
144
- renameOrCopyScore: number | undefined
145
- ): FileEntry {
146
- const submoduleStatus = mapSubmoduleStatus(submoduleStatusCode)
147
-
148
- if (statusCode === '??') return { kind: 'untracked', submoduleStatus }
149
-
150
- const sc = (code: string, idx: 'index' | 'workingTree') => {
151
- const map: Record<string, GitStatusEntry> = {
152
- 'M': GitStatusEntry.Modified,
153
- 'A': GitStatusEntry.Added,
154
- 'D': GitStatusEntry.Deleted,
155
- 'R': GitStatusEntry.Renamed,
156
- 'C': GitStatusEntry.Copied,
157
- '.': GitStatusEntry.Unchanged,
158
- 'U': GitStatusEntry.UpdatedButUnmerged,
159
- }
160
- return map[code] ?? GitStatusEntry.Modified
161
- }
162
-
163
- const pairs: Record<string, () => FileEntry> = {
164
- '.M': () => ({ kind: 'ordinary', type: 'modified', index: GitStatusEntry.Unchanged, workingTree: GitStatusEntry.Modified, submoduleStatus }),
165
- 'M.': () => ({ kind: 'ordinary', type: 'modified', index: GitStatusEntry.Modified, workingTree: GitStatusEntry.Unchanged, submoduleStatus }),
166
- '.A': () => ({ kind: 'ordinary', type: 'added', index: GitStatusEntry.Unchanged, workingTree: GitStatusEntry.Added, submoduleStatus }),
167
- 'A.': () => ({ kind: 'ordinary', type: 'added', index: GitStatusEntry.Added, workingTree: GitStatusEntry.Unchanged, submoduleStatus }),
168
- '.D': () => ({ kind: 'ordinary', type: 'deleted', index: GitStatusEntry.Unchanged, workingTree: GitStatusEntry.Deleted, submoduleStatus }),
169
- 'D.': () => ({ kind: 'ordinary', type: 'deleted', index: GitStatusEntry.Deleted, workingTree: GitStatusEntry.Unchanged, submoduleStatus }),
170
- 'R.': () => ({ kind: 'renamed' as const, index: GitStatusEntry.Renamed, workingTree: GitStatusEntry.Unchanged, renameOrCopyScore, submoduleStatus }),
171
- '.R': () => ({ kind: 'renamed' as const, index: GitStatusEntry.Unchanged, workingTree: GitStatusEntry.Renamed, renameOrCopyScore, submoduleStatus }),
172
- 'C.': () => ({ kind: 'copied' as const, index: GitStatusEntry.Copied, workingTree: GitStatusEntry.Unchanged, submoduleStatus }),
173
- '.C': () => ({ kind: 'copied' as const, index: GitStatusEntry.Unchanged, workingTree: GitStatusEntry.Copied, submoduleStatus }),
174
- 'AD': () => ({ kind: 'ordinary', type: 'added', index: GitStatusEntry.Added, workingTree: GitStatusEntry.Deleted, submoduleStatus }),
175
- 'AM': () => ({ kind: 'ordinary', type: 'added', index: GitStatusEntry.Added, workingTree: GitStatusEntry.Modified, submoduleStatus }),
176
- 'RM': () => ({ kind: 'renamed' as const, index: GitStatusEntry.Renamed, workingTree: GitStatusEntry.Modified, renameOrCopyScore, submoduleStatus }),
177
- 'RD': () => ({ kind: 'renamed' as const, index: GitStatusEntry.Renamed, workingTree: GitStatusEntry.Deleted, renameOrCopyScore, submoduleStatus }),
178
- 'DD': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.BothDeleted, us: GitStatusEntry.Deleted, them: GitStatusEntry.Deleted, submoduleStatus }),
179
- 'AU': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.AddedByUs, us: GitStatusEntry.Added, them: GitStatusEntry.UpdatedButUnmerged, submoduleStatus }),
180
- 'UD': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.DeletedByThem, us: GitStatusEntry.UpdatedButUnmerged, them: GitStatusEntry.Deleted, submoduleStatus }),
181
- 'UA': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.AddedByThem, us: GitStatusEntry.UpdatedButUnmerged, them: GitStatusEntry.Added, submoduleStatus }),
182
- 'DU': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.DeletedByUs, us: GitStatusEntry.Deleted, them: GitStatusEntry.UpdatedButUnmerged, submoduleStatus }),
183
- 'AA': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.BothAdded, us: GitStatusEntry.Added, them: GitStatusEntry.Added, submoduleStatus }),
184
- 'UU': () => ({ kind: 'conflicted' as const, action: UnmergedEntrySummary.BothModified, us: GitStatusEntry.UpdatedButUnmerged, them: GitStatusEntry.UpdatedButUnmerged, submoduleStatus }),
185
- }
186
-
187
- return pairs[statusCode]?.() ?? { kind: 'ordinary', type: 'modified', submoduleStatus }
188
- }
@@ -1,3 +0,0 @@
1
- export function findDefaultRemote(remotes: any[]): any | null {
2
- return remotes.length > 0 ? remotes[0] : null
3
- }
@@ -1,8 +0,0 @@
1
- export async function withTrampolineEnv<T>(
2
- fn: (env: Record<string, string | undefined>) => Promise<T>,
3
- _path: string,
4
- _isBackgroundTask: boolean,
5
- _existingEnv?: Record<string, string | undefined>
6
- ): Promise<T> {
7
- return fn({})
8
- }
@@ -1,78 +0,0 @@
1
- export enum BranchType {
2
- Local = 0,
3
- Remote = 1,
4
- }
5
-
6
- export interface IAheadBehind {
7
- readonly ahead: number
8
- readonly behind: number
9
- }
10
-
11
- export interface ICompareResult extends IAheadBehind {
12
- readonly commits: ReadonlyArray<Commit>
13
- }
14
-
15
- export interface ITrackingBranch {
16
- readonly ref: string
17
- readonly sha: string
18
- readonly upstreamRef: string
19
- readonly upstreamSha: string
20
- }
21
-
22
- export interface IAuthor {
23
- readonly date: Date
24
- }
25
-
26
- export interface IBranchTip {
27
- readonly sha: string
28
- readonly author: IAuthor
29
- }
30
-
31
- export enum StartPoint {
32
- CurrentBranch = 'CurrentBranch',
33
- DefaultBranch = 'DefaultBranch',
34
- Head = 'Head',
35
- UpstreamDefaultBranch = 'UpstreamDefaultBranch',
36
- }
37
-
38
- export class Branch {
39
- public constructor(
40
- public readonly name: string,
41
- public readonly upstream: string | null,
42
- public readonly tip: IBranchTip,
43
- public readonly type: BranchType,
44
- public readonly ref: string,
45
- public readonly isGone: boolean
46
- ) {}
47
-
48
- public get upstreamRemoteName(): string | null {
49
- const upstream = this.upstream
50
- if (!upstream) return null
51
- const pieces = upstream.match(/(.*?)\/.*/)
52
- if (!pieces || pieces.length < 2) return null
53
- return pieces[1]
54
- }
55
-
56
- public get remoteName(): string | null {
57
- if (this.type === BranchType.Local) return null
58
- const pieces = this.ref.match(/^refs\/remotes\/(.*?)\/.*/)
59
- if (!pieces || pieces.length !== 2) {
60
- throw new Error(`Remote branch ref has unexpected format: ${this.ref}`)
61
- }
62
- return pieces[1]
63
- }
64
-
65
- public get upstreamWithoutRemote(): string | null {
66
- if (!this.upstream) return null
67
- const pieces = this.upstream.match(/^[^/]+\/(.*)/)
68
- return pieces ? pieces[1] : null
69
- }
70
-
71
- public get nameWithoutRemote(): string {
72
- if (this.type === BranchType.Local) return this.name
73
- const pieces = this.name.match(/^[^/]+\/(.*)/)
74
- return pieces ? pieces[1] : this.name
75
- }
76
- }
77
-
78
- import { Commit } from './commit'
@@ -1,12 +0,0 @@
1
- import { IMultiCommitOperationProgress } from './progress'
2
- import { CommitOneLine } from './commit'
3
-
4
- export interface ICherryPickSnapshot {
5
- readonly sha: string
6
- readonly parentCount: number
7
- readonly progress: IMultiCommitOperationProgress | null
8
- readonly commits: ReadonlyArray<CommitOneLine>
9
- readonly remainingCommits: ReadonlyArray<CommitOneLine>
10
- readonly targetBranchUndoSha: string
11
- readonly cherryPickedCount: number
12
- }
@@ -1,6 +0,0 @@
1
- export interface CloneOptions {
2
- readonly url: string
3
- readonly path: string
4
- readonly branch?: string
5
- readonly defaultBranch?: string
6
- }
@@ -1,35 +0,0 @@
1
- export class CommitIdentity {
2
- public static parseIdentity(identity: string): CommitIdentity {
3
- const m = identity.match(/^(.*?) <(.*?)> (\d+) (\+|-)?(\d{2})(\d{2})/)
4
- if (!m) {
5
- throw new Error(`Couldn't parse identity ${identity}`)
6
- }
7
-
8
- const name = m[1]
9
- const email = m[2]
10
- const date = new Date(parseInt(m[3], 10) * 1000)
11
-
12
- if (isNaN(date.valueOf())) {
13
- throw new Error(`Couldn't parse identity ${identity}, invalid date`)
14
- }
15
-
16
- const tzSign = m[4] === '-' ? '-' : '+'
17
- const tzHH = m[5]
18
- const tzmm = m[6]
19
- const tzMinutes = parseInt(tzHH, 10) * 60 + parseInt(tzmm, 10)
20
- const tzOffset = tzMinutes * (tzSign === '-' ? -1 : 1)
21
-
22
- return new CommitIdentity(name, email, date, tzOffset)
23
- }
24
-
25
- public constructor(
26
- public readonly name: string,
27
- public readonly email: string,
28
- public readonly date: Date,
29
- public readonly tzOffset: number = new Date().getTimezoneOffset()
30
- ) {}
31
-
32
- public toString() {
33
- return `${this.name} <${this.email}>`
34
- }
35
- }
@@ -1,44 +0,0 @@
1
- export function shortenSHA(sha: string) {
2
- return sha.slice(0, 7)
3
- }
4
-
5
- export interface ICommitContext {
6
- readonly summary: string
7
- readonly description: string | null
8
- readonly amend?: boolean
9
- readonly trailers?: ReadonlyArray<ITrailer>
10
- }
11
-
12
- export type CommitOneLine = {
13
- readonly sha: string
14
- readonly summary: string
15
- }
16
-
17
- export interface ITrailer {
18
- readonly token: string
19
- readonly value: string
20
- }
21
-
22
- export class Commit {
23
- public readonly authoredByCommitter: boolean
24
- public readonly isMergeCommit: boolean
25
-
26
- public constructor(
27
- public readonly sha: string,
28
- public readonly shortSha: string,
29
- public readonly summary: string,
30
- public readonly body: string,
31
- public readonly author: CommitIdentity,
32
- public readonly committer: CommitIdentity,
33
- public readonly parentSHAs: ReadonlyArray<string>,
34
- public readonly trailers: ReadonlyArray<ITrailer>,
35
- public readonly tags: ReadonlyArray<string>
36
- ) {
37
- this.authoredByCommitter =
38
- this.author.name === this.committer.name &&
39
- this.author.email === this.committer.email
40
- this.isMergeCommit = parentSHAs.length > 1
41
- }
42
- }
43
-
44
- import { CommitIdentity } from './commit-identity'
@@ -1,6 +0,0 @@
1
- export enum ComputedAction {
2
- Clean = 'Clean',
3
- Conflicts = 'Conflicts',
4
- Invalid = 'Invalid',
5
- Loading = 'Loading',
6
- }
@@ -1,78 +0,0 @@
1
- import { DiffHunk } from './raw-diff'
2
- import { Image } from './image'
3
- import { SubmoduleStatus } from '../status'
4
-
5
- export enum DiffType {
6
- Text,
7
- Image,
8
- Binary,
9
- Submodule,
10
- LargeText,
11
- Unrenderable,
12
- }
13
-
14
- type LineEnding = 'CR' | 'LF' | 'CRLF'
15
-
16
- export type LineEndingsChange = {
17
- from: LineEnding
18
- to: LineEnding
19
- }
20
-
21
- export function parseLineEndingText(text: string): LineEnding | null {
22
- const input = text.trim()
23
- switch (input) {
24
- case 'CR': return 'CR'
25
- case 'LF': return 'LF'
26
- case 'CRLF': return 'CRLF'
27
- default: return null
28
- }
29
- }
30
-
31
- interface ITextDiffData {
32
- readonly text: string
33
- readonly hunks: ReadonlyArray<DiffHunk>
34
- readonly lineEndingsChange?: LineEndingsChange
35
- readonly maxLineNumber: number
36
- readonly hasHiddenBidiChars: boolean
37
- }
38
-
39
- export interface ITextDiff extends ITextDiffData {
40
- readonly kind: DiffType.Text
41
- }
42
-
43
- export interface IImageDiff {
44
- readonly kind: DiffType.Image
45
- readonly previous?: Image
46
- readonly current?: Image
47
- readonly textDiff?: ITextDiffData
48
- }
49
-
50
- export interface IBinaryDiff {
51
- readonly kind: DiffType.Binary
52
- }
53
-
54
- export interface ISubmoduleDiff {
55
- readonly kind: DiffType.Submodule
56
- readonly fullPath: string
57
- readonly path: string
58
- readonly url: string | null
59
- readonly status: SubmoduleStatus
60
- readonly oldSHA: string | null
61
- readonly newSHA: string | null
62
- }
63
-
64
- export interface ILargeTextDiff extends ITextDiffData {
65
- readonly kind: DiffType.LargeText
66
- }
67
-
68
- export interface IUnrenderableDiff {
69
- readonly kind: DiffType.Unrenderable
70
- }
71
-
72
- export type IDiff =
73
- | ITextDiff
74
- | IImageDiff
75
- | IBinaryDiff
76
- | ISubmoduleDiff
77
- | ILargeTextDiff
78
- | IUnrenderableDiff
@@ -1,36 +0,0 @@
1
- export enum DiffLineType {
2
- Context,
3
- Add,
4
- Delete,
5
- Hunk,
6
- }
7
-
8
- export class DiffLine {
9
- public constructor(
10
- public readonly text: string,
11
- public readonly type: DiffLineType,
12
- public readonly originalLineNumber: number | null,
13
- public readonly oldLineNumber: number | null,
14
- public readonly newLineNumber: number | null,
15
- public readonly noTrailingNewLine: boolean = false
16
- ) {}
17
-
18
- public withNoTrailingNewLine(noTrailingNewLine: boolean): DiffLine {
19
- return new DiffLine(
20
- this.text,
21
- this.type,
22
- this.originalLineNumber,
23
- this.oldLineNumber,
24
- this.newLineNumber,
25
- noTrailingNewLine
26
- )
27
- }
28
-
29
- public isIncludeableLine() {
30
- return this.type === DiffLineType.Add || this.type === DiffLineType.Delete
31
- }
32
-
33
- public get content(): string {
34
- return this.text.substring(1)
35
- }
36
- }
@@ -1,165 +0,0 @@
1
- export enum DiffSelectionType {
2
- All = 'All',
3
- Partial = 'Partial',
4
- None = 'None',
5
- }
6
-
7
- function typeMatchesSelection(
8
- selectionType: DiffSelectionType,
9
- selected: boolean
10
- ): boolean {
11
- switch (selectionType) {
12
- case DiffSelectionType.All:
13
- return selected
14
- case DiffSelectionType.None:
15
- return !selected
16
- case DiffSelectionType.Partial:
17
- return false
18
- }
19
- }
20
-
21
- export class DiffSelection {
22
- public static fromInitialSelection(
23
- initialSelection: DiffSelectionType.All | DiffSelectionType.None
24
- ): DiffSelection {
25
- return new DiffSelection(initialSelection, null, null)
26
- }
27
-
28
- private constructor(
29
- private readonly defaultSelectionType: DiffSelectionType.All | DiffSelectionType.None,
30
- private readonly divergingLines: Set<number> | null = null,
31
- private readonly selectableLines: Set<number> | null = null
32
- ) {}
33
-
34
- public getSelectionType(): DiffSelectionType {
35
- const divergingLines = this.divergingLines
36
- const selectableLines = this.selectableLines
37
-
38
- if (!divergingLines || divergingLines.size === 0) {
39
- return this.defaultSelectionType
40
- }
41
-
42
- if (selectableLines && selectableLines.size === divergingLines.size) {
43
- const allSelectableLinesAreDivergent = [...selectableLines].every(i =>
44
- divergingLines.has(i)
45
- )
46
- if (allSelectableLinesAreDivergent) {
47
- return this.defaultSelectionType === DiffSelectionType.All
48
- ? DiffSelectionType.None
49
- : DiffSelectionType.All
50
- }
51
- }
52
-
53
- return DiffSelectionType.Partial
54
- }
55
-
56
- public isSelected(lineIndex: number): boolean {
57
- const lineIsDivergent =
58
- !!this.divergingLines && this.divergingLines.has(lineIndex)
59
-
60
- if (this.defaultSelectionType === DiffSelectionType.All) {
61
- return !lineIsDivergent
62
- }
63
- return lineIsDivergent
64
- }
65
-
66
- public isRangeSelected(from: number, length: number): DiffSelectionType {
67
- if (length <= 0) return DiffSelectionType.None
68
-
69
- const computedSelectionType = this.getSelectionType()
70
- if (computedSelectionType !== DiffSelectionType.Partial) {
71
- return computedSelectionType
72
- }
73
-
74
- if (length === 1) {
75
- return this.isSelected(from) ? DiffSelectionType.All : DiffSelectionType.None
76
- }
77
-
78
- const to = from + length
79
- let foundSelected = false
80
- let foundDeselected = false
81
- for (let i = from; i < to; i++) {
82
- if (this.isSelected(i)) foundSelected = true
83
- if (!this.isSelected(i)) foundDeselected = true
84
- if (foundSelected && foundDeselected) return DiffSelectionType.Partial
85
- }
86
-
87
- return foundSelected ? DiffSelectionType.All : DiffSelectionType.None
88
- }
89
-
90
- public isSelectable(lineIndex: number): boolean {
91
- return this.selectableLines ? this.selectableLines.has(lineIndex) : true
92
- }
93
-
94
- public withLineSelection(lineIndex: number, selected: boolean): DiffSelection {
95
- return this.withRangeSelection(lineIndex, 1, selected)
96
- }
97
-
98
- public withRangeSelection(from: number, length: number, selected: boolean): DiffSelection {
99
- const computedSelectionType = this.getSelectionType()
100
- const to = from + length
101
-
102
- if (typeMatchesSelection(computedSelectionType, selected)) {
103
- return this
104
- }
105
-
106
- if (computedSelectionType === DiffSelectionType.Partial) {
107
- const newDivergingLines = new Set<number>(this.divergingLines!)
108
-
109
- if (typeMatchesSelection(this.defaultSelectionType, selected)) {
110
- for (let i = from; i < to; i++) {
111
- newDivergingLines.delete(i)
112
- }
113
- } else {
114
- for (let i = from; i < to; i++) {
115
- if (this.isSelectable(i)) {
116
- newDivergingLines.add(i)
117
- }
118
- }
119
- }
120
-
121
- return new DiffSelection(
122
- this.defaultSelectionType,
123
- newDivergingLines.size === 0 ? null : newDivergingLines,
124
- this.selectableLines
125
- )
126
- }
127
-
128
- const newDivergingLines = new Set<number>()
129
- for (let i = from; i < to; i++) {
130
- if (this.isSelectable(i)) {
131
- newDivergingLines.add(i)
132
- }
133
- }
134
-
135
- return new DiffSelection(
136
- computedSelectionType,
137
- newDivergingLines,
138
- this.selectableLines
139
- )
140
- }
141
-
142
- public withToggleLineSelection(lineIndex: number): DiffSelection {
143
- return this.withLineSelection(lineIndex, !this.isSelected(lineIndex))
144
- }
145
-
146
- public withSelectAll(): DiffSelection {
147
- return new DiffSelection(DiffSelectionType.All, null, this.selectableLines)
148
- }
149
-
150
- public withSelectNone(): DiffSelection {
151
- return new DiffSelection(DiffSelectionType.None, null, this.selectableLines)
152
- }
153
-
154
- public withSelectableLines(selectableLines: Set<number>) {
155
- const divergingLines = this.divergingLines
156
- ? new Set([...this.divergingLines].filter(x => selectableLines.has(x)))
157
- : null
158
-
159
- return new DiffSelection(
160
- this.defaultSelectionType,
161
- divergingLines,
162
- selectableLines
163
- )
164
- }
165
- }
@@ -1,6 +0,0 @@
1
- export enum ImageDiffType {
2
- TwoUp,
3
- Swipe,
4
- OnionSkin,
5
- Difference,
6
- }
@@ -1,8 +0,0 @@
1
- export class Image {
2
- public constructor(
3
- public readonly rawContents: ArrayBufferLike,
4
- public readonly contents: string,
5
- public readonly mediaType: string,
6
- public readonly bytes: number
7
- ) {}
8
- }
@@ -1,6 +0,0 @@
1
- export * from './diff-data'
2
- export * from './diff-line'
3
- export * from './diff-selection'
4
- export * from './image'
5
- export * from './raw-diff'
6
- export * from './image-diff'