-
Notifications
You must be signed in to change notification settings - Fork 2
/
foxpro_plasticscm_dm.prg
1885 lines (1549 loc) · 81.8 KB
/
foxpro_plasticscm_dm.prg
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
*------------------------------------------------------------------------------
*-- FOXPRO_PLASTICSCM_DM.PRG - Visual FoxPro 9.0 DIFF/MERGE para PlasticSCM
*-- Fernando D. Bozzo - 18/12/2013
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* VER DETALLE DE PARÁMETROS EN CADA OPERACIÓN (lcOperacion="CHECKIN", etc)
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS P01, P02, P03, P04, P05, P06, P07, P08, P09, P10
#DEFINE CR_LF CHR(13) + CHR(10)
TRY
LOCAL loEx AS EXCEPTION, loTool AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
LOCAL lsBuffer, lnAddress, lnBufsize, lnPcount ;
, lcOperation, lcSourcePath, lcDestinationPath, lcSourceSymbolic, lcDestinationSymbolic ;
, lcBasePath, lcBaseSymbolic, lcOutputPath
lnPcount = PCOUNT()
loEx = NULL
*tcTool = UPPER( EVL( tcTool, 'DIFF' ) )
loTool = CREATEOBJECT('CL_SCM_LIB')
_SCREEN.ADDPROPERTY( 'ExitCode', 0 )
*MESSAGEBOX( TRANSFORM(p01),64+4096 )
IF lnPcount <= 1 && Fox no los ve... pero están ahí :)
* Obtengo la linea completa de comandos
* Adaptado de http://www.news2news.com/vfp/?example=51&function=78
* Facilitado por Mario Lopez en el foro FoxPro de Google Español - 23/12/2013
* https://groups.google.com/d/msg/publicesvfoxpro/llS-kTNrG9M/LA4D3fd152IJ
*-----------------------------------------------------------------------------
DECLARE INTEGER GetCommandLine IN kernel32
DECLARE INTEGER GlobalSize IN kernel32 INTEGER HMEM
DECLARE RtlMoveMemory IN kernel32 AS CopyMemory STRING @Destination, INTEGER SOURCE, INTEGER nLength
lnAddress = GetCommandLine() && returns an address in memory
lnBufsize = GlobalSize(lnAddress)
* allocating and filling a buffer
IF lnBufsize <> 0
lsBuffer = REPLICATE(CHR(0), lnBufsize)
= CopyMemory(@lsBuffer, lnAddress, lnBufsize)
ENDIF
lsBuffer = CHRTRAN(lsBuffer, CHR(0)+'"', " ")
loTool.writeLog( TTOC(DATETIME()) )
loTool.writeLog( 'Buffer de parámetros: [' + lsBuffer + ']' )
FOR I = 1 TO OCCURS("'", lsBuffer) / 2
*loTool.writeLog( '- Se asignará [' + TRANSFORM( STREXTRACT(lsBuffer, "'", "'", I*2-1, 0) ) ;
+ '] a [' + TRANSFORM( ('P' + TRANSFORM(I,'@L ##') ) ) + ']' )
STORE STREXTRACT(lsBuffer, "'", "'", I*2-1, 0) TO ('P' + TRANSFORM(I,'@L ##'))
lnPcount = lnPcount + 1
ENDFOR
RELEASE lsBuffer, lnAddress, lnBufsize
CLEAR DLLS 'GetCommandLine', 'GlobalSize', 'RtlMoveMemory'
ENDIF
IF .F.
loTool.lDebug = .T.
loTool.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
loTool.writeLog( 'P01 =' + (EVL(P01,'')) )
loTool.writeLog( 'P02 =' + (EVL(P02,'')) )
loTool.writeLog( 'P03 =' + (EVL(P03,'')) )
loTool.writeLog( 'P04 =' + (EVL(P04,'')) )
loTool.writeLog( 'P05 =' + (EVL(P05,'')) )
loTool.writeLog( 'P06 =' + (EVL(P06,'')) )
loTool.writeLog( 'P07 =' + (EVL(P07,'')) )
loTool.writeLog( 'P08 =' + (EVL(P08,'')) )
loTool.writeLog( 'P09 =' + (EVL(P09,'')) )
loTool.writeLog( 'P10 =' + (EVL(P10,'')) )
lcOperation = 'ERR'
*ERROR 'Error'
ENDIF
lcOperation = UPPER(EVL(P01,'DIFF'))
loTool.cOperation = lcOperation
DO CASE
CASE VARTYPE(loTool) <> 'O'
loEx = CREATEOBJECT("Exception")
CASE lcOperation == 'ADD'
*------------------------------------------------------------------------------
* NO FUNCIONA EL TRIGGER "ADD" EN PLASTIC 5.X! :(
*--------------------------------------------------------------------------------------------------------------
loTool.P_Add( @loEx, P02, P03, P04 )
CASE lcOperation == 'CHECKIN'
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcOperacion (!v IN ) Operación a realizar (Ej: CH=Changed, AD=Added, MV=Moved, DE=Deleted)
* tcFileOrPath (!v IN ) Path del archivo o directorio (Ej: "c:\DESA\FileName_Caps")
* tcTypeOfFile (!v IN ) Tipo de archivo (Ej: FILE, DIR)
*--------------------------------------------------------------------------------------------------------------
loTool.P_Checkin( @loEx, P02, P03, P04 )
CASE lcOperation == 'CHECKOUT'
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcFile (!v IN ) Path del archivo (Ej: "c:\DESA\FileName_Caps")
*--------------------------------------------------------------------------------------------------------------
loTool.P_Checkout( @loEx, P02 )
CASE lcOperation == 'DIFF'
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcDestinationSymbolic (!v IN ) Ruta simbólica del archivo destino con información del changeset, branch o revisión
*--------------------------------------------------------------------------------------------------------------
lcSourcePath = P02
lcDestinationPath = P03
lcSourceSymbolic = P04
lcDestinationSymbolic = P05
loTool.P_Diff( @loEx, lcSourcePath, lcDestinationPath, lcSourceSymbolic, lcDestinationSymbolic )
CASE lcOperation == 'MERGE'
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcDestinationSymbolic (!v IN ) Ruta simbólica del archivo destino con información del changeset, branch o revisión
* tcBasePath (!v IN ) Path del archivo base (base del archivo origen y del destino)
* tcBaseSymbolic (!v IN ) Ruta simbólica del archivo base con información del changeset, branch o revisión
* tcOutputPath (!v IN ) Path del archivo de salida generado
*--------------------------------------------------------------------------------------------------------------
lcSourcePath = P02
lcDestinationPath = P03
lcSourceSymbolic = P04
lcDestinationSymbolic = P05
lcBasePath = P06
lcBaseSymbolic = P07
lcOutputPath = P08
loTool.P_Merge( @loEx, lcSourcePath, lcDestinationPath, lcSourceSymbolic, lcDestinationSymbolic, lcBasePath, lcBaseSymbolic, lcOutputPath )
CASE lcOperation == 'PRESERVE_WS'
*------------------------------------------------------------------------------
* PRESERVA LOS ARCHIVOS BINARIOS DEL WORKSPACE, PARA HACER MERGE SOLO DE LOS TX2
*------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcDestinationSymbolic (!v IN ) Ruta simbólica del archivo destino con información del changeset, branch o revisión
* tcBasePath (!v IN ) Path del archivo base (base del archivo origen y del destino)
* tcBaseSymbolic (!v IN ) Ruta simbólica del archivo base con información del changeset, branch o revisión
* tcOutputPath (!v IN ) Path del archivo de salida generado
*--------------------------------------------------------------------------------------------------------------
lcSourcePath = P02
lcDestinationPath = P03
lcSourceSymbolic = P04
lcDestinationSymbolic = P05
lcBasePath = P06
lcBaseSymbolic = P07
lcOutputPath = P08
loTool.writeLog( 'Salteando archivo [' + tcSourcePath + ']' )
OTHERWISE
loEx = CREATEOBJECT("Exception")
ENDCASE
CATCH TO loEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(loEx.ERRORNO) + ', ' + loEx.MESSAGE + CR_LF ;
+ loEx.PROCEDURE + ', line ' + TRANSFORM(loEx.LINENO) + CR_LF ;
+ loEx.LINECONTENTS + CR_LF ;
+ loEx.USERVALUE
loTool.writeLog( lcMenError )
FINALLY
loTool = NULL
ENDTRY
IF NOT ISNULL(loEx)
loEx = NULL
_SCREEN.ADDPROPERTY( 'ExitCode', 1 )
ENDIF
RELEASE loEx, loTool
IF _VFP.STARTMODE <= 1
RETURN
ENDIF
IF _SCREEN.ExitCode = 1
DECLARE ExitProcess IN Win32API INTEGER ExitCode
ExitProcess(1)
ENDIF
QUIT
*******************************************************************************
DEFINE CLASS CL_SCM_LIB AS SESSION
_MEMBERDATA = [<VFPData>] ;
+ [<memberdata name="csys16" display="cSys16"/>] ;
+ [<memberdata name="ccm" display="cCM"/>] ;
+ [<memberdata name="cexepath" display="cEXEPath"/>] ;
+ [<memberdata name="changefileattribute" display="ChangeFileAttribute"/>] ;
+ [<memberdata name="cplasticpath" display="cPlasticPath"/>] ;
+ [<memberdata name="baseprocessformerge" display="BaseProcessForMerge"/>] ;
+ [<memberdata name="converttobinaryprocess" display="ConvertToBinaryProcess"/>] ;
+ [<memberdata name="coperation" display="cOperation"/>] ;
+ [<memberdata name="copyfile" display="CopyFile"/>] ;
+ [<memberdata name="ctextlog" display="cTextLog"/>] ;
+ [<memberdata name="deletefile" display="DeleteFile"/>] ;
+ [<memberdata name="destinationprocessfordiff" display="DestinationProcessForDiff"/>] ;
+ [<memberdata name="destinationprocessformerge" display="DestinationProcessForMerge"/>] ;
+ [<memberdata name="diffprocess" display="DiffProcess"/>] ;
+ [<memberdata name="findworkspacefilename" display="FindWorkspaceFileName"/>] ;
+ [<memberdata name="getsecondaryextensions" display="GetSecondaryExtensions"/>] ;
+ [<memberdata name="initialize" display="Initialize"/>] ;
+ [<memberdata name="ldebug" display="lDebug"/>] ;
+ [<memberdata name="c_texterror" display="c_TextError"/>] ;
+ [<memberdata name="l_error" display="l_Error"/>] ;
+ [<memberdata name="l_initialized" display="l_Initialized"/>] ;
+ [<memberdata name="mergeprocess" display="MergeProcess"/>] ;
+ [<memberdata name="movefile" display="MoveFile"/>] ;
+ [<memberdata name="normalizarcapitalizacionarchivos" display="normalizarCapitalizacionArchivos"/>] ;
+ [<memberdata name="ofso" display="oFSO"/>] ;
+ [<memberdata name="oshell" display="oShell"/>] ;
+ [<memberdata name="o_foxbin2prg" display="o_FoxBin2Prg"/>] ;
+ [<memberdata name="obtenerarchivosdeldirectorio" display="ObtenerArchivosDelDirectorio"/>] ;
+ [<memberdata name="obtenercambiospendientes" display="ObtenerCambiosPendientes"/>] ;
+ [<memberdata name="obtenerworkspacedir" display="ObtenerWorkspaceDir"/>] ;
+ [<memberdata name="p_add" display="P_Add"/>] ;
+ [<memberdata name="p_checkin" display="P_Checkin"/>] ;
+ [<memberdata name="p_checkout" display="P_Checkout"/>] ;
+ [<memberdata name="p_diff" display="P_Diff"/>] ;
+ [<memberdata name="p_merge" display="P_Merge"/>] ;
+ [<memberdata name="renamefile" display="RenameFile"/>] ;
+ [<memberdata name="runcommand" display="RunCommand"/>] ;
+ [<memberdata name="sourceprocessfordiff" display="SourceProcessForDiff"/>] ;
+ [<memberdata name="sourceprocessformerge" display="SourceProcessForMerge"/>] ;
+ [<memberdata name="writelog" display="writeLog"/>] ;
+ [</VFPData>]
#IF .F.
LOCAL THIS AS CL_SCM_LIB OF FOXPRO_PLASTICSCM_DM.PRG
#ENDIF
oShell = NULL
oFSO = NULL
o_FoxBin2Prg = NULL
cSys16 = ''
cEXEPath = ''
lDebug = .F.
cPlasticPath = ''
cCM = ''
cTextLog = ''
cOperation = ''
l_Initialized = .F.
l_Error = .F.
c_TextError = ''
PROCEDURE INIT
SET DATE TO YMD
SET HOURS TO 24
SET CENTURY ON
SET SAFETY OFF
SET TALK OFF
SET NOTIFY OFF
THIS.writeLog()
THIS.writeLog( TTOC(DATETIME()) + ' ' + REPLICATE('#',80) )
*THIS.writeLog( '---' + PROGRAM() + ' >>> Inicio' )
ENDPROC
PROCEDURE DESTROY
THIS.FlushLog()
ENDPROC
PROCEDURE FlushLog
IF NOT EMPTY(THIS.cTextLog) AND THIS.lDebug
*THIS.writeLog( '---' + PROGRAM() + ' <<< Fin.' )
STRTOFILE( THIS.cTextLog + CR_LF, FORCEPATH( 'foxpro_plasticscm_dm.log', GETENV("TEMP") ), 1 )
THIS.cTextLog = ''
ENDIF
ENDPROC
PROCEDURE Initialize
LPARAMETERS tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic, tcBasePath, tcBaseSymbolic, tcOutputPath
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
IF INLIST( .cOperation, 'DIFF', 'MERGE' )
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
.writeLog( 'SourcePath =' + TRANSFORM(EVL(tcSourcePath,'')) )
.writeLog( 'DestinationPath =' + TRANSFORM(EVL(tcDestinationPath,'')) )
.writeLog( 'SourceSymbolic =' + TRANSFORM(EVL(tcSourceSymbolic,'')) )
.writeLog( 'DestinationSymbolic =' + TRANSFORM(EVL(tcDestinationSymbolic,'')) )
.writeLog( 'BasePath =' + TRANSFORM(EVL(tcBasePath,'')) )
.writeLog( 'BaseSymbolic =' + TRANSFORM(EVL(tcBaseSymbolic,'')) )
.writeLog( 'OutputPath =' + TRANSFORM(EVL(tcOutputPath,'')) )
ENDIF
IF NOT .l_Initialized
LOCAL lcPlasticSCM, lcScriptExeVersion, lcFoxBin2PrgExeVersion, lcFoxBin2PrgExe, laVersion(1) ;
, loShell AS WScript.SHELL
STORE '' TO lcScriptExeVersion, lcFoxBin2PrgExeVersion
.oShell = CREATEOBJECT("WScript.Shell")
.oFSO = CREATEOBJECT("scripting.filesystemobject")
.cSys16 = SYS(16)
.cSys16 = SUBSTR( .cSys16, AT( GETWORDNUM( .cSys16, 2), .cSys16 ) + LEN( GETWORDNUM( .cSys16, 2) ) + 1 )
.cEXEPath = JUSTPATH( .cSys16 )
.cPlasticPath = ''
lcFoxBin2PrgExe = FORCEPATH( "FOXBIN2PRG.EXE", .cEXEPath )
IF _VFP.StartMode = 0 THEN
SET PROCEDURE TO ( FORCEPATH( "FOXBIN2PRG.PRG", .cEXEPath ) ) ADDITIVE
ELSE
SET PROCEDURE TO ( lcFoxBin2PrgExe ) ADDITIVE
ENDIF
.o_FoxBin2Prg = CREATEOBJECT("c_FoxBin2Prg")
*.o_FoxBin2Prg.evaluateConfiguration( tcDontShowProgress, tcDontShowErrors, tcNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels, tcClearUniqueID, tcOptimizeByFilestamp, tc_InputFile )
*.o_FoxBin2Prg.evaluateConfiguration( '1', '1' )
.o_FoxBin2Prg.evaluateConfiguration( '1', '1', '', '', '', '', '', '', tcSourcePath )
.o_FoxBin2Prg.l_AutoClearProcessedFiles = .F.
.writeLog( 'Se evaluó la configuración para el archivo [' + TRANSFORM(tcSourcePath) + ']' )
.lDebug = (.o_FoxBin2Prg.n_Debug > 0) && ( FILE( FORCEEXT( .cSys16, 'LOG' ) ) )
.writeLog( 'lDebug =' + TRANSFORM(.lDebug) )
lcScriptExeVersion = 'Unknown'
lcFoxBin2PrgExeVersion = 'Unknown'
IF UPPER(JUSTEXT(.cSys16)) = 'EXE' THEN
IF AGETFILEVERSION( laVersion, .cSys16 ) > 0 THEN
lcScriptExeVersion = laVersion(11)
ENDIF
ENDIF
IF AGETFILEVERSION( laVersion, lcFoxBin2PrgExe ) > 0 THEN
lcFoxBin2PrgExeVersion = laVersion(11)
ENDIF
.writeLog( 'FoxBin2Prg =' + TRANSFORM(lcFoxBin2PrgExe) + ' - Version ' + lcFoxBin2PrgExeVersion + ' (FoxPro Version: ' + VERSION(4) + ')' )
.writeLog( 'sys(16) =' + TRANSFORM(.cSys16) + ' - Version ' + lcScriptExeVersion )
.writeLog( 'cEXEPath =' + TRANSFORM(.cEXEPath) )
IF INLIST( .cOperation, 'DIFF', 'MERGE', 'CHECKIN', 'REGEN' )
loShell = .oShell
lcPlasticSCM = loShell.RegRead('HKEY_CLASSES_ROOT\plastic\shell\open\command\')
.writeLog( 'lcPlasticSCM =' + TRANSFORM(lcPlasticSCM) )
IF EMPTY( lcPlasticSCM )
.cCM = '"cm.exe"'
ELSE
.cCM = STRTRAN( STREXTRACT( lcPlasticSCM, '"', '"', 1, 4 ), 'plastic.exe', 'cm.exe' )
.cPlasticPath = JUSTPATH(.cCM)
ENDIF
ENDIF
.writeLog( REPLICATE('-',80) )
.l_Initialized = .T.
ENDIF
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
ENDPROC
PROCEDURE P_Add
*--------------------------------------------------------------------------------------------------------------
* PROCESA EL ADD
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* toEx (?@ OUT) Objeto con información del error
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS toEx AS EXCEPTION, P02, P03, P04
TRY
LOCAL lcMenError, lcStdIn, laStdIn(1,3), laLineas(1), I ;
, loFSO AS Scripting.FileSystemObject ;
, loStdIn AS Scripting.TextStream ;
, loStdOut AS Scripting.TextStream ;
, loStdErr AS Scripting.TextStream
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
toEx = NULL
.Initialize()
loFSO = .oFSO
IF EMPTY(P02) OR EMPTY(P03) OR EMPTY(P04)
loStdIn = loFSO.GetStandardStream(0) && Standard Input
*.writeLog( 'StdIn: --------------------' )
lcStdIn = loStdIn.ReadAll()
ELSE
lcStdIn = P02 + ' "' + P03 + '" ' + P04 + CR_LF
ENDIF
.writeLog( lcStdIn )
* Estructura a leer de ejemplo: => c.1 c.2------------------------------------- c.3
* CH "c:\DESA\FileName_Caps" DIR => CH c:\DESA\FileName_Caps DIR
* AD "c:\DESA\FileName_Caps\CONFIG" DIR => AD c:\DESA\FileName_Caps\CONFIG DIR
* AD "c:\DESA\FileName_Caps\CONFIG\config.fpw" FILE => AD c:\DESA\FileName_Caps\CONFIG\config.fpw FILE
FOR I = 1 TO ALINES(laLineas, lcStdIn, 1+4 )
IF ALINES( laStdIn, laLineas(I), 1, ["] ) > 0 THEN
.writeLog( '[' + laStdIn(1,1) + '] [' + laStdIn(1,2) + '] [' + laStdIn(1,3) + ']' )
IF laStdIn(1,1) = 'AD' AND laStdIn(1,3) = 'FILE'
*.writeLog( [=> laStdIn(1,1) = 'AD' AND laStdIn(1,3) = 'FILE'] )
.normalizarCapitalizacionArchivos( laStdIn(1,2) )
ELSE
*.writeLog( [La condición no se cumplió] )
ENDIF
ENDIF
ENDFOR
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO toEx WHEN toEx.MESSAGE = '0'
toEx = NULL
CATCH TO toEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(toEx.ERRORNO) + ', ' + toEx.MESSAGE + CR_LF ;
+ toEx.PROCEDURE + ', line ' + TRANSFORM(toEx.LINENO) + CR_LF ;
+ toEx.LINECONTENTS + CR_LF ;
+ toEx.USERVALUE
THIS.writeLog( lcMenError )
IF _VFP.StartMode = 0
MESSAGEBOX( lcMenError, 0+16+4096, "ATENCIÓN!!", 60000 )
ENDIF
FINALLY
IF VARTYPE(loStdIn) = 'O'
loStdIn.CLOSE()
ENDIF
THIS.writeLog( '' )
ENDTRY
RETURN
ENDPROC
PROCEDURE P_Checkin
*--------------------------------------------------------------------------------------------------------------
* PROCESA EL CHECKIN
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* toEx (?@ OUT) Objeto con información del error
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS toEx AS EXCEPTION, P02, P03, P04
TRY
LOCAL lcMenError, lcStdIn, laStdIn(1,3), laLineas(1), I, X, lcTempFile, laWS(1), lcWorkspaceDir, lcExt, lcCmd ;
, loFSO AS Scripting.FileSystemObject ;
, loStdIn AS Scripting.TextStream ;
, loStdOut AS Scripting.TextStream ;
, loStdErr AS Scripting.TextStream ;
, loShell AS WScript.SHELL ;
, loFB2P AS c_FoxBin2Prg OF FOXBIN2PRG.PRG
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
toEx = NULL
.Initialize()
loFSO = .oFSO
loShell = .oShell
IF EMPTY(P02) OR EMPTY(P03) OR EMPTY(P04)
loStdIn = loFSO.GetStandardStream(0) && Standard Input
*.writeLog( 'StdIn: --------------------' )
lcStdIn = loStdIn.ReadAll()
ELSE
lcStdIn = P02 + ' "' + P03 + '" ' + P04 + CR_LF
ENDIF
*.writeLog( lcStdIn )
* Estructura a leer de ejemplo: => c.1 c.2------------------------------------- c.3
* CH "c:\DESA\FileName_Caps" DIR => CH c:\DESA\FileName_Caps DIR
* AD "c:\DESA\FileName_Caps\CONFIG" DIR => AD c:\DESA\FileName_Caps\CONFIG DIR
* AD "c:\DESA\FileName_Caps\CONFIG\config.fpw" FILE => AD c:\DESA\FileName_Caps\CONFIG\config.fpw FILE
FOR I = 1 TO ALINES(laLineas, lcStdIn, 1+4 )
IF ALINES( laStdIn, laLineas(I), 1, ["] ) > 0 THEN
*-- OBTENGO EL WORKSPACE DEL ITEM
lcExt = UPPER( JUSTEXT( laStdIn(1,2) ) )
IF I = 1
lcTempFile = '"' + FORCEPATH('cm_tmp.txt', SYS(2023)) + '"'
lcCmd = GETENV("ComSpec") + " /C " + JUSTFNAME(.cCM) + ' lwk --format={2} > ' + lcTempFile
.writeLog( lcCmd )
loShell.RUN( lcCmd, 0, .T. )
FOR X = 1 TO ALINES(laWS, FILETOSTR( lcTempFile ) )
.writeLog( 'Buscar [' + UPPER(ADDBS(laWS(X))) + '] dentro de [' + ADDBS(UPPER(laStdIn(1,2))) + ']' )
IF UPPER(ADDBS(laWS(X))) $ ADDBS(UPPER(laStdIn(1,2))) THEN
lcWorkspaceDir = laWS(X)
EXIT
ENDIF
ENDFOR
IF EMPTY(lcWorkspaceDir)
ERROR "No se encontró el Workspace del archivo " + laStdIn(1,2)
ENDIF
loFB2P = THIS.o_FoxBin2Prg
*CD (lcWorkspaceDir)
ENDIF
.writeLog( '[' + laStdIn(1,1) + '] [' + laStdIn(1,2) + '] [' + laStdIn(1,3) + ']' )
*-- REGENERO EL BINARIO Y RECOMPILO
IF INLIST( lcExt, loFB2P.c_VC2, loFB2P.c_SC2, loFB2P.c_FR2, loFB2P.c_LB2 )
.writeLog( '- Regenerando binario para archivo: ' + laStdIn(1,2) )
loFB2P.execute( laStdIn(1,2), '', '', '', '1', '1', '1', '', '', .T., '', lcWorkspaceDir, '1', '1' )
ENDIF
*ERROR 'Fin Test Checkin!'
ENDIF
ENDFOR
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO toEx WHEN toEx.MESSAGE = '0'
toEx = NULL
CATCH TO toEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(toEx.ERRORNO) + ', ' + toEx.MESSAGE + CR_LF ;
+ toEx.PROCEDURE + ', line ' + TRANSFORM(toEx.LINENO) + CR_LF ;
+ toEx.LINECONTENTS + CR_LF ;
+ toEx.USERVALUE
THIS.writeLog( lcMenError )
IF _VFP.StartMode = 0
MESSAGEBOX( lcMenError, 0+16+4096, "ATENCIÓN!!", 60000 )
ENDIF
FINALLY
IF VARTYPE(loStdIn) = 'O'
loStdIn.CLOSE()
ENDIF
THIS.writeLog( '' )
RELEASE loStdIn, loStdOut, loStdErr, loFSO, loShell, loFB2P
CD (THIS.cEXEPath)
ENDTRY
RETURN
ENDPROC
PROCEDURE P_Checkout
*--------------------------------------------------------------------------------------------------------------
* PROCESA EL CHECKOUT
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* toEx (?@ OUT) Objeto con información del error
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS toEx AS EXCEPTION, P02
TRY
LOCAL lcMenError, lcStdIn ;
, loFSO AS Scripting.FileSystemObject ;
, loStdIn AS Scripting.TextStream ;
, loStdOut AS Scripting.TextStream ;
, loStdErr AS Scripting.TextStream
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
toEx = NULL
.Initialize()
loFSO = .oFSO
IF EMPTY(P02)
loStdIn = loFSO.GetStandardStream(0) && Standard Input
*.writeLog( 'StdIn: --------------------' )
lcStdIn = loStdIn.ReadAll()
ELSE
lcStdIn = P02 + CR_LF
ENDIF
.writeLog( lcStdIn )
*TRY
* loStdOut = loFSO.GetStandardStream(1) && Standard Output
* loStdOut.Write( lcStdIn )
*CATCH
*ENDTRY
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO toEx WHEN toEx.MESSAGE = '0'
toEx = NULL
CATCH TO toEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(toEx.ERRORNO) + ', ' + toEx.MESSAGE + CR_LF ;
+ toEx.PROCEDURE + ', line ' + TRANSFORM(toEx.LINENO) + CR_LF ;
+ toEx.LINECONTENTS + CR_LF ;
+ toEx.USERVALUE
THIS.writeLog( lcMenError )
IF _VFP.StartMode = 0
MESSAGEBOX( lcMenError, 0+16+4096, "ATENCIÓN!!", 60000 )
ENDIF
FINALLY
IF VARTYPE(loStdIn) = 'O'
loStdIn.CLOSE()
ENDIF
THIS.writeLog( '' )
ENDTRY
RETURN
ENDPROC
PROCEDURE P_Diff
*--------------------------------------------------------------------------------------------------------------
* PROCESA EL DIFF
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* toEx (?@ OUT) Objeto con información del error
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcDestinationSymbolic (!v IN ) Ruta simbólica del archivo destino con información del changeset, branch o revisión
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS toEx AS EXCEPTION, tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic
TRY
LOCAL lnExitCode AS INTEGER ;
, loEx AS EXCEPTION ;
, lcExtension_b, lcExtension_c, lcExtension_2, lcDestinationExtension, llNotInWorkspace ;
, lcMenError, lcSourceSymbolicFileName, lcDestinationSymbolicFileName, lcWorkspaceFileName
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
STORE '' TO lcWorkspaceFileName, lcExtension_b, lcExtension_c, lcExtension_2, lcDestinationExtension
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
loEx = NULL
tcSourcePath = STRTRAN( tcSourcePath, '\\', '\' )
tcDestinationPath = STRTRAN( tcDestinationPath, '\\', '\' )
.Initialize( tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic )
.FindWorkspaceFileName( @lcWorkspaceFileName, tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic )
lcDestinationExtension = JUSTEXT(tcDestinationPath)
llNotInWorkspace = .T.
.GetSecondaryExtensions( lcDestinationExtension, @lcExtension_b, @lcExtension_c, @lcExtension_2 )
.SourceProcessForDiff( lcDestinationExtension, lcExtension_b, lcExtension_c, tcSourceSymbolic, tcSourcePath, tcDestinationPath, lcWorkspaceFileName )
llNotInWorkspace = .DestinationProcessForDiff( lcDestinationExtension, lcExtension_b, lcExtension_c, tcDestinationSymbolic, tcDestinationPath, lcWorkspaceFileName )
.DiffProcess( lcDestinationExtension, lcExtension_b, lcExtension_c, lcExtension_2, tcSourcePath, tcDestinationPath, llNotInWorkspace )
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO toEx WHEN toEx.MESSAGE = '0'
toEx = NULL
CATCH TO toEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(toEx.ERRORNO) + ', ' + toEx.MESSAGE + CR_LF ;
+ toEx.PROCEDURE + ', line ' + TRANSFORM(toEx.LINENO) + CR_LF ;
+ toEx.LINECONTENTS + CR_LF ;
+ toEx.USERVALUE
THIS.writeLog( lcMenError )
IF _VFP.StartMode = 0
MESSAGEBOX( lcMenError, 0+16+4096, "ATENCIÓN!!", 60000 )
ENDIF
ENDTRY
RETURN
ENDPROC
PROCEDURE P_Merge
*--------------------------------------------------------------------------------------------------------------
* PROCESA EL MERGE
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* toEx (?@ OUT) Objeto con información del error
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcDestinationSymbolic (!v IN ) Ruta simbólica del archivo destino con información del changeset, branch o revisión
* tcBasePath (!v IN ) Path del archivo base (base del archivo origen y del destino)
* tcBaseSymbolic (!v IN ) Ruta simbólica del archivo base con información del changeset, branch o revisión
* tcOutputPath (!v IN ) Path del archivo de salida generado
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS toEx AS EXCEPTION, tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic, tcBasePath, tcBaseSymbolic, tcOutputPath
TRY
LOCAL lnExitCode AS INTEGER ;
, loEx AS EXCEPTION ;
, lcExtension_b, lcExtension_c, lcExtension_2, lcDestinationExtension ;
, lcMenError, lcSourceSymbolicFileName, lcDestinationSymbolicFileName, lcWorkspaceFileName ;
, lcTextMergeResult
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
STORE '' TO lcWorkspaceFileName, lcExtension_b, lcExtension_c, lcExtension_2, lcDestinationExtension, lcTextMergeResult
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
loEx = NULL
tcSourcePath = STRTRAN( tcSourcePath, '\\', '\' )
tcBasePath = STRTRAN( tcBasePath, '\\', '\' )
tcDestinationPath = STRTRAN( tcDestinationPath, '\\', '\' )
tcOutputPath = STRTRAN( tcOutputPath, '\\', '\' )
.Initialize( tcSourcePath, tcDestinationPath, tcSourceSymbolic, tcDestinationSymbolic, tcBasePath, tcBaseSymbolic, tcOutputPath )
lcDestinationExtension = JUSTEXT(tcDestinationPath)
lcWorkspaceFileName = tcDestinationPath
.GetSecondaryExtensions( lcDestinationExtension, @lcExtension_b, @lcExtension_c, @lcExtension_2 )
.SourceProcessForMerge( lcDestinationExtension, lcExtension_b, lcExtension_c, tcSourceSymbolic, tcSourcePath, tcDestinationPath, lcWorkspaceFileName )
.BaseProcessForMerge( lcDestinationExtension, lcExtension_b, lcExtension_c, tcBaseSymbolic, tcBasePath, lcWorkspaceFileName )
.DestinationProcessForMerge( lcDestinationExtension, lcExtension_b, lcExtension_c, tcDestinationSymbolic, tcDestinationPath, lcWorkspaceFileName )
lcTextMergeResult = .MergeProcess( lcDestinationExtension, lcExtension_b, lcExtension_c, lcExtension_2, tcSourcePath, tcBasePath, tcDestinationPath, tcOutputPath )
.ConvertToBinaryProcess( lcDestinationExtension, lcExtension_b, lcExtension_c, lcExtension_2, lcTextMergeResult, tcDestinationPath, tcOutputPath )
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO toEx WHEN toEx.MESSAGE = '0'
toEx = NULL
CATCH TO toEx
lcMenError = 'CurDir: ' + SYS(5)+CURDIR() + CR_LF ;
+ 'Error ' + TRANSFORM(toEx.ERRORNO) + ', ' + toEx.MESSAGE + CR_LF ;
+ toEx.PROCEDURE + ', line ' + TRANSFORM(toEx.LINENO) + CR_LF ;
+ toEx.LINECONTENTS + CR_LF ;
+ toEx.USERVALUE
THIS.writeLog( lcMenError )
IF _VFP.StartMode = 0
MESSAGEBOX( lcMenError, 0+16+4096, "ATENCIÓN!!", 60000 )
ENDIF
ENDTRY
RETURN
ENDPROC
FUNCTION SourceProcessForDiff
*--------------------------------------------------------------------------------------------------------------
* PROCESO DEL ARCHIVO ORIGEN PARA EL DIFF
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcDestinationExtension (!v IN ) Extensión de destino
* tcExtension_b (!v IN ) Extensión secundaria (PJT,VCT,SCT,FRT,LBT,MNT,FPT,DCT,...)
* tcExtension_c (!v IN ) Extensión terciaria (CDX,DCX,...)
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcWorkspaceFileName (!v IN ) Nombre del archivo en el workspace (inferido de los parámetros de entrada)
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS tcDestinationExtension, tcExtension_b, tcExtension_c, tcSourceSymbolic, tcSourcePath ;
, tcDestinationPath, tcWorkspaceFileName
#IF .F.
LOCAL THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
#ENDIF
TRY
LOCAL lcSourceSymbolicExtensionReplaced, lcSourceSpecForCatCommand, lcSourcePathExtensionReplaced ;
, laSourceSymbolicExtensionReplaced_Splited(1), lcCommand, lnCommandResult, lcSourcePathParsed
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
lnCommandResult = 0
lcSourceSymbolicExtensionReplaced = STRTRAN( tcSourceSymbolic, '.' + tcDestinationExtension, '.' + tcExtension_b )
* Parse source symbolic when operation is: "Diff with previous revision"
IF '@' $ lcSourceSymbolicExtensionReplaced
*-------------------------------------------------------------------------------
* Ejemplo 1: sourcesymbolic="c:\DESA\foxbin2prg\foxbin2prg.pjx#cs:61@br:/main/inicio soporte MNX fdbozzo"
* Ejemplo 2: sourcesymbolic="cs:61@br:/main/inicio soporte MNX fdbozzo" ==> Al hacer un DIFF luego de un MERGE sin confirmar
*-------------------------------------------------------------------------------
ALINES( laSourceSymbolicExtensionReplaced_Splited, lcSourceSymbolicExtensionReplaced, 4, '@')
lcSourceSpecForCatCommand = '"' + laSourceSymbolicExtensionReplaced_Splited[1] + '"'
IF NOT '#' $ lcSourceSpecForCatCommand
*-- Cuando se hace un MERGE y no se confirman los cambios, el DIFF no devuelve
*-- el nombre del archivo en SourceFile, sino en DestinationFile
.writeLog( '=> Se cambia lcSourceSpecForCatCommand de [' + lcSourceSpecForCatCommand ;
+ '] a ["' + STRTRAN( tcDestinationPath, '.' + tcDestinationExtension, '.' + tcExtension_b) + '#' + SUBSTR(lcSourceSpecForCatCommand,2) + ']' )
lcSourceSpecForCatCommand = '"' + STRTRAN( tcDestinationPath, '.' + tcDestinationExtension, '.' + tcExtension_b) + '#' + SUBSTR(lcSourceSpecForCatCommand,2)
ENDIF
ELSE && Parse source symbolic when operation is: "Diff between revision A and revision B"
*-------------------------------------------------------------------------------
* Ejemplo 1: sourcesymbolic="rev:c:\DESA\foxbin2prg\foxbin2prg.pjx#cs:61"
* Ejemplo 2: sourcesymbolic="c:\DESA\foxbin2prg\foxbin2prg.prg#br:/main/v1.12 DESA"
*-------------------------------------------------------------------------------
ALINES( laSourceSymbolicExtensionReplaced_Splited, lcSourceSymbolicExtensionReplaced, 4, 'rev:')
lcSourceSpecForCatCommand = '"' + laSourceSymbolicExtensionReplaced_Splited[1] + '"'
ENDIF
lcSourcePathExtensionReplaced = STRTRAN( tcSourcePath, '.' + tcDestinationExtension, '.' + tcExtension_b )
*-------------------------------------------------------------------------------
* Ejemplo 1: "C:\Program Files\PlasticSCM5\client\cm.exe" cat "c:\DESA\foxbin2prg\foxbin2prg.pjt" --file="C:\Temp\ff3bd392-3464-47d1-b096-734a08d46fd9.pjt"
*-------------------------------------------------------------------------------
lcCommand = .cCM + ' cat ' + lcSourceSpecForCatCommand + ' --file="' + lcSourcePathExtensionReplaced + '"'
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "There was an error performing the diff operation."
ENDIF
lcSourcePathParsed = ' "' + tcSourcePath + '" "0" "0" "0" "0" "0" "0" "' + tcWorkspaceFileName + '" "1" "1"'
lcCommand = '"' + FORCEPATH( 'foxbin2prg.exe', .cEXEPath ) + '"' + lcSourcePathParsed
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "Foxbin2prg devolvió un error"
ENDIF
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO loEx
IF _VFP.STARTMODE = 0 AND THIS.lDebug
SET STEP ON
ENDIF
THROW
ENDTRY
RETURN
ENDFUNC
FUNCTION SourceProcessForMerge
*--------------------------------------------------------------------------------------------------------------
* PROCESO DEL ARCHIVO ORIGEN PARA EL MERGE
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcDestinationExtension (!v IN ) Extensión de destino
* tcExtension_b (!v IN ) Extensión secundaria (PJT,VCT,SCT,FRT,LBT,MNT,FPT,DCT,...)
* tcExtension_c (!v IN ) Extensión terciaria (CDX,DCX,...)
* tcSourceSymbolic (!v IN ) Ruta simbólica del archivo origen con información del changeset, branch o revisión
* tcSourcePath (!v IN ) Path del archivo origen
* tcDestinationPath (!v IN ) Path del archivo destino
* tcWorkspaceFileName (!v IN ) Nombre del archivo en el workspace (inferido de los parámetros de entrada)
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS tcDestinationExtension, tcExtension_b, tcExtension_c, tcSourceSymbolic, tcSourcePath ;
, tcDestinationPath, tcWorkspaceFileName
#IF .F.
LOCAL THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
#ENDIF
TRY
LOCAL lcSourceSymbolicExtensionReplaced, lcSourceSpecForCatCommand, lcSourcePathExtensionReplaced ;
, laSourceSymbolicExtensionReplaced_Splited(1), lcCommand, lnCommandResult, lcSourcePathParsed
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
lnCommandResult = 0
lcSourceSymbolicExtensionReplaced = STRTRAN( tcSourceSymbolic, tcDestinationExtension, tcExtension_b )
*-------------------------------------------------------------------------------
* Ejemplo: sourcesymbolic="c:\DESA\foxbin2prg\foxbin2prg.pjt#/main/v1.15p1#cs:62"
*-------------------------------------------------------------------------------
ALINES( laSourceSymbolicExtensionReplaced_Splited, lcSourceSymbolicExtensionReplaced, 4, '#')
lcSourceSpecForCatCommand = '"' + laSourceSymbolicExtensionReplaced_Splited[1] + '#' ;
+ laSourceSymbolicExtensionReplaced_Splited[3] + '"'
lcSourcePathExtensionReplaced = STRTRAN( tcSourcePath, '.' + tcDestinationExtension, '.' + tcExtension_b )
*-------------------------------------------------------------------------------
* Ejemplo: lcCommand="C:\Program Files\PlasticSCM5\client\cm.exe" cat "c:\DESA\foxbin2prg\foxbin2prg.pjt" --file="C:\Temp\ff3bd392-3464-47d1-b096-734a08d46fd9.pjt"
*-------------------------------------------------------------------------------
lcCommand = .cCM + ' cat ' + lcSourceSpecForCatCommand + ' --file="' + lcSourcePathExtensionReplaced + '"'
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "There was an error performing the merge operation."
ENDIF
lcSourcePathParsed = ' "' + tcSourcePath + '" "0" "0" "0" "0" "0" "0" "' + tcWorkspaceFileName + '" "1" "1"'
lcCommand = '"' + FORCEPATH( 'foxbin2prg.exe', .cEXEPath ) + '"' + lcSourcePathParsed
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "Foxbin2prg devolvió un error"
ENDIF
IF THIS.lDebug
*MESSAGEBOX( 'FoxBin2prg se le envió el archivo Origen [' + tcSourcePath + ']' + CR_LF ;
+ '(Ya se generó el PJ2. Ver si el archivo está en el directorio Origen)' ;
, 0+64+4096 ;
, 'PUNTO DE CONTROL EN "' + PROGRAM() + '"' ;
, 600000 )
ENDIF
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO loEx
IF _VFP.STARTMODE = 0 AND THIS.lDebug
SET STEP ON
ENDIF
THROW
ENDTRY
RETURN
ENDFUNC
FUNCTION BaseProcessForMerge
*--------------------------------------------------------------------------------------------------------------
* PROCESO DEL ARCHIVO BASE PARA EL MERGE
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcDestinationExtension (!v IN ) Extensión de destino
* tcExtension_b (!v IN ) Extensión secundaria (PJT,VCT,SCT,FRT,LBT,MNT,FPT,DCT,...)
* tcExtension_c (!v IN ) Extensión terciaria (CDX,DCX,...)
* tcBaseSymbolic (!v IN ) Ruta simbólica del archivo base con información del changeset, branch o revisión
* tcBasePath (!v IN ) Path del archivo base
* tcWorkspaceFileName (!v IN ) Nombre del archivo en el workspace (inferido de los parámetros de entrada)
*--------------------------------------------------------------------------------------------------------------
LPARAMETERS tcDestinationExtension, tcExtension_b, tcExtension_c, tcBaseSymbolic, tcBasePath, tcWorkspaceFileName
#IF .F.
LOCAL THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
#ENDIF
TRY
LOCAL lcBaseSymbolicExtensionReplaced, lcBaseSpecForCatCommand, lcBasePathExtensionReplaced ;
, laBaseSymbolicExtensionReplaced_Splited(1), lcCommand, lnCommandResult, lcBasePathParsed
WITH THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
.writeLog( '---' + PADR( PROGRAM(),77, '-' ) )
lnCommandResult = 0
lcBaseSymbolicExtensionReplaced = STRTRAN( tcBaseSymbolic, '.' + tcDestinationExtension, '.' + tcExtension_b )
*-------------------------------------------------------------------------------
* Ejemplo: basesymbolic="c:\DESA\foxbin2prg\foxbin2prg.pjt#/main/v1.15p1#cs:62"
*-------------------------------------------------------------------------------
ALINES( laBaseSymbolicExtensionReplaced_Splited, lcBaseSymbolicExtensionReplaced, 4, '#')
lcBaseSpecForCatCommand = '"' + laBaseSymbolicExtensionReplaced_Splited[1] + '#' ;
+ laBaseSymbolicExtensionReplaced_Splited[3] + '"'
lcBasePathExtensionReplaced = STRTRAN( tcBasePath, '.' + tcDestinationExtension, '.' + tcExtension_b )
*-------------------------------------------------------------------------------
* Ejemplo: lcCommand="C:\Program Files\PlasticSCM5\client\cm.exe" cat "c:\DESA\foxbin2prg\foxbin2prg.pjt" --file="C:\Temp\ff3bd392-3464-47d1-b096-734a08d46fd9.pjt"
*-------------------------------------------------------------------------------
lcCommand = .cCM + ' cat ' + lcBaseSpecForCatCommand + ' --file="' + lcBasePathExtensionReplaced + '"'
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "There was an error performing the merge operation."
ENDIF
lcBasePathParsed = ' "' + tcBasePath + '" "0" "0" "0" "0" "0" "0" "' + tcWorkspaceFileName + '" "1" "1"'
lcCommand = '"' + FORCEPATH( 'foxbin2prg.exe', .cEXEPath ) + '"' + lcBasePathParsed
lnCommandResult = .RunCommand( lcCommand )
IF (lnCommandResult == 1)
ERROR "Foxbin2prg devolvió un error"
ENDIF
IF THIS.lDebug
*MESSAGEBOX( 'FoxBin2prg se le envió el archivo Base [' + tcBasePath + ']' + CR_LF ;
+ '(Ya se generó el PJ2. Ver si el archivo está en el directorio Base)' ;
, 0+64+4096 ;
, 'PUNTO DE CONTROL EN "' + PROGRAM() + '"' ;
, 600000 )
ENDIF
ENDWITH && THIS AS CL_SCM_LIB OF 'FOXPRO_PLASTICSCM_DM.PRG'
CATCH TO loEx
IF _VFP.STARTMODE = 0 AND THIS.lDebug
SET STEP ON
ENDIF
THROW
ENDTRY
RETURN
ENDFUNC
FUNCTION DestinationProcessForDiff
*--------------------------------------------------------------------------------------------------------------
* PROCESO DEL ARCHIVO DESTINO PARA EL DIFF
*--------------------------------------------------------------------------------------------------------------
* PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT)
* tcDestinationExtension (!v IN ) Extensión de destino
* tcExtension_b (!v IN ) Extensión secundaria (PJT,VCT,SCT,FRT,LBT,MNT,FPT,DCT,...)