forked from charleso/git-cc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
129 lines (92 loc) · 4.37 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
git-cc
======
Simple bridge between base Clearcase or UCM and Git.
Warning
=======
I wrote this purely for fun and to see if I could stop use Clearcase at work
once and for all.
I will probably continue to hack away at it to suite my needs, but I would
love to see it get some real-world polish. (Actually what I would love to see
more is for Clearcase to die, but don't think that's going to happen any time
soon).
Suggestions on anything I've done are more than welcome.
Also, I have made a change recently to support adding binary files which uses
git-cat. Unfortunately git-cat doesn't handle end line conversions and so I
have made gitcc init set core.autocrlf to false. This is only relevant for
Windows users. Don't try changing this after your first commit either as it
will only make matters worse. My apologies to anyone that is stung by this.
Workflow
========
Initialise:
gitcc init d:/view/xyz
gitcc rebase
# Get coffee
# Do some work
git add .
git commit -m "I don't actually drink coffee"
gitcc rebase
gitcc checkin
Initialise (fast):
Rebase can be quite slow initially, and if you just want to get a snapshot of
Clearcase, without the history, then this is for you:
gitcc init d:/view/xyz
gitcc update "Initial commit"
Other:
These are two useful flags for rebase which is use quite frequently.
gitcc rebase --stash
Runs stash before the rebase, and pops it back on afterwards.
gitcc rebase --dry-run
Prints out the list of commits and modified files that are pending in clearcase.
Configuration
=============
You need to add a mapping for each user in your clearcase history to users.py.
You can also limit which branches and folders you import from.
eg. .git/gitcc
[gitcc]
clearcase = D:\views\co4222_flex\rd_poc
include = FolderA|FolderB
branches = main|ji_dev|ji_*_dev|iteration_*_dev
debug = False
I would have put this in the .git/config file except python didn't seems to like
reading it.
Notes
=====
Can either work with static or dynamic views. I use dynamic at work because
it's much faster not having to update. I've done an update in rebase anyway,
just-in-case someone wants to use it that way.
Can also work with UCM, which requires the 'type' config to be set to 'UCM'.
This is still a work in progress as I only recently switched to this at work.
Note the the history is still retrieved via lshistory and not specifically from
any activity information. This is largely for convenience for me so I don't have
to rewrite everything. Therefore things like 'recommended' baselines are ignored.
I don't know if this will cause any major dramas or not.
Troubleshooting
===============
1. WindowsError: [Error 2] The system cannot find the file specified
You're most likely running gitcc under Windows Cmd. At moment this isn't
supported. Instead use Git Bash, which is a better console anyway. :-)
2. cleartool: Error: Not an object in a vob: ".".
The Clearcase directory you've specified in init isn't correct. Please note
that the directory must be inside a VOB, which might be one of the folders
inside the view you've specified.
3. fatal: ambiguous argument 'clearcase': unknown revision or path not in the working tree.
If this is your first rebase then please ignore this. This is expected.
Behind the scenes
=================
A smart person would have looked at other git bridge implementations for
inspiration, such as git-svn and the like. I, on the other hand, decided to go
cowboy and re-invent the wheel. I have no idea how those other scripts do their
business and so I hope this isn't a completely stupid way of going about it.
I wanted to have it so that any point in history you could rebase on-top of the
current working directory. I've done this by using the clearcase commit time
for git as well. In addition the last rebased commit is tagged and is used
to limit the history query for any chances since. This tagged changeset is
therefore also used to select which commits need to be checked into clearcase.
Problems
========
It is worth nothing that when initially importing the history from Clearcase
that files not currently in your view (ie deleted) cannot be reached without
a config spec change. This is quite sad and means that the imported history is
not a true one and so rolling back to older revisions will be somewhat limited
as it is likely everything won't compile. Other Clearcase importers seem
restricted by the same problem, but none-the-less it is most frustrating. Grr!