-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GP-4085 Improved AutoVersionTrackingScript script to accomodate new
versioned session capability. Added script to enable adding of vt session to version control. Added help for shared project use of VTSession.
- Loading branch information
Showing
6 changed files
with
232 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Ghidra/Features/VersionTracking/ghidra_scripts/AddVTSessionToVersionControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* ### | ||
* IP: GHIDRA | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
//Script that enables user to add an existing Version Tracking Session to version control. This | ||
//is meant to to be used when project is a shared project and when running in headless mode | ||
//since it is simple add a VTSession to version control from the project manager when running in | ||
//GUI mode. | ||
//@category Version Tracking | ||
import ghidra.app.script.GhidraScript; | ||
import ghidra.features.base.values.GhidraValuesMap; | ||
import ghidra.framework.model.DomainFile; | ||
import ghidra.util.MessageType; | ||
|
||
public class AddVTSessionToVersionControl extends GhidraScript { | ||
|
||
@Override | ||
public void run() throws Exception { | ||
|
||
GhidraValuesMap startupValues = new GhidraValuesMap(); | ||
|
||
startupValues.defineProjectFile("Select Version Tracking Session", "/"); | ||
startupValues.defineString("Enter commit message", "Commiting session to version control"); | ||
|
||
startupValues.setValidator((valueMap, status) -> { | ||
|
||
if (!valueMap.hasValue("Select Version Tracking Session")) { | ||
status.setStatusText("Must select a Version Tracking Session!", MessageType.ERROR); | ||
return false; | ||
} | ||
|
||
if (!valueMap.hasValue("Enter commit message")) { | ||
status.setStatusText("Must enter a commit message!", MessageType.ERROR); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
|
||
startupValues = askValues( | ||
"Enter Version Tracking Session info for adding to source control:", "", startupValues); | ||
|
||
DomainFile sessionDF = startupValues.getProjectFile("Select Version Tracking Session"); | ||
String commitMsg = startupValues.getString("Enter commit message"); | ||
|
||
if (sessionDF.isVersioned()) { | ||
println("Chosen session is already in version control"); | ||
return; | ||
} | ||
|
||
// add session to version control and do not keep checkout out | ||
sessionDF.addToVersionControl(commitMsg, false, monitor); | ||
|
||
println(sessionDF.getName() + " was successfully added to version control."); | ||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+932 Bytes
...nTracking/src/main/help/help/topics/VersionTrackingPlugin/images/start-here.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.