Skip to content

Commit a520cda

Browse files
authored
Merge pull request #574 from intersystems/fix-526
fix: production conflict auto-resolve works again
2 parents 7bbcfd1 + bf7ab4b commit a520cda

File tree

3 files changed

+151
-8
lines changed

3 files changed

+151
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3535
- Fix branches with special characters not showing in GitUI (#523)
3636
- Fix filenames with spaces not showing correctly in workspace view (#551)
3737
- Removed inaccurate placeholder text for commit message in UI (#406)
38+
- Fixed regression that broke production conflict auto-resolve (#526)
3839
- Initialize repo in settings page now uses entered repo (#486)
3940
- Report error more clearly if you try to create a branch with an invalid name (#534)
4041
- Don't default to WINDOWS style paths (#357)

cls/SourceControl/Git/Util/ProductionConflictResolver.cls

+11-5
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,22 @@ ClassMethod FromLog(pOutStream As %Stream.Object) As SourceControl.Git.Util.Prod
5050

5151
Method ConsumeStream() [ Private ]
5252
{
53+
Set conflicts = 0
5354
Do ..logStream.Rewind()
5455
Do ..logStream.ReadLine()
55-
Set productionLine = ..logStream.ReadLine()
56-
Set ..productionFile = $Piece(productionLine,"Merge conflict in ",2)
57-
If ..productionFile = "" {
56+
while '..logStream.AtEnd {
57+
Set conflictLine = ..logStream.ReadLine()
58+
If $Extract(conflictLine,1,8) = "CONFLICT" {
59+
Set conflicts($i(conflicts)) = $Piece(conflictLine,"Merge conflict in ",2)
60+
}
61+
}
62+
If (conflicts = 0) {
5863
$$$ThrowStatus($$$ERROR($$$GeneralError,"Message did not reflect merge conflict on a single file."))
5964
}
60-
If '..logStream.AtEnd {
65+
If conflicts '= 1 {
6166
$$$ThrowStatus($$$ERROR($$$GeneralError,"Multiple files had merge conflicts; cannot resolve intelligently."))
6267
}
68+
Set ..productionFile = conflicts(1)
6369
Set internalName = ##class(SourceControl.Git.Utils).NameToInternalName(..productionFile)
6470
If ($Piece(internalName,".",*) '= "CLS") {
6571
$$$ThrowStatus($$$ERROR($$$GeneralError,"File with conflict is not a class."))
@@ -153,4 +159,4 @@ ClassMethod ResolveStream(stream As %Stream.Object)
153159
Quit 1
154160
}
155161

156-
}
162+
}

test/UnitTest/SourceControl/Git/ProductionConflictResolve.cls

+139-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
Class UnitTest.SourceControl.Git.ProductionConflictResolve Extends %UnitTest.TestCase
22
{
33

4-
Method TestResolve()
4+
Method TestBasicResolve()
5+
{
6+
Do ..DoResolveTest(1)
7+
}
8+
9+
Method TestResolveWithSettings()
10+
{
11+
Do ..DoResolveTest(2)
12+
}
13+
14+
Method DoResolveTest(index As %Integer)
515
{
616
Set file = ##class(%Stream.FileCharacter).%New()
717
Set file.RemoveOnClose = 1
8-
Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen($classname(),"SampleFile1",,.sc)
18+
Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen($classname(),"SampleFile"_index,,.sc)
919
While 'xdata.Data.AtEnd {
1020
Do file.WriteLine(xdata.Data.ReadLine())
1121
}
1222
$$$ThrowOnError(file.%Save())
1323

1424
Set resolved = ##class(%Stream.FileCharacter).%New()
1525
Set resolved.RemoveOnClose = 1
16-
Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen($classname(),"ResolvedFile1",,.sc)
26+
Set xdata = ##class(%Dictionary.XDataDefinition).IDKEYOpen($classname(),"ResolvedFile"_index,,.sc)
1727
While 'xdata.Data.AtEnd {
1828
Do resolved.WriteLine(xdata.Data.ReadLine())
1929
}
@@ -138,4 +148,130 @@ XData ProductionDefinition
138148
}
139149
}
140150

151+
XData SampleFile2 [ MimeType = text/plain ]
152+
{
153+
Class HCC.Connect.Production Extends Ens.Production
154+
{
155+
156+
XData ProductionDefinition
157+
{
158+
<Production Name="HCC.Connect.Production" LogGeneralTraceEvents="false">
159+
<Description>Health Connect Cloud Base Production</Description>
160+
<ActorPoolSize>1</ActorPoolSize>
161+
<Item Name="Ens.Activity.Operation.Local" Category="" ClassName="Ens.Activity.Operation.Local" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
162+
</Item>
163+
<Item Name="Ens.Enterprise.MsgBankOperation" Category="" ClassName="Ens.Enterprise.MsgBankOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="Health Connect Cloud Message Bank" LogTraceEvents="false" Schedule="">
164+
<Setting Target="Adapter" Name="IPAddress">bank</Setting>
165+
</Item>
166+
<Item Name="FeatureA Service" Category="" ClassName="EnsLib.HL7.Service.FTPService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
167+
</Item>
168+
<Item Name="FeatureA Process" Category="" ClassName="EnsLib.HL7.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
169+
<Setting Target="Host" Name="BusinessRuleName">HCC.Connect.FeatureAProcessRoutingRule</Setting>
170+
</Item>
171+
<Item Name="FeatureA Operation" Category="" ClassName="EnsLib.HL7.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
172+
</Item>
173+
<Item Name="FeatureB" Category="" ClassName="EnsLib.HL7.Service.TCPService" PoolSize="1" Enabled="false" Foreground="false" Comment="Comment" LogTraceEvents="false" Schedule="">
174+
</Item>
175+
<Item Name="FeatureBProcess" Category="" ClassName="EnsLib.HL7.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
176+
<Setting Target="Host" Name="BusinessRuleName">HCC.Connect.FeatureBProcessRoutingRule</Setting>
177+
</Item>
178+
<Item Name="FeatureB Operation" Category="" ClassName="EnsLib.HL7.Operation.FileOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="Comment 12" LogTraceEvents="false" Schedule="">
179+
</Item>
180+
<Item Name="FeatureC Operation" Category="" ClassName="EnsLib.HL7.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
181+
<Setting Target="Adapter" Name="IPAddress">127.0.0.1</Setting>
182+
<Setting Target="Adapter" Name="Port">8080</Setting>
183+
</Item>
184+
<Item Name="FeatureG" Category="" ClassName="EnsLib.HL7.Service.TCPService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
185+
</Item>
186+
<Item Name="FeatureD" Category="" ClassName="EnsLib.FTP.PassthroughService" PoolSize="1" Enabled="false" Foreground="false" Comment="." LogTraceEvents="false" Schedule="">
187+
</Item>
188+
<Item Name="FeatureE" Category="" ClassName="EnsLib.EDI.X12.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
189+
<Setting Target="Adapter" Name="IPAddress">1.4.3.5</Setting>
190+
</Item>
191+
<Item Name="FeatureH" Category="" ClassName="Ens.Activity.Operation.REST" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
192+
<Setting Target="Adapter" Name="HTTPPort">12345</Setting>
193+
<Setting Target="Adapter" Name="HTTPServer">localhost</Setting>
194+
</Item>
195+
<Item Name="Baz" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
196+
</Item>
197+
<<<<<<< src/HCC/Connect/Production.cls
198+
<Item Name="Bar" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
199+
</Item>
200+
<Item Name="PreReleaseSample1" Category="" ClassName="EnsLib.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
201+
<Setting Target="Host" Name="BusinessRuleName">HCC.Foo.PrereleaseSample1</Setting>
202+
=======
203+
<Item Name="Qux" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
204+
</Item>
205+
<Item Name="PrereleaseTesting2" Category="" ClassName="EnsLib.HL7.Service.FileService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
206+
<Setting Target="Adapter" Name="AlertOnError">1</Setting>
207+
>>>>>>> src/HCC/Connect/Production.cls
208+
</Item>
209+
</Production>
210+
}
211+
212+
}
213+
}
214+
215+
XData ResolvedFile2 [ MimeType = text/plain ]
216+
{
217+
Class HCC.Connect.Production Extends Ens.Production
218+
{
219+
220+
XData ProductionDefinition
221+
{
222+
<Production Name="HCC.Connect.Production" LogGeneralTraceEvents="false">
223+
<Description>Health Connect Cloud Base Production</Description>
224+
<ActorPoolSize>1</ActorPoolSize>
225+
<Item Name="Ens.Activity.Operation.Local" Category="" ClassName="Ens.Activity.Operation.Local" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
226+
</Item>
227+
<Item Name="Ens.Enterprise.MsgBankOperation" Category="" ClassName="Ens.Enterprise.MsgBankOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="Health Connect Cloud Message Bank" LogTraceEvents="false" Schedule="">
228+
<Setting Target="Adapter" Name="IPAddress">bank</Setting>
229+
</Item>
230+
<Item Name="FeatureA Service" Category="" ClassName="EnsLib.HL7.Service.FTPService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
231+
</Item>
232+
<Item Name="FeatureA Process" Category="" ClassName="EnsLib.HL7.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
233+
<Setting Target="Host" Name="BusinessRuleName">HCC.Connect.FeatureAProcessRoutingRule</Setting>
234+
</Item>
235+
<Item Name="FeatureA Operation" Category="" ClassName="EnsLib.HL7.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
236+
</Item>
237+
<Item Name="FeatureB" Category="" ClassName="EnsLib.HL7.Service.TCPService" PoolSize="1" Enabled="false" Foreground="false" Comment="Comment" LogTraceEvents="false" Schedule="">
238+
</Item>
239+
<Item Name="FeatureBProcess" Category="" ClassName="EnsLib.HL7.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
240+
<Setting Target="Host" Name="BusinessRuleName">HCC.Connect.FeatureBProcessRoutingRule</Setting>
241+
</Item>
242+
<Item Name="FeatureB Operation" Category="" ClassName="EnsLib.HL7.Operation.FileOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="Comment 12" LogTraceEvents="false" Schedule="">
243+
</Item>
244+
<Item Name="FeatureC Operation" Category="" ClassName="EnsLib.HL7.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
245+
<Setting Target="Adapter" Name="IPAddress">127.0.0.1</Setting>
246+
<Setting Target="Adapter" Name="Port">8080</Setting>
247+
</Item>
248+
<Item Name="FeatureG" Category="" ClassName="EnsLib.HL7.Service.TCPService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
249+
</Item>
250+
<Item Name="FeatureD" Category="" ClassName="EnsLib.FTP.PassthroughService" PoolSize="1" Enabled="false" Foreground="false" Comment="." LogTraceEvents="false" Schedule="">
251+
</Item>
252+
<Item Name="FeatureE" Category="" ClassName="EnsLib.EDI.X12.Operation.TCPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
253+
<Setting Target="Adapter" Name="IPAddress">1.4.3.5</Setting>
254+
</Item>
255+
<Item Name="FeatureH" Category="" ClassName="Ens.Activity.Operation.REST" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
256+
<Setting Target="Adapter" Name="HTTPPort">12345</Setting>
257+
<Setting Target="Adapter" Name="HTTPServer">localhost</Setting>
258+
</Item>
259+
<Item Name="Baz" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
260+
</Item>
261+
<Item Name="Bar" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
262+
</Item>
263+
<Item Name="PreReleaseSample1" Category="" ClassName="EnsLib.MsgRouter.RoutingEngine" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
264+
<Setting Target="Host" Name="BusinessRuleName">HCC.Foo.PrereleaseSample1</Setting>
265+
</Item>
266+
<Item Name="Qux" Category="" ClassName="EnsLib.DICOM.Duplex.TCP" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
267+
</Item>
268+
<Item Name="PrereleaseTesting2" Category="" ClassName="EnsLib.HL7.Service.FileService" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
269+
<Setting Target="Adapter" Name="AlertOnError">1</Setting>
270+
</Item>
271+
</Production>
272+
}
273+
274+
}
275+
}
276+
141277
}

0 commit comments

Comments
 (0)