<< Click to Display Table of Contents >> Navigation: IBM i Git Source Commands > STRSEUGIT - Start Source Entry - iForGIt |
Description
This CL command is used to edit a standard source member from a source file using the SEU command to edit and Git to automatically version control the source member before and after editing.
STRSEUGIT is good for developers who want to have version control be a relatively invisible part of their work day.
The general SEU edit, version control flow goes like this:
•Call STRSEUGIT command to browse or edit source member
•When STRSEUGIT gets called a Git sync or commit is auto-performed to make sure source member is up to date with local and remote repository (if using remote repository server).
•SEU is called to edit or browser the source member.
•Upon exit of SEU editing or browsing, the Git sync or commit sequence is auto-performed again to save changes to the local Git IFS repository directory and remote git server if connected to the repository.
This edit and version control workflow should result in a seamless editing process for IBM i developers who want to still use SEU for editing and automatically make backup copies of their source members in a Git repository after editing. This is about as close to the classic editing experience as you can get.
Tip: I recommend not using the STRSEUGIT command. Instead I recommend getting comfortable with using the GE and GI PDM options to commit or pull git changes before and after editing if developers plan to continue using SEU. They can continue to use SEU option 2 and 5 for editing instead of using the STRSEUGIT CL command.
Command Example to perform git sync
STRSEUGIT SRCFILE(SRCLIB/SRCFILE)
SRCMBR(SRCMEMBER)
TYPE(RPGLE)
OPTION('2')
TEXT(*BLANK)
IFSREPODIR(*LIBREPODTAARA)
SRCHEADER(*YES)
SRCDATSEQ(*NO)
VALIDREPO(*YES)
IFSMKDIR(*YES)
COMMITBEF(*COMMIT)
COMMENTBEF(*DATEUSER)
COMMITAFT(*COMMIT)
COMMENTAFT(*DATEUSER)
Parameters
SRCFILE - Source file and library name for member to edit or create. Specify *PRV to use most recent source library and file
SRCMBR - Source member name to edit or create. Specify *PRV to edit most recent source member.
SRCTYPE - Source type. Specify *PRV to use last source type.
OPTION - Specify SEU edit option to use.
Options
2 - Edit
5 - Browse
TEXT - Specify source member text. Mainly for new members. Default: *BLANK
IFSREPODIR - Destination git repository IFS directory. Use this command along with IFSMKDIR-*YES to auto-create any repository directories. Default: *LIBREPODTAARA
Options
Specific IFS path - If you have a specific git repository directory you want to use, enter it. Example repo name: /gitrepos/lib001
*LIBREPODTAARA - If you have created and set the 255 character GITREPODIR data area with a valid repo IFS path you want to use for this library, then the repo set in GITREPODIR will be used as long as it's not blanks.
*LIBFILEPATH - Create a top level git repository based on a prefix of GIT_ combined with the library name. Example repo name: /GIT_QGPL
*CURRENTREPO - If you are setting the CURGITREPO data area in QTEMP via the SETCURREPO command, then you can use this option. Git repo name used will be whatever you set in CURGITREPO as long as it's not blanks.
SRCHEADER - Include source info header at the top of each source member during export. Default: *YES
Options
*NO - Do not write source header info during export. Only use this if you don't plan to import source members again or don't need to maintain source type and text in standard source files.
*YES - Write source header info during export. This option should normally be set to *YES because the header info is needed during import of source members to maintain the appropriate source type and text when a member is imported.
SRCDATSEQ - Include source dates and sequence numbers during source export to IFS. Default: *NO
Options
*NO - Do not include source dates and sequences. Use this option if you are comfortable not having source date and sequence info in your source member. Most modern developers rely on source code diffs rather than dates info and line numbers to compare source member for changes. Your team needs to be emotionally ready for eliminating source dates and sequences
Note: Eliminating source dates and line sequences will be a cultural decision for your development team to make. Generally we recommend the *NO option for NOT maintaining source lines and dates, which allows IFS source members to be edited from the IFS or a PC with any source editor including notepad, notepad++, vscode and more.
*YES - Write source dates and sequences for each line. This option should normally be set to *YES only if you are using RDI and want to maintain line dates and sequences or you are using SEU and want to maintain line dates and sequences.
Note: If your shop is not culturally ready to make the change and get rid of source dates and line numbers, this option can be used when exporting source members.
VALIDREPO - Check if IFS directory is a valid git repository. Default: *YES
*NO - Do not check if IFS directory is already a valid repository before exporting. Use this if simply exporting to the IFS and there is no git repository required.
*YES - Check if IFS directory is already a valid repository before exporting. Use this if the IFS directory needs to be a valid git repository for version control.
IFSMKDIR - Create IFS directory and git repository. Default: *YES
*NO - Do not create IFS repository directory paths automatically.
*YES - Create IFS repository directory paths automatically.
COMMITBEF - Commit changes before before source member import/edit. Default: *COMMIT
Options
*COMMIT - Export source member to local git repository directory and commit to local repository in IFS. Use this if you are leaving git changes in the IFS or plan to push them to a remote repository later. This is the default option.
*COMMITSYNC - Export source member to local git repository directory and commit to local repository in IFS. Then pull and merge any remote changes and push them back to the repository. Use this option normally for a full git edit and version life-cycle where the local copies stay in sync with the remote repository at all times.
*COMMITPUSH - Export source member to local git repository directory and commit to local repository in IFS. Then push changes to remote repository. This option only pushes changes, but does not pull and merge remote changes with the local repository.
*NOCOMMIT - Use this option if just simply exporting source member with no intent to commit to git immediately.
COMMENTBEF - Commit comment before import/edit. Default: *DATEUSER
Enter a commit comment or special value.
*DATEUSER - Write date info and user ID into commit comment automatically.
COMMITAFT - Commit changes after edit/export to IFS. Default: *COMMIT
Options
*COMMIT - Export source member to local git repository directory and commit to local repository in IFS. Use this if you are leaving git changes in the IFS or plan to push them to a remote repository later. This is the default option.
*COMMITSYNC - Export source member to local git repository directory and commit to local repository in IFS. Then pull and merge any remote changes and push them back to the repository. Use this option normally for a full git edit and version life-cycle where the local copies stay in sync with the remote repository at all times.
*COMMITPUSH - Export source member to local git repository directory and commit to local repository in IFS. Then push changes to remote repository. This option only pushes changes, but does not pull and merge remote changes with the local repository.
*GITADD - Export source member to local git repository directory and add/stage to the commit list in local IFS repository. Use this if you want to stage a file for a future commit that will happen later. Good for staging multiple files for a single commit later by the GITCMD CL command with a commit option. Example commit: GITCMD CMDOPTS('-commit -m "My Commit of Many Staged Files')
*NOCOMMIT - Use this option if just simply exporting source member with no intent to commit to git immediately.
COMMENTAFT - Commit comment after edit/export. Default: *DATEUSER
Enter a commit comment or special value.
*DATEUSER - Write date info and user ID into commit comment automatically.