SRCFRMGIT - Import Member From Git Repo Directory

<< Click to Display Table of Contents >>

Navigation:  IBM i Git Source Commands >

SRCFRMGIT - Import Member From Git Repo Directory

Description

This CL command is used to commit/sync any uncommitted IFS file changes in the Git repository and then import file from IFS repository to source member for editing. Can also be used for simple source import as well with *NOCOMMIT options.

 

Warning: This command should be only be called before editing and saving a source member if you want to get a copy of the latest source from your git repository. In some cases you may want to always get the most recent version of a source member from the local or remote Git repository before editing. But 99% of the time you won't use this command at all because the source physical files are considered the master location for classic IBM i source. BE CAREFUL so you don't accidentally destroy changes that have been made in a source physical file by calling this option before issuing a commit with the GE option first.

 

Note: When you need to restore a specific commit hashed version of a source member, SRCGITCMD is a better option than SRCFRMGIT. SRCFRMGIT only restores the most recent version.

 

Most often this command may be called via the PDM user defined option GI if it's going to be used. (Just be aware of the warnings above.)

 

Command Example to perform git sync

SRCFRMGIT IFSREPODIR(*IFSFILEPARENT)   

                   FROMIFSFIL(*LIBFILEPATH)     

                   SRCFILE(*SRCHDR/*SRCHDR)     

                   SRCMBR(*SRCHDR)                      

                   SRCTYPE(*SRCHDR)             

                   SRCHEADER(*YES)              

                   SRCDATSEQ(*NO)               

                   REPLACE(*YES)                

                   EDITOPT(*NONE)               

                   VALIDREPO(*YES)              

                   COMMITOPT(*COMMIT)           

                   COMMENT(*DATEUSER)                                               

 

Parameters

 

IFSREPODIR - Source git repository IFS directory to perform selected actions for. Default: *IFSFILEPARENT

 

Options

Specific IFS path - If you have a specific git repository directory you want to use, enter it. Example repo name: /gitrepos/lib001

 

*IFSFILEPARENT - Parse out the parent directory from the IFS file path entered in the FROMIFSFIL parameter.  Ex: /gitrepos/qgpl/qclsrc/test.clp will parse out /gitrepos/qgpl as the library parent directory for the repository. 

 

*LIBFILEPATH - Create a top level git repository directory path 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.

 

*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.

 

 

FROMIFSFIL - Specific IFS file to import. Enter a specific IFS file name to import or one of the following values. Default: *LIBFILEPATH

 

Options

Specific IFS file import. Generally in the format of /gitrepos/library/file/member.rpgle

 

*LIBFILEPATH  - IFS file name will get built up from the selected IFS repo directory + source file name (SRCFILE parm if entered) + member name (SRCMEMBER parm if entered).sourcetype (SRCTYPE if entered). Example: /gitrepos/library/qrpglesrc/member.rpgle    
 

Note: *SRCHDR for SRCFILE, SRCMEMBER or SRCTYPE will not work when deriving IFS file name using *LIBFILEPATH because we don't have an actual IFS file yet because we need to derive the IFS file name from source library, file, member and source type.

 

*NONE or blank file name - This is not a valid option. Command will exit with error.

 

 

SRCFILE - Destination source file and library name for member to import. Default: *SRCHDR/*SRCHDR

 

Options

Enter actual source file and library if known. Typically with RDI or SEU the library and file values can be determined using a substitution keyword. When specifying a specific IFS file name in FROMIFSFIL, then *SRCHDR will be useful to extract source library, file, member and source type from the IFS file source information header.

 

*SRCHDR - Get source library and file info from the IFS file source information header. Note: Does not work if FROMIFSFIL is *LIBFILEPATH

.

 

SRCMBR - Destination source member to import. Default: *SRCHDR.

 

Options

Enter actual source file member if known. Typically with RDI or SEU the member value can be determined using a substitution keyword. When specifying a specific IFS file name in FROMIFSFIL, then *SRCHDR will be useful to extract source library, file, member and source type from the IFS file source information header.

 

*SRCHDR - Get source member from the IFS file source information header. Note: Does not work if FROMIFSFIL is *LIBFILEPATH

 

 

SRCTYPE - Destination source type. Default: *SRCHDR.

 

Options

Enter actual source file type if known. Typically with RDI or SEU the member value can be determined using a substitution keyword. When specifying a specific IFS file name in FROMIFSFIL, then *SRCHDR will be useful to extract source library, file, member and source type from the IFS file source information header.

 

*SRCHDR - Get source type from the IFS file source information header. Note: Does not work if FROMIFSFIL is *LIBFILEPATH

 

 

SRCHEADER - Use source info header from the top of each source member during import. Default: *YES

 

Options

*NO - This currently has no effect. Same as *YES. (We always attempt to look for and extract source information header data.)

 

*YES - Extract info from source information header during import.

 

 

SRCDATSEQ - Import member with source dates and sequence numbers during source import from IFS. Default: *NO

 

Options

*NO - Source member does not include source dates and sequences for use with SEU or RDI. For modern development shops.

 

*YES - Source member does include source dates and sequences for use with SEU or RDI. For classic development shops.

 

 

REPLACE - Replace existing source member if one exists. Default: *YES.

 

Options

*NO - Do not replace existing source member in selected source file.

 

*YES - Replace existing source member in selected source file.

 

 

EDITOPT - Display or edit source after import

 

Options

*NONE - No editing of the imported source member.

 
*DSP - Display source member with STRSEU after import.

 
*EDIT - Edit source member with STRSEU after import.

 

 

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.

 

 

COMMITOPT - Commit IFS changes before source member import from IFS. Default: *COMMIT

 

Options

*COMMIT - Commit IFS file to local repository in IFS. Use this if you are leaving all git changes in the IFS or plan to push them to a remote repository later. This is the default option.
 

*COMMITSYNC - Commit IFS file 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 - Commit IFS file 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 importing source member from the IFS with no intent to commit any changes to git immediately.

 

 

COMMENT - Commit comment. Default: *DATEUSER

 

Enter a commit comment or special value.

 

*DATEUSER - Write date info and user ID into commit comment automatically.