From 3ee9d910549553c0409f2fc92e29beb6e2196e73 Mon Sep 17 00:00:00 2001 From: Tobias Boege Date: Sun, 27 Jan 2013 16:45:40 +0000 Subject: [PATCH] [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 --- app/src/gambas3/.src/FMain.class | 2 +- .../.src/Project/Patch/FMakePatch.class | 21 ++++++++++++++----- .../gambas3/.src/Project/Patch/FPatch.form | 15 +++++++------ .../gambas3/.src/Project/Patch/Patch.class | 17 +++++++++++---- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/app/src/gambas3/.src/FMain.class b/app/src/gambas3/.src/FMain.class index 906f0ae97..30284e440 100644 --- a/app/src/gambas3/.src/FMain.class +++ b/app/src/gambas3/.src/FMain.class @@ -2211,6 +2211,6 @@ End Public Sub mnuPatchProject_Click() - FPatch.Show() + FPatch.ShowModal() End diff --git a/app/src/gambas3/.src/Project/Patch/FMakePatch.class b/app/src/gambas3/.src/Project/Patch/FMakePatch.class index ccdb34867..3201b4e09 100644 --- a/app/src/gambas3/.src/Project/Patch/FMakePatch.class +++ b/app/src/gambas3/.src/Project/Patch/FMakePatch.class @@ -23,11 +23,10 @@ Public Sub wizMakePatch_BeforeChange() If wizMakePatch.Index = 0 Then sOld = dchOld.FileView.Dir &/ dchOld.FileView.Current If Not Exist(sOld) Then - Message.Error(("You must select an old version.")) + Message.Warning(("You must select an old version.")) Stop Event - Endif - If IsDir(sOld) And If Not Exist(sOld &/ ".project") Then - Message.Error(("Not a valid Gambas project")) + Else If IsDir(sOld) And If Not Exist(sOld &/ ".project") Then + Message.Warning(("Not a valid Gambas project")) Stop Event Endif Endif @@ -43,7 +42,7 @@ Public Sub wizMakePatch_Close() sPatchFile = fchPatch.Value Project.Save() File.Save(sPatchFile, Patch.GenerateForOld(sOldSource)) - Message.Info("Patch written.") + Message.Info(("Patch written.")) Me.Close() Catch @@ -56,3 +55,15 @@ Public Sub wizMakePatch_Cancel() Me.Close() End + +Public Sub dchOld_Activate() + + Inc wizMakePatch.Index + +End + +Public Sub fchPatch_Activate() + + wizMakePatch_Close() + +End \ No newline at end of file diff --git a/app/src/gambas3/.src/Project/Patch/FPatch.form b/app/src/gambas3/.src/Project/Patch/FPatch.form index c2424417c..0a1298218 100644 --- a/app/src/gambas3/.src/Project/Patch/FPatch.form +++ b/app/src/gambas3/.src/Project/Patch/FPatch.form @@ -13,30 +13,30 @@ Spacing = True Margin = True { HBox1 HBox - MoveScaled(4,1,27,3) + MoveScaled(4,1,27,4) { btnEnqPatch Button - MoveScaled(0,0,20,3) + MoveScaled(0,0,20,4) Expand = True Text = ("Enqueue patch...") } } { gvwHunks GridView - MoveScaled(1,5,58,23) + MoveScaled(1,6,58,23) Font = Font["Monospace"] Expand = True Mode = Select.Single Grid = False } { HBox2 HBox - MoveScaled(4,30,49,3) + MoveScaled(4,30,49,4) Spacing = True { btnApply Button - MoveScaled(0,0,11,3) + MoveScaled(0,0,11,4) Expand = True Text = ("Apply") } { btnRevert Button - MoveScaled(12,0,12,3) + MoveScaled(12,0,12,4) Expand = True Text = ("Revert") } @@ -44,8 +44,7 @@ } { SidePanel1 SidePanel MoveScaled(1,37,58,26) - Expand = True - Arrangement = Arrange.Vertical + Arrangement = Arrange.Fill Orientation = Align.Bottom { edtPatch Editor MoveScaled(1,0,18,15) diff --git a/app/src/gambas3/.src/Project/Patch/Patch.class b/app/src/gambas3/.src/Project/Patch/Patch.class index ed04a9ec6..162d894ff 100644 --- a/app/src/gambas3/.src/Project/Patch/Patch.class +++ b/app/src/gambas3/.src/Project/Patch/Patch.class @@ -16,6 +16,14 @@ End Struct Property Read Count As Integer 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 @@ -42,7 +50,8 @@ Static Private Function PrepareOldSource(sOldSource As String) As String Error.Raise(("Unsupported source file type")) Return Null 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 Return sOld @@ -54,7 +63,8 @@ Static Private Function PrepareNewSource() As String Dim sNewArchive As String = Temp$("source-archive") & ".tar.gz" 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 Return sNew @@ -65,7 +75,6 @@ Static Public Function GenerateForOld(sOldSource As String) As String Dim sOld As String Dim sNew As String - Dim sIgnore As String = "-x .settings" Dim sCmd As String Dim sPatch As String @@ -73,7 +82,7 @@ Static Public Function GenerateForOld(sOldSource As String) As String sNew = PrepareNewSource() 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 Subst$("rm -r &1 &2", sOld, sNew) Return sPatch