It's all about the answers!

Ask a question

GIT and RTC integration via scm command line


EclipseTalk . (32736161) | asked Sep 12 '13, 10:50 a.m.
 Hello,
We're looking at integrating GIT repositories into RTC SCM. We need to create an automation that would access the .git directories and store them into RTC on a daily base.
Is there any sample code on how to use the scm command line to achieve what we need? How would scm handle the daily code changes?
Thank you in advance for any pointers.

Comments
Geoffrey Clemm commented Sep 16 '13, 4:58 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Just for interest's sake, why would you store a GIT repository inside of an RTC SCM repository?  


EclipseTalk . commented Sep 17 '13, 1:02 p.m.

That's a good question and I don't quite agree but it's a customer requirement...


Geoffrey Clemm commented Sep 17 '13, 11:13 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If the customer cannot explain to you why they are doing it, there's a good chance that doing so will not achieve whatever result they are hoping to achieve.  For example, if they are looking for some kind of integration between RTC-SCM and GIT, this is unlikely to achieve it.  Or if they are looking for some mechanism to back-up their GIT repositories, this wouldn't be a good way to do so.


EclipseTalk . commented Sep 18 '13, 8:40 a.m. | edited Sep 18 '13, 8:54 a.m.

I totally agree with you Geoffrey; any recommendations?

Thanks

Accepted answer


permanent link
Kiran M N (3262) | answered Sep 16 '13, 7:09 a.m.
JAZZ DEVELOPER
 Hi EclipseTalk,

From what you have described, I believe you need to maintain the git objects (i.e., the ".git" directory) of a Git Repository in RTC SCM. If that is the case, you can try the following:
1. Create (or clone) a Git Repository inside a RTC SCM Sandbox, and share it into a Stream (component).
2. If you intend to store only the objects, then ignore the other files and folders apart from ".git" using the RTC client. It generates a .jazzignore file, check in the same. This makes sure that only the ".git" repository and its contents are being tracked by RTC SCM.
If the Git Repository in question is a bare repository or a mirror, then this may not be needed.
3. Now deliver the change-set containing the objects and references in the ".git" folder. The .git repository is now shared with RTC SCM.
Sharing the (bare) Git Repository with RTC SCM
Lets say that there are more commits pushed / created into this repository. Now, when you open an RTC client, and set to the same sandbox (as done above), it can detect that there are new changes to the ".git" directory, and is shown in the Pending Changes, and can be delivered to RTC Stream.
New Commits in the Git Repository

You may want to do this often.

As to whether you can do it via the SCM command line - yes, it should be possible, since from the RTC SCM CLI's perspective, the git repository is yet another folder, which can be tracked, checked in and delivered.
(See SCM CLI commands: scm refresh, scm status, scm checkin, scm deliver commands).

EclipseTalk . selected this answer as the correct answer

Comments
EclipseTalk . commented Sep 16 '13, 8:57 a.m. | edited Sep 16 '13, 8:58 a.m.

Thank you for the detailed explanation! 


Kiran M N commented Sep 18 '13, 8:51 a.m.
JAZZ DEVELOPER

 One clarification is in order: The above solution does not help with Migration or Synchronization scenarios. But, only for backing up the git repository inside RTC SCM.

One other answer



permanent link
Krzysztof Kaźmierczyk (7.5k480103) | answered Sep 12 '13, 12:41 p.m.
Hi,
It answers on a bit different question, however there is GIT adapter for RTC: https://jazz.net/library/article/854/

Let us know if it helps you as well.

Comments
Geoffrey Clemm commented Sep 12 '13, 7:47 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I don't think the current GIT adapter for RTC is relevant for this question ... it links GIT commits to RTC work items, but doesn't do any import of the actual GIT commits into the RTC SCM system.


EclipseTalk . commented Sep 13 '13, 8:39 a.m.

That's correct we're not looking for an adapter 

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.