Creating RDi User Action Options for Git and Source Files

<< Click to Display Table of Contents >>

Navigation:  Hooking Up to PDM and RDi  >

Creating RDi User Action Options for Git and Source Files

If you are a Rational Developer for i (RDi) user, you have possibly tried using iProjects or other methods to manage your source code and found them painful at best. By creating User Actions in RDi, you can have the same PDM-like functionality that PDM users enjoy from the RDi Remote Systems Explorer instead of trying to use iProjects or other miscellaneous source editing and version control methods.

 

The RDi strategy for using existing source files would typically be to maintain your source in place in the source files and edit via RDi by opening and editing source members directly. After editing the goal would be to easily commit source member changes using the source control of git to get out of the habit of having to make source member copies when making changes, which leaves old versions of source members all over the place.

 

Using Git, source members and versions can simply be stored in a local shared IFS repository directory or they can be pushed to a remote git server (like Github or Bitbucket) if you have one established.

 

Getting Started with RDi and Git

The first thing you need to do is bring up a list of source members in RDi

 

Right-click on any source member and select User Actions/Work with User Actions.

 

Then under New, select Member action.

 

clip00001

 

 

Commit Source Member to Git Repo-SRCTOGIT - Use the SRCTOGIT CL command to export and perform local commit to the IFS. Always perform this user action to commit a copy of a source member changes to git.

 

Action type: Member action

Action name: Commit Source Member to Git Repo-SRCTOGIT

Comment: Export source to git repository

Command: Normal command

Command entry: IFORGIT/SRCTOGIT SRCFILE(&L/&F) SRCMBR(&N) IFSREPODIR(*LIBREPODTAARA) SRCHEADER(*YES) SRCDATSEQ(*NO) REPLACE(*YES) EDITOPT(*NONE) VALIDREPO(*YES) IFSMKDIR(*YES) INITREPO(*YES) COMMITOPT(*COMMIT) COMMENT(*DATEUSER)

Prompt first: Check this box so command will prompt (Optional but good for testing.)

Show action: Check this box.

Defined types: ALL

Selected types: ALL

 

 

Get Most Recent Source Member from Git-SRCFRMGIT - Use the SRCFRMGIT CL command to pull and import a file version from the local IFS repository directory. Always perform this user action to read most recent version from your local git repository.

 

Action type: Member action

Action name: Get Most Recent Source Member from Git-SRCFRMGIT

Comment: Import source from git repository

Command: Normal command

Command entry: IFORGIT/SRCFRMGIT IFSREPODIR(*LIBREPODTAARA) SRCFILE(&L/&F) SRCMBR(&N) SRCTYPE(&T) SRCHEADER(*YES) SRCDATSEQ(*NO) REPLACE(*YES) EDITOPT(*NONE) VALIDREPO(*YES) COMMITOPT(*COMMIT) COMMENT(*DATEUSER)

Prompt first: Check this box so command will prompt (Optional but good for testing.)

Show action: Check this box.

Defined types: ALL

Selected types: ALL

 

 

Granular git member processing

If you need more granular git repository processing such as diff-ing file versions then you will want to use a PC, Mac or LInux based git client such as Tortoise, SourceTree or some other git client to review changes in the event an old member needs to be pulled from your repository and restored. The general process for restoring an old version of a file would be to get a copy of it from the repository and place in the local IFS repo directory. After you have a copy in the repo work directory you should commit the file with GITCMD or use the SRCFRMGIT command with the *COMMIT option to commit and pull the source member back to a source file for editing or other processing.