[DEVELOPMENT ENVIRONMENT]
* NEW: Show FPatch modal * NEW: FMakePatch: Use Activate() events to go to next Wizard step * BUG: FPatch: Fix SidePanel collapse * BUG: FPatch: Enlarge buttons * BUG: Patch: Ignore more generated files (now necessary without CleanUp()). Use temporary file to not pollute the diff command with them * BUG: Mark a string translatable * OPT: Patch: Use "tar" other options instead of --transform git-svn-id: svn://localhost/gambas/trunk@5522 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
3bdc61c9f5
commit
3ee9d91054
4 changed files with 37 additions and 18 deletions
|
@ -2211,6 +2211,6 @@ End
|
||||||
|
|
||||||
Public Sub mnuPatchProject_Click()
|
Public Sub mnuPatchProject_Click()
|
||||||
|
|
||||||
FPatch.Show()
|
FPatch.ShowModal()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
|
@ -23,11 +23,10 @@ Public Sub wizMakePatch_BeforeChange()
|
||||||
If wizMakePatch.Index = 0 Then
|
If wizMakePatch.Index = 0 Then
|
||||||
sOld = dchOld.FileView.Dir &/ dchOld.FileView.Current
|
sOld = dchOld.FileView.Dir &/ dchOld.FileView.Current
|
||||||
If Not Exist(sOld) Then
|
If Not Exist(sOld) Then
|
||||||
Message.Error(("You must select an old version."))
|
Message.Warning(("You must select an old version."))
|
||||||
Stop Event
|
Stop Event
|
||||||
Endif
|
Else If IsDir(sOld) And If Not Exist(sOld &/ ".project") Then
|
||||||
If IsDir(sOld) And If Not Exist(sOld &/ ".project") Then
|
Message.Warning(("Not a valid Gambas project"))
|
||||||
Message.Error(("Not a valid Gambas project"))
|
|
||||||
Stop Event
|
Stop Event
|
||||||
Endif
|
Endif
|
||||||
Endif
|
Endif
|
||||||
|
@ -43,7 +42,7 @@ Public Sub wizMakePatch_Close()
|
||||||
sPatchFile = fchPatch.Value
|
sPatchFile = fchPatch.Value
|
||||||
Project.Save()
|
Project.Save()
|
||||||
File.Save(sPatchFile, Patch.GenerateForOld(sOldSource))
|
File.Save(sPatchFile, Patch.GenerateForOld(sOldSource))
|
||||||
Message.Info("Patch written.")
|
Message.Info(("Patch written."))
|
||||||
Me.Close()
|
Me.Close()
|
||||||
|
|
||||||
Catch
|
Catch
|
||||||
|
@ -56,3 +55,15 @@ Public Sub wizMakePatch_Cancel()
|
||||||
Me.Close()
|
Me.Close()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub dchOld_Activate()
|
||||||
|
|
||||||
|
Inc wizMakePatch.Index
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub fchPatch_Activate()
|
||||||
|
|
||||||
|
wizMakePatch_Close()
|
||||||
|
|
||||||
|
End
|
|
@ -13,30 +13,30 @@
|
||||||
Spacing = True
|
Spacing = True
|
||||||
Margin = True
|
Margin = True
|
||||||
{ HBox1 HBox
|
{ HBox1 HBox
|
||||||
MoveScaled(4,1,27,3)
|
MoveScaled(4,1,27,4)
|
||||||
{ btnEnqPatch Button
|
{ btnEnqPatch Button
|
||||||
MoveScaled(0,0,20,3)
|
MoveScaled(0,0,20,4)
|
||||||
Expand = True
|
Expand = True
|
||||||
Text = ("Enqueue patch...")
|
Text = ("Enqueue patch...")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ gvwHunks GridView
|
{ gvwHunks GridView
|
||||||
MoveScaled(1,5,58,23)
|
MoveScaled(1,6,58,23)
|
||||||
Font = Font["Monospace"]
|
Font = Font["Monospace"]
|
||||||
Expand = True
|
Expand = True
|
||||||
Mode = Select.Single
|
Mode = Select.Single
|
||||||
Grid = False
|
Grid = False
|
||||||
}
|
}
|
||||||
{ HBox2 HBox
|
{ HBox2 HBox
|
||||||
MoveScaled(4,30,49,3)
|
MoveScaled(4,30,49,4)
|
||||||
Spacing = True
|
Spacing = True
|
||||||
{ btnApply Button
|
{ btnApply Button
|
||||||
MoveScaled(0,0,11,3)
|
MoveScaled(0,0,11,4)
|
||||||
Expand = True
|
Expand = True
|
||||||
Text = ("Apply")
|
Text = ("Apply")
|
||||||
}
|
}
|
||||||
{ btnRevert Button
|
{ btnRevert Button
|
||||||
MoveScaled(12,0,12,3)
|
MoveScaled(12,0,12,4)
|
||||||
Expand = True
|
Expand = True
|
||||||
Text = ("Revert")
|
Text = ("Revert")
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,7 @@
|
||||||
}
|
}
|
||||||
{ SidePanel1 SidePanel
|
{ SidePanel1 SidePanel
|
||||||
MoveScaled(1,37,58,26)
|
MoveScaled(1,37,58,26)
|
||||||
Expand = True
|
Arrangement = Arrange.Fill
|
||||||
Arrangement = Arrange.Vertical
|
|
||||||
Orientation = Align.Bottom
|
Orientation = Align.Bottom
|
||||||
{ edtPatch Editor
|
{ edtPatch Editor
|
||||||
MoveScaled(1,0,18,15)
|
MoveScaled(1,0,18,15)
|
||||||
|
|
|
@ -16,6 +16,14 @@ End Struct
|
||||||
Property Read Count As Integer
|
Property Read Count As Integer
|
||||||
|
|
||||||
Private $hHunks As Hunk[]
|
Private $hHunks As Hunk[]
|
||||||
|
Static Private $sIgnoreFile As String
|
||||||
|
|
||||||
|
Static Public Sub _init()
|
||||||
|
|
||||||
|
$sIgnoreFile = "/tmp/gambas-patch-ignore" ' Prevent UID/PID leakage
|
||||||
|
File.Save($sIgnoreFile, [".settings", ".action", ".info", ".list", ".startup"].Join("\n"))
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
Static Private Function PrepareOldSource(sOldSource As String) As String
|
Static Private Function PrepareOldSource(sOldSource As String) As String
|
||||||
|
|
||||||
|
@ -42,7 +50,8 @@ Static Private Function PrepareOldSource(sOldSource As String) As String
|
||||||
Error.Raise(("Unsupported source file type"))
|
Error.Raise(("Unsupported source file type"))
|
||||||
Return Null
|
Return Null
|
||||||
Endif
|
Endif
|
||||||
Shell Subst$("tar -&1xPf &2 --xform='s_^[^/]\\+_&3_'", sType, Shell$(sOldSource), sOld) Wait
|
Mkdir sOld
|
||||||
|
Shell Subst$("tar -&1xf &2 -C &3 --strip-components=1", sType, Shell$(sOldSource), sOld) Wait
|
||||||
Try Kill sOldArchive
|
Try Kill sOldArchive
|
||||||
Return sOld
|
Return sOld
|
||||||
|
|
||||||
|
@ -54,7 +63,8 @@ Static Private Function PrepareNewSource() As String
|
||||||
Dim sNewArchive As String = Temp$("source-archive") & ".tar.gz"
|
Dim sNewArchive As String = Temp$("source-archive") & ".tar.gz"
|
||||||
|
|
||||||
Project.MakeSourcePackageTo(sNewArchive)
|
Project.MakeSourcePackageTo(sNewArchive)
|
||||||
Shell Subst$("tar -zxPf &1 --xform='s_^[^/]\\+_&2_'", sNewArchive, sNew) Wait
|
Mkdir sNew
|
||||||
|
Shell Subst$("tar -zxf &1 -C &2 --strip-components=1", sNewArchive, sNew) Wait
|
||||||
Try Kill sNewArchive
|
Try Kill sNewArchive
|
||||||
Return sNew
|
Return sNew
|
||||||
|
|
||||||
|
@ -65,7 +75,6 @@ Static Public Function GenerateForOld(sOldSource As String) As String
|
||||||
|
|
||||||
Dim sOld As String
|
Dim sOld As String
|
||||||
Dim sNew As String
|
Dim sNew As String
|
||||||
Dim sIgnore As String = "-x .settings"
|
|
||||||
Dim sCmd As String
|
Dim sCmd As String
|
||||||
Dim sPatch As String
|
Dim sPatch As String
|
||||||
|
|
||||||
|
@ -73,7 +82,7 @@ Static Public Function GenerateForOld(sOldSource As String) As String
|
||||||
sNew = PrepareNewSource()
|
sNew = PrepareNewSource()
|
||||||
|
|
||||||
sCmd = Subst$("cd &1; ", File.Dir(sOld))
|
sCmd = Subst$("cd &1; ", File.Dir(sOld))
|
||||||
sCmd &= Subst$("diff -urNa &1 &2 &3", sIgnore, File.Name(sOld), File.Name(sNew))
|
sCmd &= Subst$("diff -urNaX &1 &2 &3", $sIgnoreFile, File.Name(sOld), File.Name(sNew))
|
||||||
Shell sCmd To sPatch
|
Shell sCmd To sPatch
|
||||||
Shell Subst$("rm -r &1 &2", sOld, sNew)
|
Shell Subst$("rm -r &1 &2", sOld, sNew)
|
||||||
Return sPatch
|
Return sPatch
|
||||||
|
|
Loading…
Reference in a new issue