SRCGITCMD - Run Git Command Against Repo Member

<< Click to Display Table of Contents >>

Navigation:  IBM i Git Source Commands >

SRCGITCMD - Run Git Command Against Repo Member

Description

This CL command can be used to view change history or check out old versions of a source member to a source physical file for viewing/editing from a 5250 session. 

 

The SRCGITCMD command can be used to view logs  or check out old versions of a source member using the command itself in a process or interactively as a PDM option or RDI user action.

 

Note: When SRCGITCMD is used with the *CHECKOUT option, this can be a good alternative to using the SRCFRMGIT command. SRCGITCMD is more robust in allowing the restore of any git repo member version based on its source hash, while SRCFRMGIT only restores the most recent version.

 

Under the covers SRCGITCMD options are using the following git actions to:

 

Perform a git log command to see how many times a member has been committed and determine the git commit hash for checking out the member from your git repository.  

 

Perform a git blame command to display/show a consolidated view of the selected source member commits to determine what older version you may want to view or restore.

 

Perform a git diff command for a selected hash to see what has changed.  

 

Perform a git show command for a selected hash to show that version of the source member.  

 

Perform a git checkout command to check out a copy of a selected older version of a source member to a selected source physical file for viewing or working with it via PDM or RDI.  

 

Command Example to perform git command:

SRCGITCMD SRCFILE(SRCLIB/SRCFILE)         

          SRCMBR(SRCMEMBER)               

          IFSREPODIR(*LIBREPODTAARA)

          SRCOPTION(*BLAME)         

          SRCHASH(*MOSTRECENT)      

          DEBUGQSH(*NO)             

          DSPSTDOUT(*YES)           

          LOGSTDOUT(*NO)            

          PRTSTDOUT(*NO)            

          DLTSTDOUT(*YES)           

          DSPCHKOUT(*NONE)          

          DESTFILE(TMPSOURCE)       

          DESTMBR(TMPSOURCE2)       

          DESTOPT(*NONE)             

 

 

Parameters

 

SRCFILE - The selected source physical file to work with via the associated iForGit git repository.

 

SRCMBR - The selected source member to work with via the associated iForGit git repository..

 

IFSREPODIR - The destination git repo IFS directory. This directory contains the path to the library's git directory associated with the library. Default - *LIBREPODTAARA points to the GITREPODIR data aree in the source library specified on the SRCFILE parameter.

 

SRCOPTION - This is the git option to perform on the selected source member.

 

*BLAME - This option displays the entire source member change history in a consolidated view along with the short commit hash value and author name. This is good for getting a quick look at the commit history for a source member and knowing who performed each commit.

 

*BLAMELONG - This option displays the entire source member change history in a consolidated view along with the full commit hash value and author name. This is good for getting a quick look at the commit history for a source member and knowing who performed each commit.

 

*SHOW - This option displays the entire source file contents for a specific commit level. You must specify a member commit hash value or *MOSTRECENT in the SRCHASH parameter to show the most recent version file version.

 

*DIFF - This option does a diff based on the most recent version compared with the selected hash version. You must specify a member commit hash value or *MOSTRECENT in the SRCHASH parameter to show the most recent version file version.

 

*LOG - Display the commit log along with the commit hash values for each commit of the source member. The following log values are displayed: commit hash, author info who performed the commit, commit date/time and comment. The full commit hash or the first 8 characters of the hash can be copied for use with the *SHOW, *DIFF and *CHECKOUT options.

 

*CHECKOUT - use this option to check out a source member version based on its commit hash value. *CHECKOUT - Check out a selected commit version of a source member. You must specify a member commit hash value or blanks to check out most recent version in the SRCHASH parameter. The selected git version source file will get automatically populated into the following source member in library QTEMP for each user: QTEMP/TMPSOURCE. Member: TMPSOURCE

 

SRCHASH - Source version hash to check out, view of compare. Use *BLAME or *LOG to determine available hash versions. Or you can use any of the git command options in PASE/SSH if you like to use the git command to determine the hash version for a commit or source member.

 

DEBUGQSSH - Prompt GITQSH command to see the full git command line that gets generated. Only use this option interacively from a 5250 session for debugging purposes. Default=*NO

 

DSPSTDOUT - Display the outfile contents. Nice when debugging. Default=*NO

 

LOGSTDOUT - Place STDOUT log entries into the current jobs job log. Use this if you want the log info in the IBM i joblog. All STDOUT entries are written as CPF message: QSS9898. Default=*NO

 

PRTSTDOUT - Print STDOUT to a spool file. Use this if you want a spool file of the log output. Default=*NO

 

DLTSTDOUT - This option insures that the STDOUT IFS temp files get cleaned up after processing. All IFS log files get created in the /tmp/qsh directory. Default=*YES

 

DSPCHKOUT - Display checked out source member once checkout is complete if the SRCOPTION-*CHECKOUT is used to check out a git repo member. Default=*NONE

 

*NONE - Don't display the checked out source member after checkout when *CHECKOUT is used for the SRCOPTION parameter. Just check out and create the selected source member, but don't view it.

 

*BROWSE - Open the source member for browsing via the SEU editor. If *NONE is specified for the DESTOPT parameter, the member created in QTEMP/TMPSOURCE named: TEMPSOURCE will be viewed immediately after checkout. If *ADD/REPLACE is selected, the member specified in the DESTFILE/DESTMBR parameter will be used.

 

*EDIT - Launch the source member for editing via the SEU editor. If *NONE is specified for the DESTOPT parameter, the member created in QTEMP/TMPSOURCE named: TEMPSOURCE will be edited. If *ADD/REPLACE is selected, the member specified in the DESTFILE/DESTMBR parameter will be used.

 

*PDM - Perform a WRKMBRPDM command on the source member so it gets listed in PDM. Then PDM actions can be performed on the source member. If *NONE is specified for the DESTOPT parameter, the member created in QTEMP/TMPSOURCE named: TEMPSOURCE will be listed via WRKPBMPDM. If *ADD/REPLACE is selected, the member specified in the DESTFILE/DESTMBR parameter will be used.

 

DESTFILE - Checkout to destination source file. This is source file the checked out git member placed in after it has been checked out from the git repository if DESTOPT-*ADD/*REPLACE is selected. If DESTOPT - *NONE is specified, the source member only gets checked out to temporary file QTEMP/TMPSOURCE name TMPSOURCE. *NONE insures that only temporary members are generated in library QTEMP and not persisted outside of library QTEMP.

Default: QTEMP/TMPSOURCE

 

This option is useful if you want to persist a checked out source member in a source library for comparison or other purposes.

 

DESTMBR - The source member name the checked out git member gets placed in to if DESTOPT-*ADD/*REPLACE is selected. Default - TMPSOURCE2

 

DESTOPT - Add or replace member records in the destination source file member. Default - *NONE

 

*NONE - The source member only gets checked out to temporary file QTEMP/TMPSOURCE with member name TMPSOURCE. *NONE insures that only temporary members are generated in library QTEMP and not persisted outside of library QTEMP.

 

*ADD - If *ADD is specified, the source member gets auto-created in QTEMP/TMPSOURCE but then gets copied/persisted to the source file specified in the DESTFILE/DESTMBR option and records are added during the source copy. This allows a single destination source member to receive the contents of multiple versions of a git source member if desired.

 

*REPLACE - If *REPLACE is specified, the source member gets auto-created in QTEMP/TMPSOURCE but then gets copied/persisted to the source file specified in the DESTFILE/DESTMBR option and records are replaced during the source copy. This allows a single destination source member to receive the contents of a single git source member.