-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSublimerge Macros.sublime-settings
1119 lines (1018 loc) · 41.6 KB
/
Sublimerge Macros.sublime-settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// /*
// NOTE: PLEASE DO NOT EDIT THIS FILE TO PREVENT YOUR CUSTOM SETTINGS FROM BEING OVERRIDDEN EACH TIME SUBLIMERGE
// IS UPGRADED. READ BELOW HOW TO IMPLEMENT YOUR OWN COMMANDS.
// This file contains default Macros.
// If you want to create your own, please do it in `Macros - User` file. Please initialize that file
// with the following content in order not to override the default ones:
// "macros_user": [
// //your definitions here
// ]
// Remember that you can call shell scripts. If something can't be done here, or requires more advanced logic,
// you can do it in that script and return a parseable output.
// To make Macro available only for Git, SVN or Mercurial, set 'requires' to one of the following:
// 'git', 'svn', 'hg'. Set to null if doesn't need any of VCS.
// To make Macro available only for OSX, Windows or Linux, set 'platform' to one of the following:
// 'osx', 'windows', 'linux'. Can be also an array containing multiple systems.
// NOTE: currently there are no debugging mechanisms implemented so while creating new Macro, please open
// Sublime's console for error logging.
// Predefined variables:
// ${CONFIG:<config_key>} - returns a configuration value for given key
// ${CURRENT:REPO_ROOT} - root directory where '.svn', '.git' or '.hg' is located
// ${CURRENT:FILE} - full path of active file, i.e. '/Users/workspace/my_project/something.js'
// ${CURRENT:FILE_DIR} - full path of active file owning directory, i.e. '/Users/workspace/my_project'
// ${CURRENT:FILE_NAME} - name of active file, i.e. 'something.js'
// ${ENV:TEMP_DIR} - path to system's temporary files directory
// Variables modifiers:
// ${variable|basename} - if `variable` contains filesystem path, will return only its base name
// ${variable|dirname} - if `variable` contains filesystem path, will return only its directory path
// ${variable|ext} - if `variable` contains filesystem path/file name, will return only file's extension
// ${variable|repopath} - if `variable` contains filesystem path, will left-trim repository root (if applicable)
// i.e.
// ${CURRENT:FILE|basename}
// ${CURRENT:FILE|dirname}
// Modifiers can be chained:
// ${CURRENT:FILE|dirname|dirname|...}
// Each Macro is defined as follows:
// {
// "name": "Macro Name",
// "requires": null, //can be 'git', 'svn', 'hg' or null. When skipped defaults to null.
// "platform": null, //can be 'osx', 'windows', 'linux' or null or array. When skipped defaults to null.
// "steps": [
// {
// //step 1
// },
// {
// //step 2
// },
// ...
// {
// //step N
// }
// ]
// }
// Each step MUST consist of ONLY ONE directive. One of these:
// - quick_panel
// - history_panel
// - define
// - prompt
// - capture
// - compare
// - log
// - sublime_command
// - ok_cancel_dialog
// - yes_no_cancel_dialog
// NOTE: each string argument accepts ${variable} placeholders for variables.
// Syntax and description:
// log
// Prints debugging information into Sublime's console.
// log {
// <string> text
// }
// history_panel
// Displays Quick Panel with list of commits for given file. When user selects a commit,
// variable defined by `name` is populated with commit number. If file is not versioned
// or does not exist, displays an error message and stop Macro execution. Works
// automatically for Git, SVN and Mercurial.
// history_panel {
// <string> name,
// <string> file
// }
// quick_panel
// Displays Quick Panel (list menu) with data prepared by `source` directive.
// String argument `name` is used to populate a variable which will hold selected value.
// quick_panel {
// <string> name,
// <source> source
// }
// source
// Parses output returned by command defined in `execute` directive. Returns parsed items
// to the parent `quick_panel`. If parsed output is empty, stops flow execution and
// optionally displays message defined by `empty_message` string argument. If `alpha` argument
// is true, then all items are sorted alphabetically. If `reverse` argument is true, items are
// sorted in reversed order. Can be used together with `alpha`. When `none` or `only` is set,
// then items are filtered against it. Arguments `none` and `only` must not be set together.
// Use only one of them.
// source {
// <execute> execute,
// <item> item
// [, <boolean> alpha=false]
// [, <boolean> reverse=false]
// [, <only> only]
// [, <none> none]
// [, <string> empty_message]
// }
// only, none
// Controls how to filter data returned by `source` directive. You can pass one of the
// following arguments: `source` - another `source` directive to fetch values, or `values`
// which is array of predefined string values.
// `only` - return only items which value is listed,
// `none` - return only items which value is not listed
// only, none {
// [<source> source]
// [,<array> values]
// }
// execute
// Executes given command in given directory
// execute {
// <string> command,
// <string> directory
// }
// item
// Used by `source` directive to parse its `execute` output. Parsing is called for every
// output line. The `regexp` string argument defines regular expression to be used to parse line.
// The `caption` argument, array of strings, is used to create each item which will be displayed
// in `quick_panel`. The `value` string argument sets item's value.
// Both `caption` and `value` accepts '@<number>' placeholders for each `regexp` capturing group,
// i.e. @0, @1 and so on.
// To make all items unique by their values, set `unique` argument to true.
// item {
// <string> regexp,
// <array> caption,
// <string> value
// [, <boolean> unique=false]
// }
// define
// Allows to define variables to be used in next steps. Variable values may contain ${variable}
// placeholders to be replaced with previously declared variables' values.
// define {
// <string> var_name_1: <string> var_value_1,
// ...
// <string> var_name_N: <string> var_value_N
// }
// compare
// Runs files comparison. Optionally can call a shell command given in `execute` statement just
// before comparison is run.
// compare {
// [<execute> execute, ]
// <left> left,
// <right> right
// }
// left, right
// Defines left and right files for `compare` directive. The boolean `temporary` argument defines
// whether a file is temporary. Temporary files are read-only and are automatically removed
// after comparison is done. When `title` is provided then it is used for files' tab title.
// Defaults to file name.
// left, right {
// <string> file,
// <boolean> temporary
// [, <string>] title
// }
// capture
// Captures output from `execute` directive. If you want a step to run `execute` directive you must
// put it in `capture`.
// `name` - if set, a variable containing captured output will be populated
// `regexp` - if set, used to find and and parse matching output lines
// `value` - if set, allows to format output line. Accepts '@<number>' placeholders for `regexp`
// `greedy` - by default `capture` is not greedy and will stop on first (matching) line
// `empty_message` - if set, empty capture will display a message and stop flow
// `continue_if_empty` - if true, Macro execution will not be interrupted if captured output is empty.
// Applies only when empty_message is set.
// capture {
// <execute> execute
// [, <string> name]
// [, <string> regexp]
// [, <string> value]
// [, <boolean> greedy=false]
// [, <string> empty_message]
// [, <boolean> continue_if_empty = false]
// }
// prompt
// Displays a text box in the bottom of editor and populates a variable, defined by `name` with
// text entered by user. The `caption` string argument is used to display field's caption.
// The `default` string argument defines initial value displayed in field.
// prompt {
// <string> name,
// <string> caption
// [, <string> default]
// }
// sublime_command
// Runs Sublime Text's built-in (or plugins-provided) command.
// sublime_command {
// <string> command
// [, <object> args]
// }
// ok_cancel_dialog
// Displays ok/cancel dialog to let the user make a decision. The macro proceeds to next steps
// when all steps defined in `on_ok` are done. Pressing Cancel button stops Macro execution.
// ok_cancel_dialog {
// <string> message,
// <list> on_ok
// [, <string> ok_title]
// }
// yes_no_cancel_dialog
// Displays yes/no/cancel dialog to let the user make a decision. The macro proceeds to next steps
// when all steps defined in `on_yes` or `on_no` are done. Pressing Cancel button stops Macro execution.
// yes_no_cancel_dialog {
// <string> message,
// <list> on_yes,
// <list> on_no
// [, <string> yes_title]
// [, <string> no_title]
// }
// */
{
"macros": [
/************************************* GIT *************************************/
/*
* Git: Displays quick panel with modified files and allows to compare working copy to HEAD to see uncommited changes.
*/
{
"name": "Show Uncommited Changes...", //Macro name
"requires": "git", //What does it require. Currently 'git', 'svn' 'hg' or null (if doesn't require any of VCS)
"steps": [ //Macro is divided into steps. You can define more steps when needed.
{
"quick_panel": { //Displays a Quick Panel with given attributes
"name": "modified_file", //Quick Panel name. Used to populate a variable 'modified_file' with seleted item value
"source": { //Data source
"execute": { //Execute a shell command
"command": "${git} status --porcelain --untracked-files=no",
"directory": "${CURRENT:REPO_ROOT}" //Set a command working directory
},
"item": { //Single item extractor
"regexp": "^\\s+M\\s+\"?(.*?)\"?$", //Regular expression to parse each output line
"caption": ["@1"], //Caption is an array. Each item is another line. @n - placeholder for regular expression match
"value": "@1" //Value must be a single string
},
"empty_message": "There are no uncommited changes" //Message to be displayed when data source is empty (no items created)
}
}
},
{ //define variables
"define": {
"right_file": "${CURRENT:REPO_ROOT}/${modified_file}",
"left_file": "${ENV:TEMP_DIR}/${modified_file|basename}@HEAD"
}
},
{
"compare": { //Executes file comparison
"execute": { //Execute a shell command. Please note about 'modified_file' variable which we defined in previous step
"command": "${git} show HEAD:\"./${modified_file}\" > \"${left_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"left": { //Left file
"file": "${left_file}", //Full file path
"temporary": true //This file is generated by previous shell command, so remove it automatically after use
},
"right": {
"file": "${right_file}",
"temporary": false //This file is our working copy, so is not temporary
}
}
}
]
},
/*
* Git: Allows to compare your working file with the same file in another branch
*/
{
"name": "Compare to Other Branch...",
"requires": "git",
"steps": [
{
"quick_panel": {
"name": "get_branch",
"source": {
"execute": {
"command": "${git} branch",
"directory": "${CURRENT:FILE_DIR}"
},
"item": {
"regexp": "^(?:(\\*\\s+)|(?:\\s+))([^\\(]+)$",
"caption": ["@1@2", "${CURRENT:FILE_NAME} in @2"],
"value": "@2"
},
"empty_message": "There are no branches"
}
}
},
{
"define": {
"output_file": "${ENV:TEMP_DIR}/${CURRENT:FILE|basename}@branch"
}
},
{
"compare": {
"execute": {
"command": "${git} show \"${get_branch}\":\"./${CURRENT:FILE_NAME}\" > \"${output_file}\"",
"directory": "${CURRENT:FILE_DIR}"
},
"left": {
"title": "${CURRENT:FILE|basename}@${get_branch}",
"file": "${output_file}",
"temporary": true
},
"right": {
"file": "${CURRENT:FILE}",
"temporary": false
}
}
}
]
},
/*
* Git: Allows to show unpushed changes
*/
{
"name": "Show Unpushed Changes...",
"requires": "git",
"steps": [
{
"capture": { //get current branch name
"name": "branch", //populate as `branch` variable
"execute": {
"command": "${git} branch --no-color",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^\\*\\s+(.+)$",
"value": "@1"
}
},
{
"capture": {
"name": "ref_head",
"execute": {
"command": "${git} symbolic-ref HEAD",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^([^\\s]+)$",
"value": "@1"
}
},
{
"capture": {
"name": "remote",
"execute": {
"command": "${git} branch -vv --no-color",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^\\*.*?\\[([^/]+/[^:\\]]+).*?\\].*$",
"value": "@1",
"empty_message": "${branch} is not a remote-tracking branch" //if no match is found, display a message and stop
}
},
{
"quick_panel": {
"name": "file",
"source": {
"execute": {
"command": "${git} log ${remote}..HEAD --name-status --no-decorate --pretty=\"format:\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^M\\s+(.+)$",
"caption": ["@1", "${remote}"],
"value": "@1",
"unique": true //every item's value must be unique. duplicates will be filtered out
},
"empty_message": "There are no unpushed changes"
}
}
},
{
"define": {
"left_file": "${ENV:TEMP_DIR}/${file|basename}@remote${file|ext}", //append extension so that syntax highlight will be applied
"right_file": "${ENV:TEMP_DIR}/${file|basename}@HEAD${file|ext}" //append extension so that syntax highlight will be applied
}
},
{
"capture": { //capture also allows to run `execute` block as a step
"execute": {
"command": "${git} show HEAD:\"./${file}\" > \"${right_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"compare": {
"execute": {
"command": "${git} show ${remote}:\"./${file}\" > \"${left_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"left": {
"file": "${left_file}",
"title": "${file|basename}@${remote}",
"temporary": true
},
"right": {
"file": "${right_file}",
"title": "${file|basename}@${ref_head}",
"temporary": true
}
}
}
]
},
/*
* Git: Allows to show changes between current HEAD and selected remote
*/
{
"name": "Show Changes Between Current and Remote...",
"requires": "git",
"steps": [
{
"capture": {
"name": "branch",
"execute": {
"command": "${git} branch --no-color",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^\\*\\s+(.+)$",
"value": "@1"
}
},
{
"capture": {
"name": "ref_head",
"execute": {
"command": "${git} symbolic-ref HEAD",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^([^\\s]+)$",
"value": "@1"
}
},
{
"quick_panel": {
"name": "remote",
"source": {
"execute": {
"command": "${git} branch -r --no-color",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^\\s+([^\\s]+)(.*)$",
"caption": ["@1@2", "Compare ${ref_head} to @1"],
"value": "@1"
}
}
}
},
{
"quick_panel": {
"name": "file",
"source": {
"execute": {
"command": "${git} log ${remote}..HEAD --name-status --no-decorate --pretty=\"format:\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^M\\s+(.+)$",
"caption": ["@1", "${remote}"],
"value": "@1",
"unique": true
},
"empty_message": "There are no changes between ${ref_head} and ${remote}"
}
}
},
{
"define": {
"right_file": "${ENV:TEMP_DIR}/${file|basename}@remote${file|ext}",
"left_file": "${ENV:TEMP_DIR}/${file|basename}@HEAD${file|ext}"
}
},
{
"capture": {
"execute": {
"command": "${git} show HEAD:\"./${file}\" > \"${right_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"compare": {
"execute": {
"command": "${git} show ${remote}:\"./${file}\" > \"${left_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"left": {
"file": "${left_file}",
"title": "${file|basename}@${remote}",
"temporary": true
},
"right": {
"file": "${right_file}",
"title": "${file|basename}@${ref_head}",
"temporary": true
}
}
}
]
},
/*
* Git: Lists conflicted files and runs 3-way diff to resolve conflicts
*/
{
"name": "List and Resolve Conflicts...",
"requires": "git",
"steps": [
{
"quick_panel": {
"name": "conflicted_file",
"source": {
"execute": {
"command": "${git} status --porcelain --untracked-files=no",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^UU\\s+\"?(.*?)\"?$",
"caption": ["@1"],
"value": "@1"
},
"empty_message": "There are no files in conflicted state"
}
}
},
{
"capture": {
"name": "base",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+1.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"capture": {
"name": "theirs",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+2.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"capture": {
"name": "mine",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+3.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"define": {
"theirs_file": "${ENV:TEMP_DIR}/${theirs}${conflicted_file|ext}",
"base_file": "${ENV:TEMP_DIR}/${base}${conflicted_file|ext}",
"mine_file": "${ENV:TEMP_DIR}/${mine}${conflicted_file|ext}",
"merged_file": "${CURRENT:REPO_ROOT}/${conflicted_file}"
}
},
{
"capture": {
"execute": {
"command": "${git} show ${theirs} > ${theirs_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
},
},
{
"capture": {
"execute": {
"command": "${git} show ${base} > ${base_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
},
},
{
"capture": {
"execute": {
"command": "${git} show ${mine} > ${mine_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"compare": {
"theirs": {
"file": "${theirs_file}",
"temporary": true,
"title": "Theirs: ${conflicted_file}"
},
"base": {
"file": "${base_file}",
"temporary": true
},
"mine": {
"file": "${mine_file}",
"temporary": true,
"title": "Mine: ${conflicted_file}"
},
"merged": {
"file": "${merged_file}",
"temporary": false
}
}
},
{
"ok_cancel_dialog": {
"message": "${conflicted_file}\n\nMark as resolved?",
"ok_title": "Resolved",
"on_ok": [
{
"capture": {
"execute": {
"command": "${git} add '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
}
]
}
}
]
},
/*
* Git: Allows to resolve conflicts in current file
*/
{
"name": "Resolve Conflicts in Current File",
"requires": "git",
"steps": [
{
"define": {
"conflicted_file": "${CURRENT:FILE|repopath}"
}
},
{
"capture": {
"execute": {
"command": "${git} ls-files -u '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
},
"regexp": "^(.*)$",
"value": "@1",
"empty_message": "No conflicts in file"
}
},
{
"capture": {
"name": "base",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+1.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"capture": {
"name": "theirs",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+2.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"capture": {
"name": "mine",
"greedy": true,
"regexp": "^\\d{6}\\s+([a-z0-9]+)\\s+3.*$",
"value": "@1",
"execute": {
"command": "${git} ls-files -u --full-name '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"define": {
"theirs_file": "${ENV:TEMP_DIR}/${theirs}${conflicted_file|ext}",
"base_file": "${ENV:TEMP_DIR}/${base}${conflicted_file|ext}",
"mine_file": "${ENV:TEMP_DIR}/${mine}${conflicted_file|ext}",
"merged_file": "${CURRENT:FILE}"
}
},
{
"capture": {
"execute": {
"command": "${git} show ${theirs} > ${theirs_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
},
},
{
"capture": {
"execute": {
"command": "${git} show ${base} > ${base_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
},
},
{
"capture": {
"execute": {
"command": "${git} show ${mine} > ${mine_file}",
"directory": "${CURRENT:REPO_ROOT}"
}
}
},
{
"compare": {
"theirs": {
"file": "${theirs_file}",
"temporary": true,
"title": "Theirs: ${conflicted_file}"
},
"base": {
"file": "${base_file}",
"temporary": true
},
"mine": {
"file": "${mine_file}",
"temporary": true,
"title": "Mine: ${conflicted_file}"
},
"merged": {
"file": "${merged_file}",
"temporary": false
}
}
},
{
"ok_cancel_dialog": {
"message": "${conflicted_file}\n\nMark as resolved?",
"ok_title": "Resolved",
"on_ok": [
{
"capture": {
"execute": {
"command": "${git} add '${conflicted_file}'",
"directory": "${CURRENT:REPO_ROOT}"
}
}
}
]
}
}
]
},
/*
* Git: Allows to run custom Git command and compare working file with command's output
*/
{
"name": "Compare to Custom Git Command Output...",
"requires": "git",
"steps": [
{
"prompt": {
"name": "args",
"caption": "${git}"
}
},
{
"define": {
"tmp_file": "${ENV:TEMP_DIR}/${CURRENT:FILE|basename}@custom"
}
},
{
"compare": {
"execute": {
"command": "${git} ${args} > \"${tmp_file}\"",
"directory": "${CURRENT:FILE_DIR}"
},
"left": {
"file": "${CURRENT:FILE}",
"temporary": false
},
"right": {
"file": "${tmp_file}",
"temporary": true
}
}
}
]
},
/************************************* SVN *************************************/
/**
* SVN: Displays quick panel with modified files and allows to compare working copy to HEAD to see uncommited changes.
*/
{
"name": "Show Uncommited Changes...",
"requires": "svn",
"steps": [
{
"quick_panel": {
"name": "modified_file",
"source": {
"execute": {
"command": "${svn} status",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^M\\s+\"?(.*?)\"?$",
"caption": ["@1"],
"value": "@1"
},
"empty_message": "There are no uncommited changes"
}
}
},
{
"define": {
"output_file": "${ENV:TEMP_DIR}/${modified_file|basename}@HEAD"
}
},
{
"compare": {
"execute": {
"command": "${svn} cat \"${modified_file}\"@HEAD > \"${output_file}\"",
"directory": "${CURRENT:REPO_ROOT}"
},
"left": {
"file": "${output_file}",
"temporary": true
},
"right": {
"file": "${CURRENT:REPO_ROOT}/${modified_file}",
"temporary": false
}
}
}
]
},
/*
* SVN: Allows to run custom SVN command and compare working file with command's output
*/
{
"name": "Compare to Custom SVN Command Output...",
"requires": "svn",
"steps": [
{
"prompt": {
"name": "args",
"caption": "${svn}"
}
},
{
"define": {
"tmp_file": "${ENV:TEMP_DIR}/${CURRENT:FILE|basename}@custom"
}
},
{
"compare": {
"execute": {
"command": "${svn} ${args} > \"${tmp_file}\"",
"directory": "${CURRENT:FILE_DIR}"
},
"left": {
"file": "${CURRENT:FILE}",
"temporary": false
},
"right": {
"file": "${tmp_file}",
"temporary": true
}
}
}
]
},
/************************************* MERCURIAL *************************************/
/**
* Mercurial: Displays quick panel with modified files and allows to compare working copy to tip to see uncommited changes.
*/
{
"name": "Show Uncommited Changes...",
"requires": "hg",
"steps": [
{
"quick_panel": {
"name": "modified_file",
"source": {
"execute": {
"command": "${hg} status",
"directory": "${CURRENT:REPO_ROOT}"
},
"item": {
"regexp": "^M\\s+\"?(.*?)\"?$",
"caption": ["@1"],
"value": "@1"
},