Version control: Projects can be put under version control. A new Git repository is created for the project if no parent Git repository is found.
[DEVELOPMENT ENVIRONMENT] * NEW: Version control: Projects can be put under version control. A new Git repository is created for the project if no parent Git repository is found. * BUG: Editor: The message label now moves if the editor is resized.
This commit is contained in:
parent
d583aa9480
commit
0026917f12
@ -14,6 +14,10 @@ Private $hLabelTimer As Timer
|
|||||||
Private $hObserver As Observer
|
Private $hObserver As Observer
|
||||||
Private $iLastLine As Integer = -1
|
Private $iLastLine As Integer = -1
|
||||||
|
|
||||||
|
Private $bLabelBottom As Boolean
|
||||||
|
Private $iLabelX As Integer
|
||||||
|
Private $iLabelY As Integer
|
||||||
|
|
||||||
Static Private $sFindPrefix As String
|
Static Private $sFindPrefix As String
|
||||||
Static Private $aFind As Integer[]
|
Static Private $aFind As Integer[]
|
||||||
|
|
||||||
@ -205,6 +209,30 @@ Public Sub Label_MouseDown()
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Private Sub MoveMessageLabel()
|
||||||
|
|
||||||
|
Dim X As Integer
|
||||||
|
Dim Y As Integer
|
||||||
|
|
||||||
|
If Not $hLabel Then Return
|
||||||
|
If Not $hLabel.Visible Then Return
|
||||||
|
|
||||||
|
If $bLabelBottom Then
|
||||||
|
X = 0
|
||||||
|
Y = Container(Me.Proxy).ClientH - $hLabel.H
|
||||||
|
Else
|
||||||
|
X = $iLabelX
|
||||||
|
Y = $iLabelY
|
||||||
|
Endif
|
||||||
|
|
||||||
|
X = Me.ScreenX + X - $hLabel.Parent.ScreenX
|
||||||
|
Y = Me.ScreenY + Y - $hLabel.Parent.ScreenY
|
||||||
|
|
||||||
|
If (Y + $hLabel.H) > $hLabel.Parent.ClientH Then Y -= $hLabel.H + Me.LineHeight
|
||||||
|
$hLabel.Move(X, Y)
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
Public Sub ShowMessageLabel(sStr As String, Optional X As Integer, Y As Integer, iStyle As Integer)
|
Public Sub ShowMessageLabel(sStr As String, Optional X As Integer, Y As Integer, iStyle As Integer)
|
||||||
|
|
||||||
@ -231,19 +259,19 @@ Public Sub ShowMessageLabel(sStr As String, Optional X As Integer, Y As Integer,
|
|||||||
$hLabel.Background = Color.Merge(Me.Styles[iStyle].Color, Style.BackgroundOf(Me), 0.3)
|
$hLabel.Background = Color.Merge(Me.Styles[iStyle].Color, Style.BackgroundOf(Me), 0.3)
|
||||||
$hLabel.Text = " " & Replace(Replace(sStr, "<p>", " "), "<br>", " ") & " "
|
$hLabel.Text = " " & Replace(Replace(sStr, "<p>", " "), "<br>", " ") & " "
|
||||||
|
|
||||||
If IsMissing(X) Then X = 0
|
If IsMissing(X) And If IsMissing(Y) Then
|
||||||
If IsMissing(Y) Then Y = Container(Me.Proxy).ClientH - $hLabel.H
|
$bLabelBottom = True
|
||||||
|
Else
|
||||||
X = Me.ScreenX + X - $hLabel.Parent.ScreenX
|
$bLabelBottom = False
|
||||||
Y = Me.ScreenY + Y - $hLabel.Parent.ScreenY
|
$iLabelX = X
|
||||||
|
$iLabelY = Y
|
||||||
If (Y + $hLabel.H) > $hLabel.Parent.ClientH Then Y -= $hLabel.H + Me.LineHeight
|
Endif
|
||||||
$hLabel.Move(X, Y)
|
|
||||||
|
|
||||||
$hLabel.Show
|
$hLabel.Show
|
||||||
$hLabel.Raise
|
$hLabel.Raise
|
||||||
$hLabelTimer.Stop
|
MoveMessageLabel
|
||||||
$hLabelTimer.Start
|
|
||||||
|
$hLabelTimer.Restart
|
||||||
Me.SetFocus
|
Me.SetFocus
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -312,3 +340,9 @@ Public Sub FindStrings(sPrefix As String) As Integer[]
|
|||||||
Return $aFind
|
Return $aFind
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub Editor_Arrange()
|
||||||
|
|
||||||
|
MoveMessageLabel
|
||||||
|
|
||||||
|
End
|
||||||
|
@ -1291,6 +1291,7 @@ Public Sub OnProjectChange()
|
|||||||
'Action["breakerr"].Value = Project.BreakOnError
|
'Action["breakerr"].Value = Project.BreakOnError
|
||||||
OnRefreshComponents
|
OnRefreshComponents
|
||||||
UpdateRunButton
|
UpdateRunButton
|
||||||
|
|
||||||
'UpdateTranslate
|
'UpdateTranslate
|
||||||
'RefreshInfo
|
'RefreshInfo
|
||||||
'IF $bHidden THEN HideAll
|
'IF $bHidden THEN HideAll
|
||||||
@ -2837,15 +2838,18 @@ End
|
|||||||
|
|
||||||
Public Sub OnVersionControlChange()
|
Public Sub OnVersionControlChange()
|
||||||
|
|
||||||
If Not VersionControl.Enabled Then
|
Action["version-control"].Visible = VersionControl.Enabled
|
||||||
mnuVersionControl.Hide
|
|
||||||
Else
|
If VersionControl.Enabled Then
|
||||||
mnuVersionControl.Show
|
|
||||||
mnuVersionControl.Text = ("Version control") & " (" & VersionControl.Name & ")"
|
mnuVersionControl.Text = ("Version control") & " (" & VersionControl.Name & ")"
|
||||||
btnVersionControl.Text = VersionControl.Name
|
btnVersionControl.Text = VersionControl.Name
|
||||||
UpdateBranchMenu
|
UpdateBranchMenu
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
mnuVersionControlWith.Children.Clear
|
||||||
|
VersionControl.InitControlProjectMenu(mnuVersionControlWith)
|
||||||
|
mnuVersionControlWith.Visible = mnuVersionControlWith.Children.Count
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub mnuVcBranchSet_Click()
|
Public Sub mnuVcBranchSet_Click()
|
||||||
|
@ -178,8 +178,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ mnuVersionControl Menu
|
{ mnuVersionControl Menu
|
||||||
|
Action = "version-control"
|
||||||
Text = ("Version control")
|
Text = ("Version control")
|
||||||
Picture = Picture["icon:/small/calendar"]
|
Picture = Picture["icon:/small/record"]
|
||||||
{ mnuVcCommit Menu
|
{ mnuVcCommit Menu
|
||||||
Action = "vc-commit"
|
Action = "vc-commit"
|
||||||
Text = ("Commit") & "..."
|
Text = ("Commit") & "..."
|
||||||
@ -205,6 +206,10 @@
|
|||||||
Text = ("Branch")
|
Text = ("Branch")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{ mnuVersionControlWith Menu
|
||||||
|
Text = ("Put under version control")
|
||||||
|
Picture = Picture["icon:/small/record"]
|
||||||
|
}
|
||||||
{ mnuPublish Menu
|
{ mnuPublish Menu
|
||||||
Action = "publish"
|
Action = "publish"
|
||||||
Text = ("Publish") & "..."
|
Text = ("Publish") & "..."
|
||||||
@ -1199,7 +1204,7 @@
|
|||||||
Border = False
|
Border = False
|
||||||
}
|
}
|
||||||
{ timSearchProject #Timer
|
{ timSearchProject #Timer
|
||||||
#MoveScaled(21,8)
|
#MoveScaled(21,9)
|
||||||
Delay = 500
|
Delay = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1704,6 +1709,7 @@
|
|||||||
}
|
}
|
||||||
{ Action version-control
|
{ Action version-control
|
||||||
Text = "Version control"
|
Text = "Version control"
|
||||||
|
Shortcut = ""
|
||||||
Picture = "icon:/small/record"
|
Picture = "icon:/small/record"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
Create Static
|
Create Static
|
||||||
|
|
||||||
Public Const Name As String = ""
|
Public Const Name As String = ""
|
||||||
|
Public Const LongName As String = ""
|
||||||
Public Const DoNotPush As Boolean = False
|
Public Const DoNotPush As Boolean = False
|
||||||
|
|
||||||
Public Sub AddFile((sPath) As String, Optional (bForce) As Boolean)
|
Public Sub AddFile((sPath) As String, Optional (bForce) As Boolean)
|
||||||
@ -88,3 +89,11 @@ End
|
|||||||
Public Sub SetBranch((sBranch) As String)
|
Public Sub SetBranch((sBranch) As String)
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub CanControlProject() As Boolean
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub ControlProject() As Boolean
|
||||||
|
|
||||||
|
End
|
||||||
|
@ -4,6 +4,7 @@ Inherits CVersionControl
|
|||||||
Create Static
|
Create Static
|
||||||
|
|
||||||
Public Const Name As String = "Git"
|
Public Const Name As String = "Git"
|
||||||
|
Public Const LongName As String = "Git"
|
||||||
Public Const DoNotPush As Boolean = True
|
Public Const DoNotPush As Boolean = True
|
||||||
|
|
||||||
Private $aConflict As String[] = ["DD", "AU", "UD", "UA", "DU", "AA", "UU"]
|
Private $aConflict As String[] = ["DD", "AU", "UD", "UA", "DU", "AA", "UU"]
|
||||||
@ -11,22 +12,45 @@ Private $aConflict As String[] = ["DD", "AU", "UD", "UA", "DU", "AA", "UU"]
|
|||||||
Private $bHasGit As Boolean
|
Private $bHasGit As Boolean
|
||||||
Private $bCheckGit As Boolean
|
Private $bCheckGit As Boolean
|
||||||
Private $sRoot As String
|
Private $sRoot As String
|
||||||
|
Private $bCanControl As Boolean
|
||||||
|
Private $bCanInit As Boolean
|
||||||
|
|
||||||
|
Private Sub Init()
|
||||||
|
|
||||||
|
If $bCheckGit Then Return
|
||||||
|
|
||||||
|
$bHasGit = System.Exist("git")
|
||||||
|
$bCheckGit = True
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
Public Sub Check() As Boolean
|
Public Sub Check() As Boolean
|
||||||
|
|
||||||
Dim sResult As String
|
Dim sResult As String
|
||||||
|
|
||||||
If Not $bCheckGit Then
|
Init()
|
||||||
$bHasGit = System.Exist("git")
|
|
||||||
$bCheckGit = True
|
|
||||||
Endif
|
|
||||||
|
|
||||||
If $bHasGit Then
|
If $bHasGit Then
|
||||||
sResult = VersionControl.Shell("cd " & Shell$(Project.Dir) & " && git rev-parse --show-toplevel")
|
|
||||||
If Process.LastValue = 0 Then
|
sResult = VersionControl.Shell("cd " & Shell(Project.Dir) & " && git status --porcelain .project")
|
||||||
$sRoot = Trim(sResult)
|
|
||||||
Return True
|
If Process.LastValue Then
|
||||||
|
$bCanInit = True
|
||||||
|
$bCanControl = False
|
||||||
|
Else
|
||||||
|
$bCanInit = False
|
||||||
|
$bCanControl = sResult Begins "??"
|
||||||
|
|
||||||
|
If Not $bCanControl Then
|
||||||
|
sResult = VersionControl.Shell("cd " & Shell$(Project.Dir) & " && git rev-parse --show-toplevel")
|
||||||
|
If Process.LastValue = 0 Then
|
||||||
|
$sRoot = Trim(sResult)
|
||||||
|
Return True
|
||||||
|
Endif
|
||||||
|
Endif
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -205,7 +229,8 @@ Public Sub Commit(sChange As String, bDoNotPush As Boolean) As Boolean
|
|||||||
Dim aEnv As String[]
|
Dim aEnv As String[]
|
||||||
|
|
||||||
File.Save(sFile, sChange)
|
File.Save(sFile, sChange)
|
||||||
VersionControl.Run(["git", "commit", "-F", sFile, Project.Dir], False, False, VersionControl.LANG_ENV)
|
'VersionControl.Run(["git", "commit", "-F", sFile, Project.Dir], False, False, VersionControl.LANG_ENV)
|
||||||
|
VersionControl.Shell("cd " & Shell(Project.Dir) & " && git commit -F " & Shell$(sFile) & " .", Project.Dir)
|
||||||
If Process.LastValue Then Return True
|
If Process.LastValue Then Return True
|
||||||
|
|
||||||
If Not bDoNotPush Then
|
If Not bDoNotPush Then
|
||||||
@ -280,3 +305,28 @@ Public Sub UpdatePath(sPath As String, Optional sPath2 As String)
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub CanControlProject() As Boolean
|
||||||
|
|
||||||
|
Return $bCanControl Or $bCanInit
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub ControlProject() As Boolean
|
||||||
|
|
||||||
|
If Not CanControlProject() Then Return True
|
||||||
|
|
||||||
|
If $bCanInit Then
|
||||||
|
|
||||||
|
If Message.Warning(("A new Git repository will be created for this project."), ("OK"), ("Cancel")) = 2 Then Return
|
||||||
|
|
||||||
|
VersionControl.Shell("cd " & Shell(Project.Dir) & " && git init && git add .")
|
||||||
|
If Process.LastValue Then Return True
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
VersionControl.Shell("cd " & Shell(Project.Dir) & " && git add .")
|
||||||
|
|
||||||
|
Endif
|
||||||
|
|
||||||
|
|
||||||
|
End
|
||||||
|
@ -4,12 +4,14 @@ Inherits CVersionControl
|
|||||||
Create Static
|
Create Static
|
||||||
|
|
||||||
Public Const Name As String = "Svn"
|
Public Const Name As String = "Svn"
|
||||||
|
Public Const LongName As String = "Subversion"
|
||||||
|
|
||||||
Private $sRealDir As String
|
Private $sRealDir As String
|
||||||
Private $bHasSVN As Boolean
|
Private $bHasSVN As Boolean
|
||||||
Private $bCheckSVN As Boolean
|
Private $bCheckSVN As Boolean
|
||||||
Private $sSvnVersion As String
|
Private $sSvnVersion As String
|
||||||
Private $bSvn17 As Boolean
|
Private $bSvn17 As Boolean
|
||||||
|
Private $bCanControl As Boolean
|
||||||
|
|
||||||
Private Sub SvnPath$(sPath As String) As String
|
Private Sub SvnPath$(sPath As String) As String
|
||||||
|
|
||||||
@ -19,18 +21,13 @@ Private Sub SvnPath$(sPath As String) As String
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub Check() As Boolean
|
Private Sub Init()
|
||||||
|
|
||||||
Dim sResult As String
|
If $bCheckSVN Then Return
|
||||||
|
|
||||||
Shell "readlink -f " & Shell$(Project.Dir) To $sRealDir
|
$bHasSVN = System.Exist("svn")
|
||||||
$sRealDir = Trim($sRealDir)
|
$bCheckSVN = True
|
||||||
|
|
||||||
If Not $bCheckSVN Then
|
|
||||||
$bHasSVN = System.Exist("svn")
|
|
||||||
$bCheckSVN = True
|
|
||||||
Endif
|
|
||||||
|
|
||||||
If $bHasSVN Then
|
If $bHasSVN Then
|
||||||
|
|
||||||
If Not $sSvnVersion Then
|
If Not $sSvnVersion Then
|
||||||
@ -38,12 +35,45 @@ Public Sub Check() As Boolean
|
|||||||
$sSvnVersion = Trim($sSvnVersion)
|
$sSvnVersion = Trim($sSvnVersion)
|
||||||
$bSvn17 = Comp($sSvnVersion, "1.7", gb.Natural) >= 0
|
$bSvn17 = Comp($sSvnVersion, "1.7", gb.Natural) >= 0
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
|
Endif
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
|
||||||
|
Public Sub Check() As Boolean
|
||||||
|
|
||||||
|
Dim sResult As String
|
||||||
|
Dim sDir As String
|
||||||
|
|
||||||
|
Shell "readlink -f " & Shell$(Project.Dir) To $sRealDir
|
||||||
|
$sRealDir = Trim($sRealDir)
|
||||||
|
|
||||||
|
Init()
|
||||||
|
|
||||||
|
If $bHasSVN Then
|
||||||
|
|
||||||
|
$bCanControl = False
|
||||||
|
|
||||||
If $bSvn17 Then
|
If $bSvn17 Then
|
||||||
sResult = VersionControl.Shell("svn status " & Shell$(SvnPath$($sRealDir) &/ ".project") & " 2>&1")
|
sResult = VersionControl.Shell("svn status " & Shell$(SvnPath$($sRealDir) &/ ".project") & " 2>&1")
|
||||||
If Process.LastValue = 0 And If sResult Not Like "svn:*W155007*:*" And If sResult Not Like "svn:*W155010*:*" Then Return True
|
If Process.LastValue = 0 And If sResult Not Like "svn:*W155007*:*" And If sResult Not Like "svn:*W155010*:*" Then Return True
|
||||||
Else
|
Else
|
||||||
Return Exist($sRealDir &/ ".svn")
|
If Exist($sRealDir &/ ".svn") Then Return True
|
||||||
|
Endif
|
||||||
|
|
||||||
|
If $bSvn17 Then
|
||||||
|
sDir = $sRealDir
|
||||||
|
Do
|
||||||
|
sDir = File.Dir(sDir)
|
||||||
|
If Exist(sDir &/ ".svn") Then
|
||||||
|
$bCanControl = True
|
||||||
|
Break
|
||||||
|
Endif
|
||||||
|
If sDir = "/" Then Break
|
||||||
|
Loop
|
||||||
|
Else
|
||||||
|
$bCanControl = Exist($sRealDir &/ "../.svn")
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
Endif
|
Endif
|
||||||
@ -330,3 +360,15 @@ Public Sub UpdatePath(sPath As String, Optional sPath2 As String)
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub CanControlProject() As Boolean
|
||||||
|
|
||||||
|
Return $bCanControl
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub ControlProject() As Boolean
|
||||||
|
|
||||||
|
If Not $bCanControl Then Return True
|
||||||
|
If VersionControl.Run(["svn", "add", "--parents", SvnPath$($sRealDir)]) Then Return True
|
||||||
|
|
||||||
|
End
|
||||||
|
@ -1,20 +1,47 @@
|
|||||||
' Gambas class file
|
' Gambas class file
|
||||||
|
|
||||||
Public Sub Run() As Boolean
|
Static Private $sText As String
|
||||||
|
Static Private $sDetail As String
|
||||||
|
|
||||||
Return Not Me.ShowModal()
|
Public Sub Run(sText As String, sDetail As String)
|
||||||
|
|
||||||
|
$sText = sText
|
||||||
|
$sDetail = Trim(sDetail)
|
||||||
|
|
||||||
|
Me.ShowModal()
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub btnOK_Click()
|
Public Sub btnOK_Click()
|
||||||
|
|
||||||
Me.Close(TRUE)
|
|
||||||
|
|
||||||
End
|
|
||||||
|
|
||||||
Public Sub btnCancel_Click()
|
|
||||||
|
|
||||||
Me.Close
|
Me.Close
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub Form_Open()
|
||||||
|
|
||||||
|
Dim DS, W, H As Integer
|
||||||
|
|
||||||
|
lblError.Text = $sText
|
||||||
|
|
||||||
|
If $sDetail Then
|
||||||
|
|
||||||
|
Project.SetEditorFont(lblDetail)
|
||||||
|
lblDetail.Text = $sDetail
|
||||||
|
|
||||||
|
DS = Desktop.Scale
|
||||||
|
lblDetail.Padding = DS
|
||||||
|
With lblDetail.Font
|
||||||
|
W = .TextWidth($sDetail)
|
||||||
|
H = .TextHeight($sDetail)
|
||||||
|
End With
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
lblDetail.Hide
|
||||||
|
|
||||||
|
Endif
|
||||||
|
|
||||||
|
Me.Resize(Max(lblDetail.X + W + DS * 4, 48 * DS), lblDetail.Y + H + DS * 8)
|
||||||
|
|
||||||
|
End
|
||||||
|
@ -1,27 +1,41 @@
|
|||||||
# Gambas Form File 3.0
|
# Gambas Form File 3.0
|
||||||
|
|
||||||
{ FVersionError Form
|
{ Form Form
|
||||||
MoveScaled(0,0,64,64)
|
MoveScaled(0,0,59,64)
|
||||||
Resizable = False
|
Resizable = False
|
||||||
Arrangement = Arrange.Vertical
|
Arrangement = Arrange.Vertical
|
||||||
Spacing = True
|
Spacing = True
|
||||||
Margin = True
|
Margin = True
|
||||||
{ HBox1 HBox
|
{ HBox2 HBox
|
||||||
MoveScaled(1,59,62,4)
|
MoveScaled(1,1,54,8)
|
||||||
Spacing = True
|
Spacing = True
|
||||||
{ Panel1 Panel
|
{ PictureBox1 PictureBox
|
||||||
MoveScaled(4,0,4,4)
|
MoveScaled(0,0,8,8)
|
||||||
|
Picture = Picture["icon:/huge/error"]
|
||||||
|
Stretch = True
|
||||||
|
}
|
||||||
|
{ lblError Label
|
||||||
|
MoveScaled(11,1,37,7)
|
||||||
|
Expand = True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{ lblDetail Label
|
||||||
|
MoveScaled(1,11,54,17)
|
||||||
Expand = True
|
Expand = True
|
||||||
|
Border = Border.Plain
|
||||||
}
|
}
|
||||||
{ btnOK Button
|
{ HBox1 HBox
|
||||||
MoveScaled(29,0,16,4)
|
MoveScaled(1,59,57,4)
|
||||||
Text = ("OK")
|
Spacing = True
|
||||||
Default = True
|
{ Panel1 Panel
|
||||||
}
|
MoveScaled(4,0,4,4)
|
||||||
{ btnCancel Button
|
Expand = True
|
||||||
MoveScaled(46,0,16,4)
|
}
|
||||||
Text = ("Cancel")
|
{ btnOK Button
|
||||||
Cancel = True
|
MoveScaled(40,0,16,4)
|
||||||
|
Text = ("OK")
|
||||||
|
Default = True
|
||||||
|
Cancel = True
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -19,6 +19,8 @@ Private $bAuth As Boolean
|
|||||||
Private $sUser As String
|
Private $sUser As String
|
||||||
Private $sPassword As String
|
Private $sPassword As String
|
||||||
|
|
||||||
|
Private $sLastResult As String
|
||||||
|
|
||||||
'Public (User) As String
|
'Public (User) As String
|
||||||
'Public Password As String
|
'Public Password As String
|
||||||
'Public UseTerminal As Boolean
|
'Public UseTerminal As Boolean
|
||||||
@ -71,7 +73,10 @@ Public Sub Shell(sCmd As String, Optional bSilent As Boolean, Optional aEnv As S
|
|||||||
|
|
||||||
If Not bSilent Then Insert(sCmd & "\n")
|
If Not bSilent Then Insert(sCmd & "\n")
|
||||||
Shell sCmd With aEnv To sResult
|
Shell sCmd With aEnv To sResult
|
||||||
If Process.LastValue Then Insert(sResult)
|
If Process.LastValue Then
|
||||||
|
$sLastResult = sResult
|
||||||
|
Insert(sResult)
|
||||||
|
Endif
|
||||||
Return sResult
|
Return sResult
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -88,6 +93,7 @@ Public Sub Run(aCmd As String[], Optional bIdent As Boolean, Optional bOutput As
|
|||||||
$sOutput = ""
|
$sOutput = ""
|
||||||
$bOutput = bOutput
|
$bOutput = bOutput
|
||||||
$dOutput = Now
|
$dOutput = Now
|
||||||
|
$sLastResult = ""
|
||||||
|
|
||||||
' If bIdent Then
|
' If bIdent Then
|
||||||
' 'aCmd.Add("--non-interactive")
|
' 'aCmd.Add("--non-interactive")
|
||||||
@ -129,6 +135,7 @@ End
|
|||||||
|
|
||||||
Public Sub Process_Error(({Error}) As String)
|
Public Sub Process_Error(({Error}) As String)
|
||||||
|
|
||||||
|
$sLastResult &= {Error}
|
||||||
Insert({Error})
|
Insert({Error})
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -302,7 +309,7 @@ Public Sub Commit(sChange As String, bDoNotPush As Boolean) As Boolean
|
|||||||
Dec Application.Busy
|
Dec Application.Busy
|
||||||
|
|
||||||
If bRes Then
|
If bRes Then
|
||||||
Message.Error(("The project could not be committed."))
|
FVersionError.Run(("The project could not be committed."), $sLastResult)
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
Return bRes
|
Return bRes
|
||||||
@ -320,7 +327,7 @@ Public Sub Update()
|
|||||||
Dec Application.Busy
|
Dec Application.Busy
|
||||||
|
|
||||||
If bErr Then
|
If bErr Then
|
||||||
Message.Error(("Unable to update project from repository."))
|
FVersionError.Run(("Unable to update project from repository."), $sLastResult)
|
||||||
Else
|
Else
|
||||||
Message.Info(("Project has been updated from repository successfully."))
|
Message.Info(("Project has been updated from repository successfully."))
|
||||||
Endif
|
Endif
|
||||||
@ -350,7 +357,7 @@ End
|
|||||||
Public Sub CheckoutSVN(sPath As String, sDir As String, hEditor As TextEditor)
|
Public Sub CheckoutSVN(sPath As String, sDir As String, hEditor As TextEditor)
|
||||||
|
|
||||||
$hEditor = hEditor
|
$hEditor = hEditor
|
||||||
CVersionControlSubversion.checkout(sPath, sDir)
|
CVersionControlSubversion.Checkout(sPath, sDir)
|
||||||
$hEditor = Null
|
$hEditor = Null
|
||||||
|
|
||||||
End
|
End
|
||||||
@ -417,16 +424,42 @@ Public Sub CanControlProject() As Boolean
|
|||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Public Sub ControlProject()
|
Public Sub ControlProject(sType As String)
|
||||||
|
|
||||||
' If CanControlProject() Then
|
Dim hVC As CVersionControl
|
||||||
' Project.CleanUp
|
Dim bErr As Boolean
|
||||||
' Try Kill Project.Dir &/ ".settings"
|
|
||||||
' Run(["svn", "add", "--parents", SvnPath$($sRealDir)])
|
Select Case sType
|
||||||
' Project.Config.Save
|
|
||||||
' Refresh
|
Case CVersionControlSubversion.Name
|
||||||
' Project.Refresh
|
hVC = CVersionControlSubversion
|
||||||
' Endif
|
|
||||||
|
Case CVersionControlGit.Name
|
||||||
|
hVC = CVersionControlGit
|
||||||
|
|
||||||
|
Default
|
||||||
|
Return
|
||||||
|
|
||||||
|
End Select
|
||||||
|
|
||||||
|
If Not hVC.CanControlProject() Then Return
|
||||||
|
|
||||||
|
If Message.Question(Subst(("Do you really want to put this project under version control with &1?"), hVC.LongName), ("Yes"), ("No")) = 2 Then Return
|
||||||
|
|
||||||
|
Project.CleanUp
|
||||||
|
Try Kill Project.Dir &/ ".settings"
|
||||||
|
|
||||||
|
bErr = hVC.ControlProject()
|
||||||
|
|
||||||
|
Project.Config.Save
|
||||||
|
|
||||||
|
If Not bErr Then
|
||||||
|
Refresh
|
||||||
|
Project.Refresh
|
||||||
|
FVersionControl.Run()
|
||||||
|
Else
|
||||||
|
FVersionError.Run(("The project could not be put under version control."), $sLastResult)
|
||||||
|
Endif
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
@ -510,7 +543,36 @@ Public Sub SetBranch(sBranch As String)
|
|||||||
Dec Application.Busy
|
Dec Application.Busy
|
||||||
|
|
||||||
If sCurrent <> sBranch Then
|
If sCurrent <> sBranch Then
|
||||||
Message.Error(Subst(("Unable to switch to branch `&1`."), sBranch))
|
FVersionError.Run(Subst(("Unable to switch to branch `&1`."), sBranch), $sLastResult)
|
||||||
Endif
|
Endif
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Public Sub InitControlProjectMenu(hParent As Menu)
|
||||||
|
|
||||||
|
Dim hMenu As Menu
|
||||||
|
Dim hVC As CVersionControl
|
||||||
|
|
||||||
|
hVC = CVersionControlSubversion
|
||||||
|
GoSub CHECK_CONTROL
|
||||||
|
hVC = CVersionControlGit
|
||||||
|
GoSub CHECK_CONTROL
|
||||||
|
Return
|
||||||
|
|
||||||
|
CHECK_CONTROL:
|
||||||
|
|
||||||
|
If hVC.CanControlProject() Then
|
||||||
|
hMenu = New Menu(hParent) As "ControlProject"
|
||||||
|
hMenu.Text = Subst(("With &1"), hVC.LongName)
|
||||||
|
hMenu.Tag = hVC.Name
|
||||||
|
Endif
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
|
End
|
||||||
|
|
||||||
|
Public Sub ControlProject_Click()
|
||||||
|
|
||||||
|
ControlProject(Last.Tag)
|
||||||
|
|
||||||
|
End
|
||||||
|
Loading…
x
Reference in New Issue
Block a user