├── .gitignore ├── Procs ├── Thor_Proc_GitUtilities.PRG └── Thor_Proc_GitUtilities.h ├── ReadMe.md ├── ThorUpdater ├── GitUtilitiesVersionFile-Beta.txt ├── GitUtilitiesVersionFile.txt ├── GitUtils.zip └── Thor_Update_Git-Utils.prg ├── Thor_Tool_GitUtilities_AddRemoveBetaInCFU.prg ├── Thor_Tool_GitUtilities_PostCheckoutSynch.PRG ├── Thor_Tool_GitUtilities_PrepareForCommit.PRG ├── Thor_Tool_GitUtilities_RestoreProjectTimestamps.prg ├── Thor_Tool_GitUtilities_SaveProjectTimestamps.prg └── Thor_Tool_GitUtilities_ShowReposInProject.prg /.gitignore: -------------------------------------------------------------------------------- 1 | # Files generate by VFP 2 | *.[Bb][Aa][Kk] 3 | *.[Ff][Xx][Pp] 4 | *.[Ss][Cc][TtXx] 5 | *.[Ee][Rr][Rr] 6 | 7 | # Miscellaneous files 8 | # *.[Zz][IiOo][Pp] 9 | -------------------------------------------------------------------------------- /Procs/Thor_Proc_GitUtilities.h: -------------------------------------------------------------------------------- 1 | #DEFINE ccToolName "Git Utilities" 2 | #DEFINE ccEditClassName clsGitUtilitiesOptionsPage 3 | 4 | #DEFINE ccKeyPreserveTimestamps "Preserve file timestamps" 5 | #DEFINE ccOptionClassPreserveTS clsPreserveTimestampsOption 6 | #DEFINE ccInitialValuePreserveTS 2 7 | 8 | #DEFINE ccKeyGitTimestampFileName "Timestamp file name" 9 | #DEFINE ccOptionClassGitTSFileName clsGitTimestampFileNameOption 10 | #DEFINE ccInitialValueGitTSFileName ".gittimestamp" 11 | 12 | #DEFINE ccKeyHgTimestampFileName "Hg Timestamp file name" 13 | #DEFINE ccOptionClassHgTSFileName clsHgTimestampFileNameOption 14 | #DEFINE ccInitialValueHgTSFileName ".hgtimestamp" 15 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | # Git and Hg Utilities # 2 | 3 | This is a set of Thor repository tools for Visual FoxPro developers who are using Git or Mercurial 4 | (Hg) for version control. They are designed as "one-click" tools to quickly synchronize working 5 | folders to the files retrieved from the DVCS, and prepare files to be committed to the DVCS 6 | repositories. 7 | **NOTE:** Mercurial support was added with the 2016-07-23 release. 8 | 9 | Version history is available in the [GitUtilitiesVersionFile.txt][Git-tools-history] file. 10 | 11 | In addition to being able to watch the GitHub and BitBucket repositories for changes to these 12 | utilities, you can also check for notices posted on the [FoxProThor Google group] 13 | [FoxProThor-Google-group]. 14 | 15 | ## Prerequisites ## 16 | 17 | The following items are required to take full advantage of the Git and Mercurial utilities: 18 | 19 | - [Thor][Thor-homepage] - The Thor framework must be loaded as part of the VFP development 20 | environment. 21 | - The Thor Repository (this is a collection of tools, and not to be confused with a Git repository) 22 | - [FoxBin2Prg][FoxBin2Prg-homepage] - The minimum required version is 1.19.42. For best results, 23 | FoxBin2Prg should be installed via Thor's "Check for Updates" feature. If FoxBin2Prg is installed 24 | some other way, the Thor plug-in "Get FoxBin2Prg Folder" can be edited to tell Thor where you have 25 | FoxBin2Prg installed. 26 | - [Git for Windows][Git-Windows-download] (only if Git will be used) - When installing Git for 27 | Windows, at the step entitled **Adjusting your Path environment**, select the second option 28 | "Use Git from the Windows Command Prompt". 29 | **NOTE:** Beginning with the 2.x versions of Git for Windows, there are 32- and 64-bit versions. 30 | You MUST have the 32-bit version of Git for Windows installed in order for these utilities to 31 | work, even on 64-bit Windows, because VFP is a 32-bit app, and is unable to run 64-bit Git from 32 | the command line. If you need the 64-bit version of Git for Windows, it appears that both the 33 | 32-bit and 64-bit versions can be installed on the same PC, but in my testing, the 64-bit install 34 | uninstalled the 32-bit version, so the 32-bit version must be installed LAST. 35 | - [Mercurial for Windows][Mercurial-Windows-download] (only if Mercurial will be used) - When 36 | installing Mercurial for Windows, at the end of the setup select the option to **Add the 37 | installation path to the search path** (this is selected by default). Like Git for Windows, 38 | there are 32-bit and 64-bit versions of Mercurial, but in testing so far, it appears that either 39 | version of Mercurial works fine with these utilities. 40 | - Windows Scripting Host - This is installed as part of Windows, but system administrators will 41 | sometimes disable it on the PCs on their networks. 42 | 43 | ### Getting Started with Git and Mercurial ### 44 | 45 | If you are new to Git, I've created a [setup guide][Git-setup-guide] for getting started with Git. 46 | This guide includes: 47 | 48 | - some basic instructions for installing Git and some useful third-party tools 49 | - some tips on configuring Git and the tools 50 | - information on SSH keys 51 | - a list of resources, including documentation, articles, and links to Git and all the tools 52 | referenced 53 | 54 | If you are new to DVCS in general, are planning to use Mercurial, or are interested in the 55 | differences between Git and Mercurial, several excellent resources are available on Rick Borup's 56 | [Developers Page][Borup-whitepapers]. 57 | 58 | ## Installation ## 59 | 60 | #### Release #### 61 | 62 | The Git and Hg Utilities are included in Thor's **Check for Updates**. When installed, these tools 63 | will appear in the Thor tools menus under `Applications > Git-Hg Utilities`. 64 | 65 | #### Beta #### 66 | 67 | Occasionally I may make new features available via a beta version of Git and Utilities before 68 | releasing them in the regular version. If you would like to try the beta version, first install 69 | the release as described in the previous section. In the Thor tools menus, under 70 | `Applications > Git-Hg Utilities`, there is a menu item called **Add/Remove Git-Hg Beta in Check 71 | for Updates**. Running this tool will prompt you to add a new item to Thor's **Check for Updates** 72 | called _Git and Hg Utilities (Beta)_. To remove the beta from the Check for Updates list, run the 73 | same tool again, and you will be prompted to remove it. 74 | 75 | **NOTE:** The beta version of Git and Hg Utilities completely replaces the release version, so you 76 | cannot have both installed at the same time. However, it is very easy to return to the release 77 | version again by simply running **Check for Updates** and selecting _Git and Hg Utilities_ to 78 | reinstall it. 79 | 80 | ## Tool Options ## 81 | 82 | The options for these tools are found under **Git Utilities** on the Options page of the Thor 83 | Configuration form. For backward-compatibility reasons, the name of the options page did not 84 | change to include Mercurial, but the options themselves include settings for Mercurial. The 85 | same options can also be accessed from the _Options_ link on the tool page of each tool that is 86 | affected by the options. 87 | 88 | ## Description of Tools ## 89 | 90 | ### `Thor_Proc_GitUtilities.PRG` ### 91 | This is the main program file, which defines the Git and Hg utilities class that contains all the 92 | features used by the other tools in this collection. If you want to access the features of this 93 | class directly, you can do so using the following command: 94 | 95 | ``` 96 | loGitUtils = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 97 | ``` 98 | 99 | The code contains documentation for all of the properties, methods, parameters, and return values. 100 | 101 | ### `Thor_Tool_GitUtilities_PrepareForCommit.PRG` ### 102 | This tool appears under the Git-Hg Utilities menu as **Prepare for Git-Hg commit**. It operates 103 | on either an entire VFP project, or an individual Git or Mercurial repository folder. It performs 104 | several operations to prepare VFP files to be committed to their respective repositories. 105 | 106 | - When a VFP project (.PJX) is selected for processing, a text version of the project file itself 107 | is generated, regardless of whether that project file is being tracked in any way. 108 | - *(New - 2016-07-23)* For any .PJX files found in any of the repositories being processed, if 109 | there is a corresponding text version of that project file which is being tracked by the 110 | repository, the text file for the .PJX file will be regenerated. 111 | - *(New - 2016-12-09)* Only the text files that correspond to the VFP binary files are required 112 | to be stored in a repository. Keeping the VFP binary files in a repository is optional, and 113 | you may keep a mix within the same repository - storing the binary files for some files, and 114 | only the text files for others. 115 | - In the *Git Utilities* options, if you have specified that timestamp files are to be generated, 116 | then the timestamp file for each repository being processed will be updated for all of the 117 | files currently tracked in the repository. 118 | **NOTE:** Untracked files (those that are new and not added) are ignored. For new files which 119 | have not been committed to the repository yet, timestamps are only saved for the new files that 120 | have been *added* in Git or Mercurial. 121 | 122 | ##### When VFP binaries are tracked in the repository: ##### 123 | - A text file is generated for each VFP binary file which has been modified since the last commit. 124 | The FoxBin2Prg configuration settings determine which binary files have text files generated 125 | for them, and how the file is generated. 126 | **NOTE:** Untracked files (those that are new and have not been added to the repository yet) 127 | are ignored. For new binary files which have not been committed to the repository yet, a text 128 | file is only generated if the primary binary file (VCX, SCX, MNX, FRX, LBX, DBF, DBC) is 129 | *added* in Git or Mercurial. 130 | - For any binary file that has changed because VFP generated new object code, but the source code 131 | has *not* changed (the text file is still the same), the changes to the binary file will be 132 | reverted. 133 | **NOTE:** When this tool reverts binary files that haven't really changed, Git or Mercurial is 134 | used to replace those files. That means that any databases, tables, or classes which are being 135 | reverted need to be closed/released before running this utility. Files that are still open can 136 | cause this utility to "hang", preventing the process from completing. 137 | - *(New - 2015-10-12)* If the primary binary file (VCX, SCX, MNX, FRX, LBX, DBF, DBC) is *added* 138 | in Git or Mercurial, but the secondary file(s) (VCT, SCT, etc.) and/or the text file are still 139 | untracked (haven't been added to the repository yet), then those untracked files will be added 140 | to the repository automatically. This causes those files to be prepared for commit, and 141 | timestamps will be saved for them if you are using that option. 142 | 143 | ##### When only the text files are being tracked in the repository: ##### 144 | - For each text file being tracked, the tool will check if the corresponding VFP binary files 145 | exist, and whether the text file needs to be regenerated. If the Windows modification date 146 | and time of the VFP binaries does not match the date/time of the text file, the text file 147 | will be regenerated. 148 | - After regenerating a text file, the tool makes sure the modification date/time of the VFP 149 | binary files is set to match the text file's date/time. 150 | - **NOTE:** When a new VFP binary file is created, FoxBin2Prg will need to be called 151 | manually to create the text file for the first time, and the text file will need to be 152 | added to the repository. After that, this tool will take care of keeping the text file 153 | updated. 154 | 155 | ### `Thor_Tool_GitUtilities_PostCheckoutSynch.PRG` ### 156 | This tool appears under the Git-Hg Utilities menu as **Post-checkout/update file synchronization**. 157 | It operates on either an entire VFP project (all the repositories in that project), or an individual 158 | Git or Mercurial repository folder. It performs several operations to synchronize binary files 159 | and object code to the files tracked in a Git or Mercurial repository. This tool should be run 160 | after any Git or Mercurial operation that makes changes to VFP files in the working folders. In 161 | addition to Git *checkout* or Hg *update*, this includes *pull*, *merge*, and *rebase*. 162 | 163 | *(New - 2016-12-09)* Storing VFP binaries in a repository is now optional. This tool supports 164 | repositories that only include FoxBin2Prg text files, or where only some of the binaries are 165 | tracked by the repository. 166 | 167 | - For any repositories contain FoxBin2Prg text files, but do not store the corresponding VFP 168 | binary files, the binary files will be regenerated, if necessary. This tool checks and sets 169 | the Windows modification date/time values of the files it processes, so that it can determine 170 | when a VFP binary file needs to be regenerated. 171 | - For any binary menu files (.MNX) that are stored in the repositories, or regenerated by this 172 | process, the code files (.MPR) will be regenerated and recompiled using whatever program is 173 | specified in the VFP `_GENMENU` system variable. 174 | *(New - 2016-12-19)* If the .MPR file is committed to your repository, then this tool will 175 | not call the `_GENMENU` program, but it will check if the .MPR file needs to be recompiled 176 | to update the .MPX file. If the .MPX file is also committed to the repository, this tool 177 | will not recompile the .MPR, either. 178 | - All program files (.PRG) in the repositories will be recompiled, if necessary. 179 | *(New - 2016-12-19)* If you commit any .FXP files to your repositories, the corresponding 180 | .PRG file will not be recompiled. 181 | - In the *Git Utilities* options, if you have specified that timestamp files are be generated, 182 | then for each repository being processed that has a timestamp file, the file modification dates 183 | will be restored for all files in the repository. 184 | - *(New - 2016-09-07, enhanced 2016-12-09)* If a repository uses a timestamp file, then any of the 185 | files that are recompiled or regenerated by this tool (.FXP, .MPR/.MPX, all the VFP binary files) 186 | will have their modification date and time set to match the timestamp of the main file (.PRG, 187 | VFP binary, or FoxBin2Prg text file). In addition, if a file to be recompiled/regenerated 188 | **already** has the same modification date and time as the timestamp of the main file, then 189 | that file will **not** be recompiled/regenerated. 190 | 191 | Since this tool finds and regenerates binary files for all the text files in the selected 192 | repositories, it is normally simpler and faster than running FoxBin2Prg directly. In addition, 193 | regenerating and recompiling just the menus and programs is faster than recompiling an entire 194 | project to accomplish the same end result, and will save time when running the **Prepare for 195 | Git-Hg commit** tool, since it won't change the object code in the other VFP binary files. 196 | 197 | ### `Thor_Tool_GitUtilities_SaveProjectTimeStamps.PRG` ### 198 | This tool appears under the Git-Hg Utilities menu as **Save file timestamps**. It operates on 199 | either an entire VFP project, or an individual Git or Mercurial repository folder. The purpose of 200 | this tool is to preserve the modification date of each file being tracked in a repository, which 201 | Git and Mercurial do not do. Whenever files are checked out of a Git or Mercurial repository, they 202 | are assigned the current system date and time. However, sometimes it is nice to know the last time 203 | a particular file was modified. This tool creates/updates a timestamp file in the root folder of 204 | each repository being processed, saving the last modification date for each file being tracked in 205 | the repository. 206 | If the Git-Hg options specify that a timestamp file should always be used, or if a specific 207 | repository is using a timestamp file, then the **Prepare for Git-Hg commit** tool will call this 208 | process automatically to update the timestamp file. 209 | 210 | ### `Thor_Tool_GitUtilities_RestoreProjectTimeStamps.PRG` ### 211 | This tool appears under the Git-Hg Utilities menu as **Restore file timestamps**. It operates on 212 | either an entire VFP project, or an individual Git or Mercurial repository folder. Its purpose is 213 | to restore the modification dates for all files listed in the timestamp files created by the *Save 214 | file timestamps* tool. 215 | If the Git-Hg options specify that a timestamp file should always be used, or if a specific 216 | repository is using a timestamp file, then the **Post-checkout file synchronization** tool will 217 | call this process automatically to restore the file modification date/times from the timestamp 218 | file. 219 | 220 | ### `Thor_Tool_GitUtilities_ShowReposInProject.PRG` ### 221 | This tool appears under the Git-Hg Utilities menu as **Show Git-Hg repos in project**. It operates 222 | on the active VFP project, or if no project is open, it prompts for one. This is strictly an 223 | informational tool, which displays a cursor containing a list of all repositories which include 224 | files from the project, the branch that is currently checked out for each project, and a few stats 225 | about any changes or conflicts for each repository. A type field indicates whether each repository 226 | is a Git (G) or Mercurial (M) repository. 227 | 228 | [Git-tools-history]: https://raw.githubusercontent.com/mikepotjer/vfp-git-utils/master/ThorUpdater/GitUtilitiesVersionFile.txt 229 | [FoxProThor-Google-group]: https://groups.google.com/forum/?fromgroups#!forum/FoxProThor 230 | [Thor-homepage]: https://github.com/VFPX/Thor 231 | [FoxBin2Prg-homepage]: https://github.com/fdbozzo/foxbin2prg 232 | [Git-Windows-download]: https://git-scm.com/download/win 233 | [Mercurial-Windows-download]: https://www.mercurial-scm.org/downloads 234 | [Git-setup-guide]: https://drive.google.com/file/d/0B1GXcfuc1fBubFpUS2VmSVNpUEk/view?usp=sharing 235 | [Borup-whitepapers]: http://www.ita-software.com/foxpage.aspx 236 | -------------------------------------------------------------------------------- /ThorUpdater/GitUtilitiesVersionFile-Beta.txt: -------------------------------------------------------------------------------- 1 | LPARAMETERS toUpdateInfo 2 | 3 | LOCAL lcNote, ; 4 | lcRegisterWithThor 5 | 6 | ****************************************************** 7 | ********** Git-Hg Utilities Version History ********** 8 | ****************************************************** 9 | 10 | TEXT TO lcNote NOSHOW 11 | The Git-Hg Utilities ease the process of working with VFP's binary files when using Git or Mercurial as the source control provider, as well as making it easier to work with .PJX projects which contain files from multiple Git or Mercurial repositories. See the tool home page for more information. 12 | 13 | These utilities require the Thor repository, FoxBin2Prg, Git for Windows or Mercurial for Windows, and the Windows Scripting Host. 14 | 15 | ==== Change History ==== 16 | 2018.05.18.beta 17 | - Update the code that closes and reopens projects to support the VFPX Project Explorer. When one or more solutions are open in Project Explorer, the Git-Hg utilities will use the Project Explorer interface to close and reopen those projects, so that Project Explorer does not shut down after a Git-Hg process. 18 | - Redirect all links for this utility to GitHub. 19 | - Update VFPX project links to the GitHub locations. 20 | 21 | 2017.03.18.beta 22 | - Combine the "Add Git-Hg Beta to Check for Updates" and "Remove Git-Hg Beta from Check for Updates" tools into a single tool called "Add/Remove Remove Git-Hg Beta in Check for Updates". This tool prompts you to add the beta to the My Updates folder if it doesn't exist, and prompts you to remove it when it does exist. 23 | - Remove the "Populate DBF from DB2" tool from Thor. This was located under the "Applications > FoxBin2Prg" menu. This tool is no longer relevant since FoxBin2Prg added the option "DBF_Conversion_Support: 8". 24 | 25 | 2016.12.27.beta 26 | - The "Post-checkout/update" and "Prepare for commit" processes now close all project manager files (.PJX) at the beginning of the process, and don't open the project files again until all processing is complete. This eliminates some issues where the project manager cannot find a file that hasn't been regenerated yet, as well as ensuring that a file is not held open by the project manager during processing. 27 | 28 | 2016.12.19.beta 29 | - When the ability to regenerate all VFP binaries from text files was added in 2016.12.09.beta, I failed to update the process that regenerates the .MPR/.MPX files to take into account that the .MNX file might not be included in the list of repository files. This has been corrected, so that .MPR/.MPX files will be regenerated and compiled as needed after the .MNX/.MNT files have been regenerated from text. 30 | - The features of the "Post-checkout/update" process that regenerate the .MPR/.MPX files and recompile the .PRG files will now check if .MPR, .MPX, or .FXP files are committed to the repository before overwriting them. This change gives developers more flexibility regarding the types of files that are tracked in their repositories. 31 | 32 | 2016.12.09.beta 33 | - The Git-Hg tools have been enhanced to support any repository that uses FoxBin2Prg text files, regardless of whether the VFP binary files are being tracked in the repository. 34 | -- In the "Post-checkout file synchronization" process, for any FoxBin2Prg text file whose VFP binaries are not being tracked in the same repository, FoxBin2Prg will be called to regenerate the binaries. 35 | -- In the "Prepare for Git-Hg commit" process, any FoxBin2Prg text files that are being tracked by the repository will be regenerated even if the VFP binaries are not being tracked. 36 | - The FoxBin2Prg progress bar is now being used to provide better feedback during FoxBin2Prg operations and other long processes. 37 | 38 | 2016.08.27.beta 39 | - The "Post-checkout file synchronization" process has been enhanced. If a repository uses a timestamp file, then any of the files that are recompiled or regenerated by this tool (.FXP, .MPR/.MPX, .PJX/.PJT) will have their modification date and time set to match the timestamp of the main file (.PRG, .MNX, project text file). In addition, if a file to be recompiled/regenerated already has the same modification date and time as the timestamp of the main file, then that file will NOT be recompiled/regenerated. (Thanks to Eddie Caldwell for inspiring this) 40 | 41 | 2016.06.25.beta 42 | - When the "Prepare for Git commit" process is run for a project file, make sure the text file is regenerated for the project file (.PJX), even if the project file and its text file are not being tracked by a repository. The 2016.06.11 beta disabled this behavior, since the enhancement to project file processing only included project files that were being tracked. 43 | - Enhance all the utilities to support Mercurial repositories, and added an option to specify a different file name for the timestamp file in a Mercurial repository. 44 | 45 | 2016.06.11.beta 46 | - Correct an issue where the modification date of a file that had just been edited could be reset to an earlier date during the "Prepare for Git commit" process. This could occur if the timestamp file somehow ended up with duplicate entries for a file in the repository. Duplicates are now removed when reading the file list from the timestamp file, and only the most recent timestamp is used for a duplicated file name. This fix also removes the duplicates when the timestamp file is updated. (Thanks to Eddie Caldwell) 47 | - Enhance the "Prepare for Git commit" process so that if there are multiple .PJ2 files being tracked in a repository (and the .PJX files are not being tracked), all of the .PJ2 files will be regenerated. Before, you had to run "Prepare for Git commit" with a specific .PJX file, and then only the .PJ2 file for that .PJX was regenerated. 48 | 49 | 2015.11.20 50 | - Correct a bug that caused an error in the "Save file timestamps" tool when a file that was being tracked in the repository has been deleted, but the deletion is not staged yet. (Thanks to Eddie Caldwell) 51 | - Correct a bug that caused an error in the "Restore file timestamps" tool when a file is referenced in the timestamp file, but is was deleted from the repository in a previous commit. (Thanks to Eddie Caldwell) 52 | 53 | 2015.10.12 54 | - When a new primary VFP binary file is added to a repository, the "Prepare for Git commit" process will now ensure that any untracked files that belong with it will be added to the repository. For example, if a .SCX file is added, the .SCT and .SC2 files that go with it will be added for you. 55 | 56 | 2015.10.09 57 | - Modify the list of repositories in a project to include totals for staged and unstaged changes, untracked files, and merge conflicts. 58 | - Add a tool which will create and populate a table from a FoxBin2Prg DB2 file created with the setting DBF_Conversion_Support: 4. 59 | - Update the ReadMe file (shown on the tool homepage) to document the new features, and include additional information about the Prepare for Git Commit tool. 60 | 61 | 2015.07.27 62 | - Enhance the error handling for executing external commands to do a better job of collecting error info, eliminating a scenario where a blank error message was being generated. 63 | 64 | 2015.07.24 65 | - Modify the recompile process for the post-checkout file synchronization to attempt to recompile all files in a repository, even after one of them fails to compile. 66 | - Update the error messaging for the recompile process to include the name of all the files that fail, and the name of the repository where the error occurs. 67 | 68 | 2015.07.09 69 | - Correct a bug in the scope selection code that resulted in a VFP error if the form was cancelled. 70 | - Refactor to move the scope selection code to the main Git Utilities class so it can be shared by all the individual tools, rather than repeating it in every tool. 71 | 72 | 2015.07.08 73 | - Make some minor changes for including this project in Thor's "Check for Updates" feature. 74 | 75 | 2015.06.10 76 | - Enhance the post-checkout synch process to restore file timestamps, if applicable. 77 | - Modify the post-checkout synch tool to link to the Git Utilities options to more easily access the timestamp options. 78 | 79 | 2015.06.04 80 | - Fix a bug in the "Prepare for Git commit" process which would fail to cleanup a binary file if the file extensions for a pair of binary files were not the same case (for example .vcx and .VCT). Only the primary file was being cleaned up in this scenario. 81 | - Add new features to the Git Utilities class to provide post-checkout file synchronization. 82 | - Add a new "Post-checkout file synchronization" tool which implements the corresponding features added to the Git utilities class. 83 | - Update the readme with information about the post-checkout tool. 84 | 85 | 2015.06.03 86 | - Update to the ReadMe file to add a section on getting started with Git. 87 | - Add links to the tool home page on GitHub. 88 | 89 | 2015.05.12 90 | - Initial public release of the Git Utilities. 91 | ENDTEXT 92 | 93 | ******************************************** 94 | ********** End of Version History ********** 95 | ******************************************** 96 | 97 | ADDPROPERTY( toUpdateInfo, 'Notes', lcNote ) 98 | 99 | WITH toUpdateInfo 100 | .ApplicationName = 'Git and Hg Utilities (Beta)' 101 | .Component = 'No' 102 | .ToolName = 'Thor_Tool_ThorInternalRepository' 103 | .VersionNumber = 'v2018.05.18.beta' 104 | .VersionDate = DATE(2018, 5, 18) 105 | .SourceFileUrl = 'https://raw.githubusercontent.com/mikepotjer/vfp-git-utils/beta/ThorUpdater/GitUtils.zip' 106 | .LinkPrompt = 'Git/Hg Utilities for VFP Home Page' 107 | .Link = 'https://github.com/mikepotjer/vfp-git-utils/tree/beta' 108 | ENDWITH 109 | 110 | TEXT TO lcRegisterWithThor NOSHOW TEXTMERGE 111 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_GitUtilities_AddBetaToCFU.prg" ) 112 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_GitUtilities_RemoveBetaFromCFU.prg" ) 113 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_FoxBin2Prg_DB2toDBF.prg" ) 114 | 115 | MESSAGEBOX('From the Thor Launcher, see "Applications -> Git-Hg Utilities"', 0 ,"Git-Hg Utilities installed", 5000) 116 | ENDTEXT 117 | 118 | ADDPROPERTY( toUpdateInfo, 'RegisterWithThor', lcRegisterWithThor ) 119 | 120 | EXECSCRIPT( _Screen.cThorDispatcher, 'Result=', toUpdateInfo ) 121 | RETURN toUpdateInfo 122 | -------------------------------------------------------------------------------- /ThorUpdater/GitUtilitiesVersionFile.txt: -------------------------------------------------------------------------------- 1 | LPARAMETERS toUpdateInfo 2 | 3 | LOCAL lcNote, ; 4 | lcRegisterWithThor 5 | 6 | ****************************************************** 7 | ********** Git-Hg Utilities Version History ********** 8 | ****************************************************** 9 | 10 | TEXT TO lcNote NOSHOW 11 | The Git-Hg Utilities ease the process of working with VFP's binary files when using Git or Mercurial as the source control provider, as well as making it easier to work with .PJX projects which contain files from multiple Git or Mercurial repositories. See the tool home page for more information. 12 | 13 | These utilities require the Thor repository, FoxBin2Prg, Git for Windows or Mercurial for Windows, and the Windows Scripting Host. 14 | 15 | ==== Change History ==== 16 | 2018.05.18 17 | - Combine the "Add Git-Hg Beta to Check for Updates" and "Remove Git-Hg Beta from Check for Updates" tools into a single tool called "Add/Remove Remove Git-Hg Beta in Check for Updates". This tool prompts you to add the beta to the My Updates folder if it doesn't exist, and prompts you to remove it when it does exist. 18 | - Remove the "Populate DBF from DB2" tool from Thor. This was located under the "Applications > FoxBin2Prg" menu. This tool is no longer relevant since FoxBin2Prg added the option "DBF_Conversion_Support: 8". 19 | - Update the code that closes and reopens projects to support the VFPX Project Explorer. When one or more solutions are open in Project Explorer, the Git-Hg utilities will use the Project Explorer interface to close and reopen those projects, so that Project Explorer does not shut down after a Git-Hg process. 20 | - Redirect all links for this utility to GitHub. 21 | - Update VFPX project links to the GitHub locations. 22 | 23 | 2017.02.25 24 | - The Git-Hg tools have been enhanced to support any repository that uses FoxBin2Prg text files, regardless of whether the VFP binary files are being tracked in the repository. 25 | -- In the "Post-checkout file synchronization" process, for any FoxBin2Prg text file whose VFP binaries are not being tracked in the same repository, FoxBin2Prg will be called to regenerate the binaries. 26 | -- In the "Prepare for Git-Hg commit" process, any FoxBin2Prg text files that are being tracked by the repository will be regenerated even if the VFP binaries are not being tracked. 27 | - The FoxBin2Prg progress bar is now being used to provide better feedback during FoxBin2Prg operations and other long processes. 28 | - The features of the "Post-checkout/update" process that regenerate the .MPR/.MPX files and recompile the .PRG files will now check if .MPR, .MPX, or .FXP files are committed to the repository before overwriting them. This change gives developers more flexibility regarding the types of files that are tracked in their repositories. 29 | - The "Post-checkout/update" and "Prepare for commit" processes now close all project manager files (.PJX) at the beginning of the process, and don't open the project files again until all processing is complete. This eliminates some issues where the project manager cannot find a file that hasn't been regenerated yet, as well as ensuring that a file is not held open by the project manager during processing. 30 | - Two new tools were added: "Add Git-Hg Beta to Check for Updates" will add a custom item to Thor's Check for Updates list, making it easy to install and try beta versions of the Git-Hg Utilities. "Remove Git-Hg Beta from Check for Updates" removes that custom item from the Check for Updates list, if you don't want it there anymore. 31 | 32 | 2016.09.07 33 | - The "Post-checkout file synchronization" process has been enhanced. If a repository uses a timestamp file, then any of the files that are recompiled or regenerated by this tool (.FXP, .MPR/.MPX, .PJX/.PJT) will have their modification date and time set to match the timestamp of the main file (.PRG, .MNX, project text file). In addition, if a file to be recompiled/regenerated already has the same modification date and time as the timestamp of the main file, then that file will NOT be recompiled/regenerated. (Thanks to Eddie Caldwell for inspiring this) 34 | 35 | 2016.07.23 36 | - Correct an issue where the modification date of a file that had just been edited could be reset to an earlier date during the "Prepare for Git commit" process. This could occur if the timestamp file somehow ended up with duplicate entries for a file in the repository. Duplicates are now removed when reading the file list from the timestamp file, and only the most recent timestamp is used for a duplicated file name. This fix also removes the duplicates when the timestamp file is updated. (Thanks to Eddie Caldwell) 37 | - Enhance the "Prepare for Git commit" process so that if there are multiple .PJ2 files being tracked in a repository (and the .PJX files are not being tracked), all of the .PJ2 files will be regenerated. Before, you had to run "Prepare for Git commit" with a specific .PJX file, and then only the .PJ2 file for that .PJX was regenerated. 38 | - Enhance all the utilities to support Mercurial repositories, and added an option to specify a different file name for the timestamp file in a Mercurial repository. 39 | 40 | 2015.11.20 41 | - Correct a bug that caused an error in the "Save file timestamps" tool when a file that was being tracked in the repository has been deleted, but the deletion is not staged yet. (Thanks to Eddie Caldwell) 42 | - Correct a bug that caused an error in the "Restore file timestamps" tool when a file is referenced in the timestamp file, but is was deleted from the repository in a previous commit. (Thanks to Eddie Caldwell) 43 | 44 | 2015.10.12 45 | - When a new primary VFP binary file is added to a repository, the "Prepare for Git commit" process will now ensure that any untracked files that belong with it will be added to the repository. For example, if a .SCX file is added, the .SCT and .SC2 files that go with it will be added for you. 46 | 47 | 2015.10.09 48 | - Modify the list of repositories in a project to include totals for staged and unstaged changes, untracked files, and merge conflicts. 49 | - Add a tool which will create and populate a table from a FoxBin2Prg DB2 file created with the setting DBF_Conversion_Support: 4. 50 | - Update the ReadMe file (shown on the tool homepage) to document the new features, and include additional information about the Prepare for Git Commit tool. 51 | 52 | 2015.07.27 53 | - Enhance the error handling for executing external commands to do a better job of collecting error info, eliminating a scenario where a blank error message was being generated. 54 | 55 | 2015.07.24 56 | - Modify the recompile process for the post-checkout file synchronization to attempt to recompile all files in a repository, even after one of them fails to compile. 57 | - Update the error messaging for the recompile process to include the name of all the files that fail, and the name of the repository where the error occurs. 58 | 59 | 2015.07.09 60 | - Correct a bug in the scope selection code that resulted in a VFP error if the form was cancelled. 61 | - Refactor to move the scope selection code to the main Git Utilities class so it can be shared by all the individual tools, rather than repeating it in every tool. 62 | 63 | 2015.07.08 64 | - Make some minor changes for including this project in Thor's "Check for Updates" feature. 65 | 66 | 2015.06.10 67 | - Enhance the post-checkout synch process to restore file timestamps, if applicable. 68 | - Modify the post-checkout synch tool to link to the Git Utilities options to more easily access the timestamp options. 69 | 70 | 2015.06.04 71 | - Fix a bug in the "Prepare for Git commit" process which would fail to cleanup a binary file if the file extensions for a pair of binary files were not the same case (for example .vcx and .VCT). Only the primary file was being cleaned up in this scenario. 72 | - Add new features to the Git Utilities class to provide post-checkout file synchronization. 73 | - Add a new "Post-checkout file synchronization" tool which implements the corresponding features added to the Git utilities class. 74 | - Update the readme with information about the post-checkout tool. 75 | 76 | 2015.06.03 77 | - Update to the ReadMe file to add a section on getting started with Git. 78 | - Add links to the tool home page on GitHub. 79 | 80 | 2015.05.12 81 | - Initial public release of the Git Utilities. 82 | ENDTEXT 83 | 84 | ******************************************** 85 | ********** End of Version History ********** 86 | ******************************************** 87 | 88 | ADDPROPERTY( toUpdateInfo, 'Notes', lcNote ) 89 | 90 | WITH toUpdateInfo 91 | .ApplicationName = 'Git and Hg Utilities' 92 | .Component = 'No' 93 | .ToolName = 'Thor_Tool_ThorInternalRepository' 94 | .VersionNumber = 'v2018.05.18' 95 | .VersionDate = DATE(2018, 5, 18) 96 | .SourceFileUrl = 'https://raw.githubusercontent.com/mikepotjer/vfp-git-utils/master/ThorUpdater/GitUtils.zip' 97 | .LinkPrompt = 'Git/Hg Utilities for VFP Home Page' 98 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' 99 | ENDWITH 100 | 101 | TEXT TO lcRegisterWithThor NOSHOW TEXTMERGE 102 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_GitUtilities_AddBetaToCFU.prg" ) 103 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_GitUtilities_RemoveBetaFromCFU.prg" ) 104 | ERASE ( _SCREEN.cThorFolder + "\Tools\Thor_Tool_FoxBin2Prg_DB2toDBF.prg" ) 105 | 106 | MESSAGEBOX('From the Thor Launcher, see "Applications -> Git-Hg Utilities"', 0 ,"Git-Hg Utilities installed", 5000) 107 | ENDTEXT 108 | 109 | ADDPROPERTY( toUpdateInfo, 'RegisterWithThor', lcRegisterWithThor ) 110 | 111 | EXECSCRIPT( _Screen.cThorDispatcher, 'Result=', toUpdateInfo ) 112 | RETURN toUpdateInfo 113 | -------------------------------------------------------------------------------- /ThorUpdater/GitUtils.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mikepotjer/vfp-git-utils/598d83d8d92f69d03768104b8b3337b9cd6198c6/ThorUpdater/GitUtils.zip -------------------------------------------------------------------------------- /ThorUpdater/Thor_Update_Git-Utils.prg: -------------------------------------------------------------------------------- 1 | LPARAMETERS loUpdateObject 2 | 3 | WITH loUpdateObject 4 | .ApplicationName = 'Git Utilities' 5 | .Component = 'No' 6 | .ToolName = 'Thor_Tool_ThorInternalRepository' 7 | .VersionLocalFilename = 'GitUtilitiesVersionFile.txt' 8 | .VersionFileURL = 'https://bitbucket.org/mikepotjer/vfp-git-utils/downloads/GitUtilitiesVersionFile.txt' 9 | ENDWITH 10 | 11 | RETURN loUpdateObject 12 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_AddRemoveBetaInCFU.prg: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #DEFINE TOOL_PROMPT "Add/Remove Git-Hg Beta in Check for Updates" 4 | 5 | **************************************************************** 6 | **************************************************************** 7 | * Standard prefix for all tools for Thor, allowing this tool to 8 | * tell Thor about itself. 9 | 10 | IF PCOUNT() = 1 ; 11 | AND 'O' = VARTYPE( m.lxParam1 ) ; 12 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 13 | 14 | WITH lxParam1 15 | 16 | * Required 17 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 18 | .Summary = 'Add or Remove the Git-Hg Beta in Thor Check for Updates' 19 | 20 | * Optional 21 | Text to .Description NoShow && a description for the tool 22 | Adds or removes the Git-Hg Utilities Beta installer in the My Updates folder. 23 | 24 | If the beta installer doesn't exist, you will be prompted to create it, so it can be installed or updated via Thor Check for Updates. 25 | 26 | If the beta installer already exists, you will be prompted to remove it, so it no longer appears in Thor Check for Updates. 27 | EndText 28 | .StatusBarText = .Summary 29 | .CanRunAtStartUp = .F. 30 | 31 | * These are used to group and sort tools when they are displayed in menus or the Thor form 32 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 33 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 34 | .Sort = 6 && the sort order for all items from the same Source, Category and Sub-Category 35 | 36 | * For public tools, such as PEM Editor, etc. 37 | .Version = '2018.05.18' && e.g., 'Version 7, May 18, 2011' 38 | .Author = 'Mike Potjer' 39 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 40 | .VideoLink = '' && link to a video for this tool 41 | 42 | ENDWITH 43 | 44 | RETURN m.lxParam1 45 | ENDIF 46 | 47 | IF PCOUNT() = 0 48 | DO ToolCode 49 | ELSE 50 | DO ToolCode WITH m.lxParam1 51 | ENDIF 52 | 53 | RETURN 54 | 55 | 56 | **************************************************************** 57 | **************************************************************** 58 | * Normal processing for this tool begins here. 59 | PROCEDURE ToolCode 60 | LPARAMETERS lxParam1 61 | 62 | LOCAL lcFileContent, ; 63 | lcFileName, ; 64 | lcGitUtilsBetaInstall, ; 65 | lcToolFolder, ; 66 | llSuccess, ; 67 | loErrorInfo AS Exception 68 | 69 | llSuccess = .T. 70 | 71 | ********************************************************************* 72 | *-- Generate the contents of the beta install .PRG. 73 | TEXT TO m.lcGitUtilsBetaInstall TEXTMERGE NOSHOW 74 | LPARAMETERS loUpdateObject 75 | 76 | WITH loUpdateObject 77 | .ApplicationName = 'Git Utilities (Beta)' 78 | .Component = 'No' 79 | .ToolName = 'Thor_Tool_ThorInternalRepository' 80 | .VersionLocalFilename = 'GitUtilitiesVersionFile-Beta.txt' 81 | .VersionFileURL = 'https://raw.githubusercontent.com/mikepotjer/vfp-git-utils/beta/ThorUpdater/GitUtilitiesVersionFile-Beta.txt' 82 | ENDWITH 83 | 84 | RETURN loUpdateObject 85 | ENDTEXT 86 | ********************************************************************* 87 | 88 | *-- Lookup the folder where custom updates are installed, and set the 89 | *-- file name to use for the beta install. 90 | lcToolFolder = EXECSCRIPT( _Screen.cThorDispatcher, 'Tool Folder=' ) 91 | lcFileName = ADDBS( m.lcToolFolder ) + 'Updates\My Updates\Thor_Update_Git-Utils-Beta.prg' 92 | 93 | IF FILE( m.lcFileName ) 94 | *-- If the install file exists, but it's content doesn't match the 95 | *-- current installer settings, then delete it, because there's a 96 | *-- good chance it no longer works. 97 | lcFileContent = FILETOSTR( m.lcFileName ) 98 | IF NOT m.lcFileContent == m.lcGitUtilsBetaInstall 99 | ERASE ( m.lcFileName ) 100 | ENDIF 101 | ENDIF 102 | 103 | IF FILE( m.lcFileName ) 104 | *-- The install file already exists, so give the user the option 105 | *-- to remove it. 106 | IF MESSAGEBOX( "Git-Hg Utilities Beta install file was found in the My Updates folder." ; 107 | + " Do you want to remove it?", 4+32, TOOL_PROMPT ) = 6 && Yes 108 | *-- The file exists, so attempt to delete it. 109 | TRY 110 | ERASE ( m.lcFileName ) 111 | 112 | IF FILE( m.lcFileName ) 113 | *-- The file could not be deleted for some reason, so abort. 114 | ERROR "Unable to remove Git-Hg Beta install file." 115 | ELSE 116 | *-- Let the user know the file was successfully deleted. 117 | MESSAGEBOX( "Git-Hg Utilities Beta install file successfully removed.", 64, ; 118 | TOOL_PROMPT, 3000 ) 119 | ENDIF 120 | 121 | CATCH TO loErrorInfo 122 | *-- Report any error that occurred. 123 | llSuccess = .F. 124 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 125 | ENDTRY 126 | ENDIF 127 | ELSE 128 | *-- The install file doesn't exist, so give the user the option to 129 | *-- add it. 130 | IF MESSAGEBOX( "Git-Hg Utilities Beta install file does not exist in the My Updates folder." ; 131 | + " Do you want to add it?", 4+32, TOOL_PROMPT ) = 6 && Yes 132 | *-- Attempt to create the install file. 133 | TRY 134 | STRTOFILE( m.lcGitUtilsBetaInstall, m.lcFileName ) 135 | 136 | IF FILE( m.lcFileName ) 137 | *-- The file was successfully created, so let the user know. 138 | MESSAGEBOX( "Git-Hg Utilities Beta install file was successfully created.", 64, ; 139 | TOOL_PROMPT, 3000 ) 140 | ELSE 141 | *-- For some reason the file could not be created, so abort. 142 | ERROR "Unable to create Git-Hg Beta install file." 143 | ENDIF 144 | 145 | CATCH TO loErrorInfo 146 | *-- An error occurred attempting to create the file, so report 147 | *-- it to the user. 148 | llSuccess = .F. 149 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 150 | ENDTRY 151 | ENDIF 152 | ENDIF 153 | 154 | *-- Provide a return value that can be used if you call this process 155 | *-- from some other code. 156 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 157 | ENDPROC 158 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_PostCheckoutSynch.PRG: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #INCLUDE Procs\Thor_Proc_GitUtilities.h 4 | #DEFINE TOOL_PROMPT "Post-checkout/update file synchronization" 5 | 6 | **************************************************************** 7 | **************************************************************** 8 | * Standard prefix for all tools for Thor, allowing this tool to 9 | * tell Thor about itself. 10 | 11 | IF PCOUNT() = 1 ; 12 | AND 'O' = VARTYPE( m.lxParam1 ) ; 13 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 14 | 15 | WITH lxParam1 16 | 17 | * Required 18 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 19 | .Summary = 'Synchronize uncommitted VFP files in the working folders of a Git or Mercurial repository with the files committed to the repository' 20 | 21 | * Optional 22 | Text to .Description NoShow && a description for the tool 23 | Synchronizes files that are not part of a repository with their counterparts that are committed to a selected repository, or in the Git/Mercurial repositories of a selected VFP project. This includes: 24 | 25 | - Regenerating VFP binary files from the text files (only when the binaries are not in the repository) 26 | - Regenerating and compiling menu code from the binary menu files (.MNX) 27 | - Recompiling program files. 28 | - Restoring file modification dates from a timestamp file (if applicable) 29 | 30 | This tool would typically be run after performing a Git checkout or Hg update, a pull, merge, rebase, or any action that updates the files in the working folders with different versions from a repository. 31 | 32 | This tool requires Git for Windows or Mercurial for Windows, FoxBin2Prg, and some Thor Repository tools. 33 | EndText 34 | .StatusBarText = .Summary 35 | .CanRunAtStartUp = .F. 36 | 37 | * These are used to group and sort tools when they are displayed in menus or the Thor form 38 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 39 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 40 | .Sort = 2 && the sort order for all items from the same Source, Category and Sub-Category 41 | 42 | * For public tools, such as PEM Editor, etc. 43 | .Version = '2016.12.09' && e.g., 'Version 7, May 18, 2011' 44 | .Author = 'Mike Potjer' 45 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 46 | .VideoLink = '' && link to a video for this tool 47 | 48 | *-- This tool restores timestamps, if applicable, so include 49 | *-- the timestamp options with this tool. 50 | .OptionTool = ccToolName 51 | .OptionClasses = "clsPreserveTimestamp, clsGitTimestampFileName, clsHgTimestampFileName" 52 | ENDWITH 53 | 54 | RETURN m.lxParam1 55 | ENDIF 56 | 57 | IF PCOUNT() = 0 58 | DO ToolCode 59 | ELSE 60 | DO ToolCode WITH m.lxParam1 61 | ENDIF 62 | 63 | RETURN 64 | 65 | 66 | **************************************************************** 67 | **************************************************************** 68 | * Normal processing for this tool begins here. 69 | PROCEDURE ToolCode 70 | LPARAMETERS lxParam1 71 | 72 | LOCAL lcRepository, ; 73 | llSuccess, ; 74 | loErrorInfo AS Exception, ; 75 | loGitUtilities AS cusGitUtilities OF Thor_Proc_GitUtilities.PRG, ; 76 | loScope, ; 77 | loScopeForm AS FrmScopeFinder OF "C:\Work\VFP\Shared\Tools\Thor\Tools\Procs\Thor_Proc_ScopeProcessor.vcx" 78 | 79 | llSuccess = .T. 80 | 81 | *-- Get a reference to our Git tools class. 82 | TRY 83 | loGitUtilities = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 84 | 85 | CATCH TO loErrorInfo 86 | llSuccess = .F. 87 | ENDTRY 88 | 89 | *-- Determine what we are processing. 90 | IF m.llSuccess 91 | loScope = m.loGitUtilities.GetProcessScope( m.lxParam1, TOOL_PROMPT ) 92 | IF EMPTY( m.loScope.cScope ) 93 | llSuccess = .F. 94 | loErrorInfo = m.loScope.oException 95 | ENDIF 96 | ENDIF 97 | 98 | *-- Here's where the processing actually occurs. 99 | DO CASE 100 | CASE NOT m.llSuccess 101 | *-- Something failed already, so nothing to do. 102 | 103 | CASE m.loScope.lScopeIsProject 104 | *-- Process a project. 105 | WAIT WINDOW "Synchronizing project files" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 106 | llSuccess = m.loGitUtilities.PostCheckoutProcessProject( @m.loErrorInfo, m.loScope.cScope ) 107 | 108 | OTHERWISE 109 | *-- Processing a folder. 110 | WAIT WINDOW "Synchronizing repository files" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 111 | llSuccess = m.loGitUtilities.PostCheckoutProcessRepo( @m.loErrorInfo, m.loScope.cScope ) 112 | ENDCASE 113 | 114 | WAIT CLEAR 115 | 116 | *-- Display the results. 117 | DO CASE 118 | CASE m.llSuccess 119 | MESSAGEBOX( "Post-checkout/update file synchronization was successful for" + CHR(13) ; 120 | + m.loScope.cScope, 64, TOOL_PROMPT, 3000 ) 121 | 122 | CASE TYPE( "m.loScope.lUserCancelled" ) = "L" ; 123 | AND m.loScope.lUserCancelled 124 | *-- The process failed because the user cancelled, set a timeout 125 | *-- so the user doesn't have to close the message dialog. 126 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT, 2000 ) 127 | 128 | CASE VARTYPE( m.loGitUtilities ) = "O" 129 | *-- If the Git utilities object is available, use that to report 130 | *-- the error, since it gives you more detail. 131 | lcRepository = .NULL. 132 | IF TYPE( "m.loScope.cScope" ) = "C" ; 133 | AND NOT EMPTY( NVL( m.loScope.cScope, SPACE(0) ) ) ; 134 | AND NOT m.loScope.lScopeIsProject 135 | lcRepository = m.loScope.cScope 136 | ENDIF 137 | 138 | loGitUtilities.ShowError( m.loErrorInfo, m.lcRepository ) 139 | 140 | OTHERWISE 141 | *-- No goodies available, so just report the error message. 142 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 143 | ENDCASE 144 | 145 | *-- Provide a return value that can be used if you call this process 146 | *-- from some other code. 147 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 148 | ENDPROC 149 | 150 | 151 | ********************************************************************* 152 | *-- Option classes 153 | ********************************************************************* 154 | DEFINE CLASS clsPreserveTimestamp AS Custom 155 | Tool = ccToolName 156 | Key = ccKeyPreserveTimestamps 157 | Value = ccInitialValuePreserveTS 158 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 159 | ENDDEFINE 160 | 161 | DEFINE CLASS clsGitTimestampFileName AS Custom 162 | Tool = ccToolName 163 | Key = ccKeyGitTimestampFileName 164 | Value = ccInitialValueGitTSFileName 165 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 166 | ENDDEFINE 167 | 168 | DEFINE CLASS clsHgTimestampFileName AS Custom 169 | Tool = ccToolName 170 | Key = ccKeyHgTimestampFileName 171 | Value = ccInitialValueHgTSFileName 172 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 173 | ENDDEFINE 174 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_PrepareForCommit.PRG: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #INCLUDE Procs\Thor_Proc_GitUtilities.h 4 | #DEFINE TOOL_PROMPT "Prepare for Git-Hg commit" 5 | 6 | **************************************************************** 7 | **************************************************************** 8 | * Standard prefix for all tools for Thor, allowing this tool to 9 | * tell Thor about itself. 10 | 11 | IF PCOUNT() = 1 ; 12 | AND 'O' = VARTYPE( m.lxParam1 ) ; 13 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 14 | 15 | WITH lxParam1 16 | 17 | * Required 18 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 19 | .Summary = 'Prepare modified files in a VFP project or repository for commit into a Git or Mercurial repository' 20 | 21 | * Optional 22 | Text to .Description NoShow && a description for the tool 23 | Prepares all VFP binary files in a selected repository, or in the Git or Mercurial repositories of the selected project, for commit, including regenerating text files as needed. 24 | Whenever VFP binary files are being tracked in a repository and have changed due to a recompile, but not because of a code change, those binaries are reset. 25 | 26 | NOTE: Make sure that any VFP binary files which have changed are closed before running this process. This process can "hang" if it attempts to replace a file that is still open. 27 | 28 | This tool requires Git for Windows or Mercurial for Windows, FoxBin2Prg, and some Thor Repository tools. 29 | EndText 30 | .StatusBarText = .Summary 31 | .CanRunAtStartUp = .F. 32 | 33 | * These are used to group and sort tools when they are displayed in menus or the Thor form 34 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 35 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 36 | .Sort = 1 && the sort order for all items from the same Source, Category and Sub-Category 37 | 38 | * For public tools, such as PEM Editor, etc. 39 | .Version = '2016.12.09' && e.g., 'Version 7, May 18, 2011' 40 | .Author = 'Mike Potjer' 41 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 42 | .VideoLink = '' && link to a video for this tool 43 | 44 | .OptionTool = ccToolName 45 | .OptionClasses = "clsPreserveTimestamp, clsGitTimestampFileName, clsHgTimestampFileName" 46 | ENDWITH 47 | 48 | RETURN m.lxParam1 49 | ENDIF 50 | 51 | IF PCOUNT() = 0 52 | DO ToolCode 53 | ELSE 54 | DO ToolCode WITH m.lxParam1 55 | ENDIF 56 | 57 | RETURN 58 | 59 | 60 | **************************************************************** 61 | **************************************************************** 62 | * Normal processing for this tool begins here. 63 | PROCEDURE ToolCode 64 | LPARAMETERS lxParam1 65 | 66 | LOCAL lcRepository, ; 67 | llSuccess, ; 68 | loErrorInfo AS Exception, ; 69 | loGitUtilities AS cusGitUtilities OF Procs\Thor_Proc_GitUtilities.PRG, ; 70 | loScope 71 | 72 | llSuccess = .T. 73 | 74 | *-- Get a reference to our Git tools class. 75 | TRY 76 | loGitUtilities = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 77 | 78 | CATCH TO loErrorInfo 79 | llSuccess = .F. 80 | ENDTRY 81 | 82 | *-- Determine what we are processing. 83 | IF m.llSuccess 84 | loScope = m.loGitUtilities.GetProcessScope( m.lxParam1, TOOL_PROMPT ) 85 | IF EMPTY( m.loScope.cScope ) 86 | llSuccess = .F. 87 | loErrorInfo = m.loScope.oException 88 | ENDIF 89 | ENDIF 90 | 91 | *-- Here's where the processing actually occurs. 92 | DO CASE 93 | CASE NOT m.llSuccess 94 | *-- Something failed already, so nothing to do. 95 | 96 | CASE m.loScope.lScopeIsProject 97 | *-- Process a project. 98 | WAIT WINDOW "Preparing project for commit" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 99 | llSuccess = m.loGitUtilities.BinaryToTextProject( @m.loErrorInfo, m.loScope.cScope, .T. ) 100 | 101 | OTHERWISE 102 | *-- Processing a folder. 103 | WAIT WINDOW "Preparing repository for commit" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 104 | llSuccess = m.loGitUtilities.BinaryToTextRepo( @m.loErrorInfo, m.loScope.cScope, .T. ) 105 | ENDCASE 106 | 107 | WAIT CLEAR 108 | 109 | *-- Display the results. 110 | DO CASE 111 | CASE m.llSuccess 112 | MESSAGEBOX( "Preparation for commit was successful for" + CHR(13) + m.loScope.cScope, ; 113 | 64, TOOL_PROMPT, 3000 ) 114 | 115 | CASE TYPE( "m.loScope.lUserCancelled" ) = "L" ; 116 | AND m.loScope.lUserCancelled 117 | *-- The process failed because the user cancelled, set a timeout 118 | *-- so the user doesn't have to close the message dialog. 119 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT, 2000 ) 120 | 121 | CASE VARTYPE( m.loGitUtilities ) = "O" 122 | *-- If the Git utilities object is available, use that to report 123 | *-- the error, since it gives you more detail. 124 | lcRepository = .NULL. 125 | IF TYPE( "m.loScope.cScope" ) = "C" ; 126 | AND NOT EMPTY( NVL( m.loScope.cScope, SPACE(0) ) ) ; 127 | AND NOT m.loScope.lScopeIsProject 128 | lcRepository = m.loScope.cScope 129 | ENDIF 130 | 131 | loGitUtilities.ShowError( m.loErrorInfo, m.lcRepository ) 132 | 133 | OTHERWISE 134 | *-- No goodies available, so just report the error message. 135 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 136 | ENDCASE 137 | 138 | *-- Provide a return value that can be used if you call this process 139 | *-- from some other code. 140 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 141 | ENDPROC 142 | 143 | 144 | ********************************************************************* 145 | *-- Option classes 146 | ********************************************************************* 147 | DEFINE CLASS clsPreserveTimestamp AS Custom 148 | Tool = ccToolName 149 | Key = ccKeyPreserveTimestamps 150 | Value = ccInitialValuePreserveTS 151 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 152 | ENDDEFINE 153 | 154 | DEFINE CLASS clsGitTimestampFileName AS Custom 155 | Tool = ccToolName 156 | Key = ccKeyGitTimestampFileName 157 | Value = ccInitialValueGitTSFileName 158 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 159 | ENDDEFINE 160 | 161 | DEFINE CLASS clsHgTimestampFileName AS Custom 162 | Tool = ccToolName 163 | Key = ccKeyHgTimestampFileName 164 | Value = ccInitialValueHgTSFileName 165 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 166 | ENDDEFINE 167 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_RestoreProjectTimestamps.prg: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #INCLUDE Procs\Thor_Proc_GitUtilities.h 4 | #DEFINE TOOL_PROMPT "Restore file timestamps" 5 | 6 | **************************************************************** 7 | **************************************************************** 8 | * Standard prefix for all tools for Thor, allowing this tool to 9 | * tell Thor about itself. 10 | 11 | IF PCOUNT() = 1 ; 12 | AND 'O' = VARTYPE( m.lxParam1 ) ; 13 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 14 | 15 | WITH lxParam1 16 | 17 | * Required 18 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 19 | .Summary = 'Restore the timestamps of files committed to a Git or Mercurial repository' 20 | 21 | * Optional 22 | Text to .Description NoShow && a description for the tool 23 | Restores the modification date for all files in the Git or Mercurial repositories of the selected project or repository folder. The modification dates for files that have changed since the most recent commit are NOT updated. 24 | 25 | This tool requires Git for Windows or Mercurial for Windows and some Thor Repository tools. 26 | EndText 27 | .StatusBarText = .Summary 28 | .CanRunAtStartUp = .F. 29 | 30 | * These are used to group and sort tools when they are displayed in menus or the Thor form 31 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 32 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 33 | .Sort = 5 && the sort order for all items from the same Source, Category and Sub-Category 34 | 35 | * For public tools, such as PEM Editor, etc. 36 | .Version = '2016.12.09' && e.g., 'Version 7, May 18, 2011' 37 | .Author = 'Mike Potjer' 38 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 39 | .VideoLink = '' && link to a video for this tool 40 | 41 | .OptionTool = ccToolName 42 | .OptionClasses = "clsGitTimestampFileName, clsHgTimestampFileName" 43 | ENDWITH 44 | 45 | RETURN m.lxParam1 46 | ENDIF 47 | 48 | IF PCOUNT() = 0 49 | DO ToolCode 50 | ELSE 51 | DO ToolCode WITH m.lxParam1 52 | ENDIF 53 | 54 | RETURN 55 | 56 | 57 | **************************************************************** 58 | **************************************************************** 59 | * Normal processing for this tool begins here. 60 | PROCEDURE ToolCode 61 | LPARAMETERS lxParam1 62 | 63 | LOCAL lcRepository, ; 64 | llSuccess, ; 65 | loErrorInfo AS Exception, ; 66 | loGitUtilities AS cusGitUtilities OF Thor_Proc_GitUtilities.PRG, ; 67 | loScope, ; 68 | loScopeForm AS FrmScopeFinder OF "C:\Work\VFP\Shared\Tools\Thor\Tools\Procs\Thor_Proc_ScopeProcessor.vcx" 69 | 70 | llSuccess = .T. 71 | 72 | *-- Get a reference to our Git tools class. 73 | TRY 74 | loGitUtilities = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 75 | 76 | CATCH TO loErrorInfo 77 | llSuccess = .F. 78 | ENDTRY 79 | 80 | *-- Determine what we are processing. 81 | IF m.llSuccess 82 | loScope = m.loGitUtilities.GetProcessScope( m.lxParam1, TOOL_PROMPT ) 83 | IF EMPTY( m.loScope.cScope ) 84 | llSuccess = .F. 85 | loErrorInfo = m.loScope.oException 86 | ENDIF 87 | ENDIF 88 | 89 | *-- Here's where the processing actually occurs. 90 | DO CASE 91 | CASE NOT m.llSuccess 92 | *-- Something failed already, so nothing to do. 93 | 94 | CASE m.loScope.lScopeIsProject 95 | *-- Process a project. 96 | WAIT WINDOW "Restoring timestamps for files in project" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 97 | llSuccess = m.loGitUtilities.RestoreProjectTimestamps( @m.loErrorInfo, m.loScope.cScope ) 98 | 99 | OTHERWISE 100 | *-- Processing a folder. 101 | WAIT WINDOW "Restoring timestamps for files in folder" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 102 | llSuccess = m.loGitUtilities.RestoreRepoTimestamps( @m.loErrorInfo, m.loScope.cScope ) 103 | ENDCASE 104 | 105 | WAIT CLEAR 106 | 107 | *-- Display the results. 108 | DO CASE 109 | CASE m.llSuccess 110 | MESSAGEBOX( "Timestamps successfully updated for" + CHR(13) + m.loScope.cScope, ; 111 | 64, TOOL_PROMPT, 3000 ) 112 | 113 | CASE TYPE( "m.loScope.lUserCancelled" ) = "L" ; 114 | AND m.loScope.lUserCancelled 115 | *-- The process failed because the user cancelled, set a timeout 116 | *-- so the user doesn't have to close the message dialog. 117 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT, 2000 ) 118 | 119 | CASE VARTYPE( m.loGitUtilities ) = "O" 120 | *-- If the Git utilities object is available, use that to report 121 | *-- the error, since it gives you more detail. 122 | lcRepository = .NULL. 123 | IF TYPE( "m.loScope.cScope" ) = "C" ; 124 | AND NOT EMPTY( NVL( m.loScope.cScope, SPACE(0) ) ) ; 125 | AND NOT m.loScope.lScopeIsProject 126 | lcRepository = m.loScope.cScope 127 | ENDIF 128 | 129 | loGitUtilities.ShowError( m.loErrorInfo, m.lcRepository ) 130 | 131 | OTHERWISE 132 | *-- No goodies available, so just report the error message. 133 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 134 | ENDCASE 135 | 136 | *-- Provide a return value that can be used if you call this process 137 | *-- from some other code. 138 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 139 | ENDPROC 140 | 141 | 142 | ********************************************************************* 143 | *-- Option classes 144 | ********************************************************************* 145 | DEFINE CLASS clsGitTimestampFileName AS Custom 146 | Tool = ccToolName 147 | Key = ccKeyGitTimestampFileName 148 | Value = ccInitialValueGitTSFileName 149 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 150 | ENDDEFINE 151 | 152 | DEFINE CLASS clsHgTimestampFileName AS Custom 153 | Tool = ccToolName 154 | Key = ccKeyHgTimestampFileName 155 | Value = ccInitialValueHgTSFileName 156 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 157 | ENDDEFINE 158 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_SaveProjectTimestamps.prg: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #INCLUDE Procs\Thor_Proc_GitUtilities.h 4 | #DEFINE TOOL_PROMPT "Save file timestamps" 5 | 6 | **************************************************************** 7 | **************************************************************** 8 | * Standard prefix for all tools for Thor, allowing this tool to 9 | * tell Thor about itself. 10 | 11 | IF PCOUNT() = 1 ; 12 | AND 'O' = VARTYPE( m.lxParam1 ) ; 13 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 14 | 15 | WITH lxParam1 16 | 17 | * Required 18 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 19 | .Summary = 'Save the timestamps of files belonging to a Git or Mercurial repository' 20 | 21 | * Optional 22 | Text to .Description NoShow && a description for the tool 23 | Saves the modification date for all files in the Git or Mercurial repositories of the selected project or repository folder. If the timestamp file already exists, then only the modification dates for files that have changed since the most recent commit are updated. 24 | 25 | This tool requires Git for Windows or Mercurial for Windows and some Thor Repository tools. 26 | EndText 27 | .StatusBarText = .Summary 28 | .CanRunAtStartUp = .F. 29 | 30 | * These are used to group and sort tools when they are displayed in menus or the Thor form 31 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 32 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 33 | .Sort = 4 && the sort order for all items from the same Source, Category and Sub-Category 34 | 35 | * For public tools, such as PEM Editor, etc. 36 | .Version = '2016.12.09' && e.g., 'Version 7, May 18, 2011' 37 | .Author = 'Mike Potjer' 38 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 39 | .VideoLink = '' && link to a video for this tool 40 | 41 | .OptionTool = ccToolName 42 | .OptionClasses = "clsGitTimestampFileName, clsHgTimestampFileName" 43 | ENDWITH 44 | 45 | RETURN m.lxParam1 46 | ENDIF 47 | 48 | IF PCOUNT() = 0 49 | DO ToolCode 50 | ELSE 51 | DO ToolCode WITH m.lxParam1 52 | ENDIF 53 | 54 | RETURN 55 | 56 | 57 | **************************************************************** 58 | **************************************************************** 59 | * Normal processing for this tool begins here. 60 | PROCEDURE ToolCode 61 | LPARAMETERS lxParam1 62 | 63 | LOCAL lcRepository, ; 64 | llSuccess, ; 65 | loErrorInfo AS Exception, ; 66 | loGitUtilities AS cusGitUtilities OF Thor_Proc_GitUtilities.PRG, ; 67 | loScope, ; 68 | loScopeForm AS FrmScopeFinder OF "C:\Work\VFP\Shared\Tools\Thor\Tools\Procs\Thor_Proc_ScopeProcessor.vcx" 69 | 70 | llSuccess = .T. 71 | 72 | *-- Get a reference to our Git tools class. 73 | TRY 74 | loGitUtilities = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 75 | 76 | CATCH TO loErrorInfo 77 | llSuccess = .F. 78 | ENDTRY 79 | 80 | *-- Determine what we are processing. 81 | IF m.llSuccess 82 | loScope = m.loGitUtilities.GetProcessScope( m.lxParam1, TOOL_PROMPT ) 83 | IF EMPTY( m.loScope.cScope ) 84 | llSuccess = .F. 85 | loErrorInfo = m.loScope.oException 86 | ENDIF 87 | ENDIF 88 | 89 | *-- Here's where the processing actually occurs. 90 | DO CASE 91 | CASE NOT m.llSuccess 92 | *-- Something failed already, so nothing to do. 93 | 94 | CASE m.loScope.lScopeIsProject 95 | *-- Process a project. 96 | WAIT WINDOW "Saving timestamps for files in project" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 97 | llSuccess = m.loGitUtilities.SaveProjectTimestampFiles( @m.loErrorInfo, m.loScope.cScope ) 98 | 99 | OTHERWISE 100 | *-- Processing a folder. 101 | WAIT WINDOW "Saving timestamps for files in folder" + CHR(13) + m.loScope.cScope NOWAIT NOCLEAR 102 | llSuccess = m.loGitUtilities.SaveRepoTimestampFile( @m.loErrorInfo, m.loScope.cScope ) 103 | ENDCASE 104 | 105 | WAIT CLEAR 106 | 107 | *-- Display the results. 108 | DO CASE 109 | CASE m.llSuccess 110 | MESSAGEBOX( "Timestamps successfully saved for" + CHR(13) + m.loScope.cScope, 64, ; 111 | TOOL_PROMPT, 3000 ) 112 | 113 | CASE TYPE( "m.loScope.lUserCancelled" ) = "L" ; 114 | AND m.loScope.lUserCancelled 115 | *-- The process failed because the user cancelled, set a timeout 116 | *-- so the user doesn't have to close the message dialog. 117 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT, 2000 ) 118 | 119 | CASE VARTYPE( m.loGitUtilities ) = "O" 120 | *-- If the Git utilities object is available, use that to report 121 | *-- the error, since it gives you more detail. 122 | lcRepository = .NULL. 123 | IF TYPE( "m.loScope.cScope" ) = "C" ; 124 | AND NOT EMPTY( NVL( m.loScope.cScope, SPACE(0) ) ) ; 125 | AND NOT m.loScope.lScopeIsProject 126 | lcRepository = m.loScope.cScope 127 | ENDIF 128 | 129 | loGitUtilities.ShowError( m.loErrorInfo, m.lcRepository ) 130 | 131 | OTHERWISE 132 | *-- No goodies available, so just report the error message. 133 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 134 | ENDCASE 135 | 136 | *-- Provide a return value that can be used if you call this process 137 | *-- from some other code. 138 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 139 | ENDPROC 140 | 141 | 142 | ********************************************************************* 143 | *-- Option classes 144 | ********************************************************************* 145 | DEFINE CLASS clsGitTimestampFileName AS Custom 146 | Tool = ccToolName 147 | Key = ccKeyGitTimestampFileName 148 | Value = ccInitialValueGitTSFileName 149 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 150 | ENDDEFINE 151 | 152 | DEFINE CLASS clsHgTimestampFileName AS Custom 153 | Tool = ccToolName 154 | Key = ccKeyHgTimestampFileName 155 | Value = ccInitialValueHgTSFileName 156 | EditClassName = [ccEditClassName of Thor_Proc_GitUtilities.PRG] 157 | ENDDEFINE 158 | -------------------------------------------------------------------------------- /Thor_Tool_GitUtilities_ShowReposInProject.prg: -------------------------------------------------------------------------------- 1 | LPARAMETERS lxParam1 2 | 3 | #DEFINE TOOL_PROMPT "Show Git-Hg repos in project" 4 | 5 | **************************************************************** 6 | **************************************************************** 7 | * Standard prefix for all tools for Thor, allowing this tool to 8 | * tell Thor about itself. 9 | 10 | IF PCOUNT() = 1 ; 11 | AND 'O' = VARTYPE( m.lxParam1 ) ; 12 | AND 'thorinfo' = LOWER( m.lxParam1.Class ) 13 | 14 | WITH lxParam1 15 | 16 | * Required 17 | .Prompt = TOOL_PROMPT && used when tool appears in a menu 18 | .Summary = 'Display a cursor of all the Git or Mercurial repositories in a VFP project' 19 | 20 | * Optional 21 | Text to .Description NoShow && a description for the tool 22 | Populates a cursor with a list of all the Git or Mercurial repositories containing files from the selected project, and the branch currently checked out for each repo. Prompts for a project if no project is open, otherwise processes the active project. 23 | 24 | This tool requires Git for Windows or Mercurial for Windows and some Thor Repository tools. 25 | EndText 26 | .StatusBarText = .Summary 27 | .CanRunAtStartUp = .F. 28 | 29 | * These are used to group and sort tools when they are displayed in menus or the Thor form 30 | .Source = 'MJP' && where did this tool come from? Your own initials, for instance 31 | .Category = 'Applications|Git-Hg Utilities' && allows categorization for tools with the same source 32 | .Sort = 3 && the sort order for all items from the same Source, Category and Sub-Category 33 | 34 | * For public tools, such as PEM Editor, etc. 35 | .Version = '2016.06.24' && e.g., 'Version 7, May 18, 2011' 36 | .Author = 'Mike Potjer' 37 | .Link = 'https://github.com/mikepotjer/vfp-git-utils' && link to a page for this tool 38 | .VideoLink = '' && link to a video for this tool 39 | 40 | ENDWITH 41 | 42 | RETURN m.lxParam1 43 | ENDIF 44 | 45 | IF PCOUNT() = 0 46 | DO ToolCode 47 | ELSE 48 | DO ToolCode WITH m.lxParam1 49 | ENDIF 50 | 51 | RETURN 52 | 53 | 54 | **************************************************************** 55 | **************************************************************** 56 | * Normal processing for this tool begins here. 57 | PROCEDURE ToolCode 58 | LPARAMETERS lxParam1 59 | 60 | LOCAL llSuccess, ; 61 | loErrorInfo AS Exception, ; 62 | loGitUtilities AS cusGitUtilities OF Thor_Proc_GitUtilities.PRG, ; 63 | lcProjectName, ; 64 | lcAlias 65 | 66 | llSuccess = .T. 67 | 68 | *-- Get a reference to our Git tools class. 69 | TRY 70 | loGitUtilities = EXECSCRIPT( _Screen.cThorDispatcher, "Thor_Proc_GitUtilities" ) 71 | 72 | CATCH TO loErrorInfo 73 | llSuccess = .F. 74 | ENDTRY 75 | 76 | IF m.llSuccess 77 | *-- Validate the passed parameter. If it's a valid project, it 78 | *-- will be used, otherwise the project will be determined based 79 | *-- on the rules in this method. 80 | lcProjectName = m.loGitUtilities.GetProjectName( @m.loErrorInfo, m.lxParam1 ) 81 | llSuccess = NOT EMPTY( m.lcProjectName ) 82 | ENDIF 83 | 84 | IF m.llSuccess 85 | *-- Use the project name in the alias name for the cursor, then 86 | *-- attempt to retrieve the list of repositories. 87 | lcAlias = "Repositories_For_" + JUSTSTEM( m.lcProjectName ) + "_PJX" 88 | llSuccess = m.loGitUtilities.FetchReposInProject( @m.loErrorInfo, m.lcProjectName, m.lcAlias ) 89 | ENDIF 90 | 91 | *-- Display the results. 92 | IF m.llSuccess 93 | SELECT ( m.lcAlias ) 94 | BROWSE LAST NOCAPTIONS NODELETE NOEDIT NOWAIT 95 | ELSE 96 | MESSAGEBOX( m.loErrorInfo.Message, 16, TOOL_PROMPT ) 97 | ENDIF 98 | 99 | *-- Provide a return value that can be used if you call this process 100 | *-- from some other code. 101 | RETURN EXECSCRIPT( _Screen.cThorDispatcher, "Result=", m.llSuccess ) 102 | ENDPROC 103 | --------------------------------------------------------------------------------