charleso / git-cc Goto Github PK
View Code? Open in Web Editor NEWBridge for Git and Clearcase
License: Other
Bridge for Git and Clearcase
License: Other
Hi!
I'm trying to convert my clearcase project, but the result is disappointing....
After the execution of the gitcc rebase command the only result is a lshistory.bak file. No trac, nothing else ....
I have tryed running the gitcc rebase --load .git\lshistory.bak and here i'm getting the following output:
$ gitcc rebase --load =.git/lshistory.bak
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
cleartool ls -recurse -short Deployment
Traceback (most recent call last):
File "c:/GitProjects/git-cc/gitcc", line 48, in
main()
File "c:/GitProjects/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "c:/GitProjects/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "c:\GitProjects\git-cc\rebase.py", line 37, in main
history = open(load, 'r').read().decode(ENCODING)
IOError: [Errno 2] No such file or directory: '=.git/lshistory.bak'
Any good suggestions ??
I removed some files on 'master' branch and made a commit. I removed 3 files (one of them Desktop/images/16x16/Thumbs.db)
Then I run gitcc checkin
and get an error:
Traceback (most recent call last):
File "c:/Program Files (x86)/git-cc/gitcc", line 48, in <module>
main()
File "c:/Program Files (x86)/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "c:/Program Files (x86)/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "c:\Program Files (x86)\git-cc\checkin.py", line 44, in main
checkout(statuses, comment.strip(), initial)
File "c:\Program Files (x86)\git-cc\checkin.py", line 105, in checkout
stat.stage(transaction)
File "c:\Program Files (x86)\git-cc\status.py", line 54, in stage
t.stageDir(dirname(self.file))
File "c:\Program Files (x86)\git-cc\checkin.py", line 129, in stageDir
self.co(file)
File "c:\Program Files (x86)\git-cc\checkin.py", line 122, in co
cc_exec(['co', '-reserved', '-nc', file])
File "c:\Program Files (x86)\git-cc\common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, None, False, **args)
File "c:\Program Files (x86)\git-cc\common.py", line 60, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: cleartool: Error: Element "Desktop/images/16x16" is already checked out to view "phil_tsarik_view".
Have I done something wrong?
And can you please tell more about the workflow? In particular why is there a branch master_cc
, what for? What branch should I work with?
Traceback (most recent call last): File "./charleso-git-cc-e81f9e9/gitcc", line 4, in ? import rebase, checkin, init, sync, reset, tag, update File "./charleso-git-cc-e81f9e9/rebase.py", line 7, in ? from users import users, mailSuffix ImportError: No module named users
What is this users module ? It isn't installed on my system.
Is it a python module ?
I'm trying to set this up. But when I run the gitcc init command, I get the following error:
$ gitcc init
Traceback (most recent call last):
File "d:/tools/versionControl/charleso-git-cc-9f38cf0/gitcc", line 4, in
import rebase, checkin, init, sync, reset, update
File "d:\tools\versionControl\charleso-git-cc-9f38cf0\rebase.py", line 7, in
from users import users, mailSuffix
ImportError: No module named users
I'm running this in WindowsXP. I also have Cygwin installed but when I used Cygwin, I get the [Error 2] The system cannot find the file specified. So, trying it in git bash.
Also, one more question. Lets say, I have my snapshot in d:\viewstore\xyz and the view configuration in d:\viewstore\views\xyz, where do I run the gitcc init
Right now, I ran the git init and gitcc init from d:\viewstore\xyz but the gitcc init command issued was 'gitcc init /d/viewstore/views/xyz'. Please let me know if I'm running this correctly.
Hello,
That's merely a question but is gitcc able to track ClearCase tags instead of branches? When I initialise the .git/gitcc
config file specifying the branch I like to track it like:
[master]
clearcase = V:/path/to/view
branches = branch_name
i see half of the files after the gitcc rebase
of the project (only the ones changed on the branch_name
branch.
So instead can I somehow specify the ClearCase tag name and fetch everything?
Thanks
Leonidas
Hi
I have created new snapshot view. and I have created new directory for src from clearcase.
I have done "git init" on src dir through gitbash cmd prompt.
And "gitcc init d:\snapshot_view_dir"
While doing rebase/update getting below error message.
git log -n 1 --pretty=format:%ai master_cc
cleartool ls -recurse -short GEN4Firmware
Traceback (most recent call last):
File "./gitcc", line 48, in
main()
File "./gitcc", line 14, in main
return invoke(cmd, args)
File "./gitcc", line 38, in invoke
cmd.main(_args)
File "d:\gitsync\git-cc-master\rebase.py", line 36, in main
cache.start()
File "d:\gitsync\git-cc-master\cache.py", line 22, in start
self.initial()
File "d:\gitsync\git-cc-master\cache.py", line 32, in initial
self.read(cc_exec(ls))
File "d:\gitsync\git-cc-master\common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, *_args)
File "d:\gitsync\git-cc-master\common.py", line 57, in popen
pipe = Popen(cmd, cwd=cwd, stdout=PIPE, stderr=PIPE, env=env)
File "d:\Python27\lib\subprocess.py", line 679, in init
errread, errwrite)
File "d:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
WindowsError: [Error 267] The directory name is invalid
Can you please tell me where i am wrong?
--Kumar
gitcc does not recognize that a file has moved in ClearCase. In the git repo the file will be deleted and recreated. This means that the file looses it's history in the git-repo every time it is moved in ClearCase.
A possible way to fix this would be to rename all files that are removed to something else and later reuse the files if they reappear.
Hi charleso,
I find a issue after i migrate the a vob from clearcase to Git by "git rebase": subfolder and the file in this subfolder will be lost in git repository if the file is a empty one. If a subfolder include both a Non-empty file and empty file, only empty file is lost. I am not sure if it is a bug. When I create a snapview in my local from clearcase, i can see the subfolder and its empty files. So I am a little confused about it. Please help check. Thanks!
Hi charleso,
Sorry, today i check the lost files again, I find the real reason why files lost is not the size of file. It may be caused by there is no "checkinversion|XXXXXXXXX.XXXXXX|\main\1"(and upper) in the history log. Such as the following:
checkinversion|20091117.140842|\main\css_refactor\1
mkbranchversion|20091117.140842|\main\css_refactor\0
mkbranchbranch|20091117.140842|\main\css_refactor
mkelemversion|20091117.140842|\main\0
mkelembranch|20091117.140842|\main
mkelemfile element|20091117.140842|
So Can you help check it? If current script doesn't support this kinds of case?
There is a great option for git which can put the git dir (.git) into another directory/tree.
Combined with --work-tree option, you can init a git repository to another directory, while the work-tree is considered on the right path.
To achieve this without hassle and without passing --git-dir and --work-tree at each invocation of git command, you create a .git file which contains
gitdir: /path/to/the/real/git/repo
I think I began to use it because there must be some kind of limitation of just using a symbolic link to another directory, but I don't remember why exactly
in gitcc update
cc_exec(['update', '.'], errors=False)
sync.main()
git_exec(['add', '.'])
git_exec(['commit', '-m', message])
reset.main('HEAD')
But I think here the following command should be run
cleartool lsco
cleartool lsprivate
And the results should be excluded for "git add" operation, right?
I tried to follow the instructions in the README and did this
$ git init
$ gitcc init /cygdrive/x/[my actual path]
Then I edited my .git/gitcc to this
[core]
type = UCM
[master]
clearcase = /cygdrive/x/[my actual path]
I'm not sure which config options are required so I only added type = UCM. Then I did the rebase and got this
$ gitcc rebase
> git ls-files --modified
> git log -n 1 --pretty=format:%ai master_cc
> cleartool ls -recurse -short .
Traceback (most recent call last):
File "../gitcc/gitcc", line 48, in <module>
main()
File "../gitcc/gitcc", line 14, in main
return invoke(cmd, args)
File "../gitcc/gitcc", line 38, in invoke
cmd.main(*args)
File "/cygdrive/c/aoln/gitcc/rebase.py", line 35, in main
cache.start()
File "/cygdrive/c/aoln/gitcc/cache.py", line 22, in start
self.initial()
File "/cygdrive/c/aoln/gitcc/cache.py", line 32, in initial
self.read(cc_exec(ls))
File "/cygdrive/c/aoln/gitcc/common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, **args)
File "/cygdrive/c/aoln/gitcc/common.py", line 61, in popen
return stdout if not decode else stdout.decode(ENCODING)
File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 164948-164951: invalid data
This is on Cygwin in Windows XP with python 2.6.5. I'm sure there are many files in my CC repository which are not UTF-8 but is this unsupported or is there some other thing going on?
The following function is used to check if the history is the same
def same(a, b):
return a.subject == b.subject and a.user == b.user
But I think you should add a additional condition "date".
Only the event on the same date can be created by one checkin, right?
I mean it should be
return a.subject == b.subject and a.user == b.user and a.date ==b.date
When we transfer between CC main and git master.
We run "cleartool lshistroy" and then filter "checkinversion operaton" to get all the versions created. )
Typically, the output might be
checkinversion|20140307.1111111|user|dummy|\main\5| (it is a version on Main)
checkinversion|20140307.1111111||dummy|\main\my_branh\5| (it is a version on my_branch)
And then we
cc_exec(['get','-to', toFile, cc_file(file, version)])
And then create git version on master for each of them.
This will create some addtional version on the git master, which are original on the my_branch of CC
is it reasonable?
Hi,
trying to run gitcc rebase from cygwin bash gets me this:
$ gitcc rebase
Encoding=ISO8859-1
git branch
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse .
git branch
git checkout master_cc
Traceback (most recent call last):
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 48, in
main()
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 38, in invoke
cmd.main(_args)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in main
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 39, in doStash
f()
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 61, in doCommit
git_exec(['checkout', CC_TAG])
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 48, in git_exec
return popen('git', cmd, GIT_DIR, *_args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 61, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: error: pathspec 'master_cc' did not match any file(s) known to git.
Suggestions?
Note: Since I had to change the encoding part, lines are few off. I also tried this:
$ gitcc rebase --load .git/lshistory.bak
Encoding=ISO8859-1
git branch
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
git branch
git checkout master_cc
Traceback (most recent call last):
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 48, in
main()
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 38, in invoke
cmd.main(_args)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in main
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 39, in doStash
f()
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 61, in doCommit
git_exec(['checkout', CC_TAG])
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 48, in git_exec
return popen('git', cmd, GIT_DIR, *_args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 61, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: error: pathspec 'master_cc' did not match any file(s) known to git.
there is a 'main' branch on my clearcase view so that shouldn't be the case. I'm using a snapshot view.
It seems the script tries to do a
git branch -f master_cc
I guess it should be based on HEAD, but HEAD and/or master doesn't seem to exists and it seems to crash. Any pointer would help me ;)
> git ls-files --modified
> git log -n 1 --pretty=format:%ai master_cc
> cleartool ls -recurse -short .
> git branch
> cleartool diff -diff_format -pred /vob/daproject//src@@/main/1
> cleartool lshistory -fmt %o%m|%Nd|%Vn\n /vob/daproject//src/Makefile
> cleartool describe -fmt %Nd /vob/daproject//src@@/main/1
It appears that you may be missing a branch in the includes section of your gitcc config for file '/vob/daproject//src/Makefile'.
> cleartool diff -diff_format -pred /vob/daproject//JUNK/2011_and_before/README@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/apps@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/arith@@/main/1
> cleartool lshistory -fmt %o%m|%Nd|%Vn\n /vob/daproject//src/arith/Makefile
> cleartool describe -fmt %Nd /vob/daproject//src/arith@@/main/1
It appears that you may be missing a branch in the includes section of your gitcc config for file '/vob/daproject//src/arith/Makefile'.
> cleartool diff -diff_format -pred /vob/daproject//src/backoff@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//JUNK/2011_and_before/bin@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/common@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/db@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/f@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/libdbg@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/models@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//JUNK/2011_and_before/object.old@@/main/1
> cleartool diff -diff_format -pred /vob/daproject//src/risk@@/main/1
> git branch -f master_cc
Traceback (most recent call last):
File "/infinity_tmpfs/ut1p40/git-cc/gitcc", line 51, in ?
main()
File "/infinity_tmpfs/ut1p40/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/infinity_tmpfs/ut1p40/git-cc/gitcc", line 41, in invoke
cmd.main(*args)
File "/infinity_tmpfs/ut1p40/git-cc/rebase.py", line 55, in main
doStash(lambda: doCommit(cs), stash)
File "/infinity_tmpfs/ut1p40/git-cc/common.py", line 38, in doStash
f()
File "/infinity_tmpfs/ut1p40/git-cc/rebase.py", line 55, in <lambda>
doStash(lambda: doCommit(cs), stash)
File "/infinity_tmpfs/ut1p40/git-cc/rebase.py", line 72, in doCommit
git_exec(['branch', '-f', CC_TAG])
File "/infinity_tmpfs/ut1p40/git-cc/common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, **args)
File "/infinity_tmpfs/ut1p40/git-cc/common.py", line 66, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: fatal: Not a valid object name: 'master'.
In reabse.py, main there is a line
cs.sort(key = lambda x: x.date)
that sorts the changesets in chronological order. I guess this is done because the list is in reverse order. Why the list is not simply reversed is a good question as the output from clearcase lshistory which the data is based on is already sorted.
The problem here is that two commits with the same time-stamp will (or might if cs.sort is an unstable sorting algorithm) change ordering. This causes gitcc to commit /main/2 before /main/1 if two commits on the same file have the same timestamp.
I'll replace the sort with a simple reverse and see if that fixes the problem. I'll be back with my answer in a couple of hours after some testing.
Hello I'm getting this when I try to gitcc checkin
Exception: File has been modified: package/className.java. Try rebasing.
Full traceback:
> cleartool unco -rm package/className.java
Traceback (most recent call last):
File "d:/tools/git-cc/gitcc", line 48, in <module>
main()
File "d:/tools/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "d:/tools/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "d:\tools\git-cc\checkin.py", line 44, in main
checkout(statuses, comment.strip(), initial)
File "d:\tools\git-cc\checkin.py", line 88, in checkout
stat.stage(transaction)
File "d:\tools\git-cc\status.py", line 31, in stage
t.stage(self.file)
File "d:\tools\git-cc\checkin.py", line 133, in stage
raise Exception('File has been modified: %s. Try rebasing.' % file)
Exception: File has been modified: package/className.java. Try rebasing.
When I do rebase I get no updates.Is there something I am missing?
Sometimes gitcc rebase will duplicate a commit that I just checked in to clearcase (via gitcc checkin). It's as if the gitcc rebase can't tell that recent checkins executed a few minutes ago by "gitcc checkin" should match the existing commit, so it creates a new commit.
Here's what I do
Any ideas?
OS: Windows 7
git version 1.7.11.msysgit.0
cleartool version 7.1.2.0
Python version 2.7.1
config:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
autocrlf = false
debug = true
cache = false
When I commit to git and use cyrillic in the commit message, then gitcc checkin
fails:
sergey@ZAKUSOV /C/git-cc-test-repo (master)
$ gitcc checkin
> cleartool update .
> git log -z --reverse --pretty=format:%H%x01%s%n%b --first-parent master_ci..
> git diff --name-status -M -z --ignore-submodules 27492ee1c17c6be57c8b4112885573c71ffe9a8b^..27492ee1c17c6be57c8b4112885573c71ffe9a8b
> git ls-tree -z 27492ee1c17c6be57c8b4112885573c71ffe9a8b -- module1/test1.txt
> git merge-base master_ci HEAD
> cleartool co -reserved -nc module1/test1.txt
> git hash-object Z:project1\module1/test1.txt
> git ls-tree -z 779bb19196a306a58b5859c3ff8f3f7658649ab6 module1/test1.txt
> git ls-tree -z 27492ee1c17c6be57c8b4112885573c71ffe9a8b module1/test1.txt
> git cat-file blob 06f0ae4f6ea9ddfdfd960b54c34f0c85d2422ebd
> cleartool ci -identical -c "¦¦¦-¦-¦-¦¬TВ ¦- ¦-¦¦TВ¦¦TГ feature1" module1/test1.txt
Traceback (most recent call last):
File "c:/git-cc/gitcc", line 48, in <module>
main()
File "c:/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "c:/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "c:\git-cc\checkin.py", line 39, in main
checkout(statuses, comment.strip(), initial)
File "c:\git-cc\checkin.py", line 90, in checkout
transaction.commit(comment);
File "c:\git-cc\checkin.py", line 113, in commit
cc_exec(['ci', '-identical', '-c', comment, file])
File "c:\git-cc\common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, **args)
File "c:\git-cc\common.py", line 57, in popen
pipe = Popen(cmd, cwd=cwd, stdout=PIPE, stderr=PIPE, env=env)
File "c:\Python27\lib\subprocess.py", line 679, in __init__
errread, errwrite)
File "c:\Python27\lib\subprocess.py", line 896, in _execute_child
startupinfo)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 28-39: ordinal not in range(128)
Variable ENCODING = cp866.
I've been experimenting with gitcc and ran into the following exception.
$ gitcc rebase
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse -since 28-Feb-2012.20:07:03 .
git branch
git checkout master_cc
cleartool get -to "file1.xml"
git add -f "file2.xml"
cleartool get -to "file2.xml" "file2.xml"
git add -f "file2.xml"
git add .gitcc
git rebase master_ci master_cc
Traceback (most recent call last):
File "e:/gitwork/git-cc-dload/gitcc", line 48, in
main()
File "e:/gitwork/git-cc-dload/gitcc", line 14, in main
return invoke(cmd, args)
File "e:/gitwork/git-cc-dload/gitcc", line 38, in invoke
cmd.main(_args)
File "e:\gitwork\git-cc-dload\rebase.py", line 52, in main
doStash(lambda: doCommit(cs), stash)
File "e:\gitwork\git-cc-dload\common.py", line 38, in doStash
f()
File "e:\gitwork\git-cc-dload\rebase.py", line 52, in
doStash(lambda: doCommit(cs), stash)
File "e:\gitwork\git-cc-dload\rebase.py", line 66, in doCommit
git_exec(['rebase', CI_TAG, CC_TAG])
File "e:\gitwork\git-cc-dload\common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, *_args)
File "e:\gitwork\git-cc-dload\common.py", line 60, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: Cannot rebase: Your index contains uncommitted changes.
Please commit or stash them.
In a normal gitcc rebase command after performing "git add .gitcc" it would do a "git commit -m "message" then a "git rebase master_ci master_cc" and so one. In this case it is skipping the commit resulting in the index having the files represented by file1.xml and file2.xml staged but not committed.
The index and working set was clean prior to running "gitcc rebase"
Thanks for any help or insight you might have.
I'm not a python developer or I would probably try and debug it.
Hello.
I have some problems with rebasing.
There is a file.
Versions of this file from ClearCase History Browser looks like this:
\main\dev\4
\main\dev\3
\main\dev\mbb\1
\main\dev\mbb\0
\main\dev\mbb
\main\dev\2
\main\dev\1
\main\dev
\main\0
\main
As you can see we have two branches: dev
and mmb
. And there was a merge from mmd
to dev
.
gitcc rebase
updates this file only until \main\dev\mbb\1
version. It doesn't update to version \main\dev\3
and further.
My .git/gitcc
file is:
[core]
exclude = ...
[master]
clearcase = ...
branches = mbb|dev
I also tried to set branches as mbb|dev|dev/mbb|mbb/dev
Please help, how do I able to solve this problem?
Hi, charleso,
I run into this problem during executing "gitcc rebase" command. Let me elaborate the reproduce steps:
I think the reason is that:
when check in a new file in clearcase, it will automatically add two versions: version 0 (with the type mkelemversion, which is an empty file) and version 1 (with the type checkinversion, which contains the real content), and if we check in the new file with some tool like CCRC, the file's parent folder will be automatically checked in, so the check in time of version 1 and the folder is the same (the check in time of version 0 is a little earlier)
Then in the rebase.py code, first the version 1 of that file is checked in through Changeset.add(), then we will check in the folder through Uncataloged.add(), in this function:
class Uncataloged(Changeset):
def add(self, files):
......
history = filter(None, history.split('\n')) # contains version1 and version0
all_versions = self.parse_history(history)
date = cc_exec(['describe', '-fmt', '%Nd', dir])
actual_versions = self.filter_versions(all_versions, lambda x: x[1] < date) # version1 is filtered out since its date is the same as that in folder
versions = self.checkin_versions(actual_versions) #version 0 is also filtered out, versions is empty now
if not versions:
print("No proper versions of '%s' file. Check if it is empty." % added)
versions = self.empty_file_versions(actual_versions) #version 0 is added back
if not versions:
print("It appears that you may be missing a branch in the includes section of your gitcc config for file '%s'." % added)
continue
self._add(added, versions[0][2].strip()) # this file becomes blank since version 1 is overwritten by version 0
As the comments in the code above, the file's content is lost since it is overwritten by the empty file version 0.
I think there are two possible solutions:
lambda x: x[1] < date
to
lambda x: x[1] <= date
versions = self.checkin_versions(actual_versions)
just continue and do not add the empty version file back.
I prefer No.2 since the 1st solution will cause a duplicate commit for version 1.
What do you think? Thanks.
When using gitcc update, the symbolic links are not copied from the Clearcase vob to the git repository.
Working with a UCM view, I was able to get past other issues with the rebase process by creating a child stream for the GIT synchronization (instead of using the integration stream), and removing "main" from the list of branches I cared about.
It gets all the way past the lsh step and the step where it requests the headlines for each of the activities (sometimes, multiple times, but my guess is that's because my organization re-uses activities). But, it then fails after the initial commit to GIT when it tries to remove some files from the repo:
cleartool diff -diff_format -pred myapp@@/main/myapp_r3_dev_stream/r4_integration/r6_integration/1
git add .gitcc
git commit -m "deliver r6_myapp on 9/1/2011 5:56:13 PM."
git branch -f master_cc
git tag -f master_ci master_cc
Traceback (most recent call last):
File "/cygdrive/c/IBM/RationalSDLC/git-cc/gitcc", line 48, in
main()
File "/cygdrive/c/IBM/RationalSDLC/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 52, in main
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/common.py", line 40, in doStash
f()
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 52, in
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 63, in doCommit
commit(cs)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 146, in commit
cs.commit()
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 183, in commit
file.add(files)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 209, in add
self._add(self.file, self.version)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/rebase.py", line 217, in _add
removeFile(toFile)
File "/cygdrive/c/IBM/RationalSDLC/git-cc/common.py", line 139, in removeFile
os.remove(file)
OSError: [Errno 13] Permission denied: 'G:/myapp/ui/pom.xml'
I'd fix it, but I'm not exactly sure what's supposed to happen during this step. It looks like it's core to what the gitcc scripts do that they need to replace files with predecessor versions in order to import them. Doesn't deleting a file in a UCM dynamic view cause it to be deleted immediately in the stream?
Hi,
I have not only the chance to use clearcase at work, but I alsa use the wonderful red hat enterprise !
Python 2.4 goodies etc. With no root access.
What should I do to make it work on this system ?
First problem I have is the :
defaults = defaults if defaults else []
Hello Charles,
I'm trying to track 2 different branches of the same project in Clearcase under git-cc. I followed the documentation and I came up with this .git/gitcc file
[master]
clearcase = V:\clearcase-prod-branch-view\path\to\project-src
branches = prod_branch[dev]
clearcase = V:\clearcase-dev-branch-view\path\to\project-src
branches = dev_branch
I initiated a gitcc rebase
and loaded allt he history from prod branch to master. But there's no dev branch created to the git repository.
Did I understand the feature wrongly ?
I've no idea how to use ClearCase. I've been asked to look at getting git-cc working. I have followed the instructions here, and have fixed a couple of issues I've run into by looking over the issues list here. But I still have no files.
The glitch rebase finishes and the lshistory.bak file is created.
The .git/gitcc file was pretty empty. It had:
[master]
clearcase = /cygdrive/v/p111000/app_root
I added:
BRANCHES=main|p111000_COL4.0
main is the base 'branch'. p111000_COL4.0 is my view.
Any 'git branch' leads to an error "fatal: Not a valid object name: 'Master'." I see where several others have had this issue, and the advice was always that BRANCHES wasn't correct. I see both of those when I run "clear tool lstype -kind brtype' and in the Clear Case explorer. So I think it's correct.
I just can't seem to actually get the source code into my git directory to start work.
Any help would be appreciated.
For example there is a commit made via git:
Refactor CSS
Change names according to coding style. Also remove redundant styles.
So on and so on...
Then do gitcc checkin
and gitcc rebase
. After that gitcc makes a commit with changes in .gitcc file only but this commit has a message without empty line:
Refactor CSS
Change names according to coding style. Also remove redundant styles.
So on and so on...
If I make gitcc rebase
from scratch my commit will have the same message (without empty line).
ClearCase History Browser also shows the same message without empty line.
Is this ClearCase limitation? Is it possible to avoid this?
It appears that in ClearCase we have several empty folders to satisfy build tools (i.e. the Flex compiler). In CC, this is fine because folders are versioned objects, but in GIT, as you know, empty folders are ignored.
Is there any chance of having GITCC automatically create .keep files for empty folders?
Hi,
I am facing the following issue, as i can see the same issue faced by andres
Can I get a solution for this Issue?
$ python --version
Python 2.5.2
$ ./gitcc
Traceback (most recent call last):
File "./gitcc", line 4, in
import rebase, checkin, init, sync, reset, update
File "/opt/gitcc/rebase.py", line 188
except Exception as e:
^
SyntaxError: invalid syntax
I just thought I would share a solution to a problem I had encountered.
When there were conflicts between git and clearcase i would have to rebase before pulling or else it caused gitcc to have a fit. The solution (workaround) is as follows
gitcc rebase //this is the rebase that will cause a merge conflict
git mergetool //to resolve the conflicts
git add -A
git rebase --continue
git checkout master_cc
git merge master //or whatever branch you were trying to merge to
git checkout master
gitcc rebase //rebase again and its resolved.
It seems to me that gitcc should include a command to automatically do this (probably in a more efficient manner)
Python 2.6.5
git log -n 1 --pretty=format:%ai master_cc
cleartool ls -recurse -short .
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse .
Traceback (most recent call last):
File "/cygdrive/c/home/tmp/git-cc/gitcc", line 48, in
main()
File "/cygdrive/c/home/tmp/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/cygdrive/c/home/tmp/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "/cygdrive/c/home/tmp/git-cc/rebase.py", line 45, in main
cs = parseHistory(history)
File "/cygdrive/c/home/tmp/git-cc/rebase.py", line 119, in parseHistory
add(last, comment)
File "/cygdrive/c/home/tmp/git-cc/rebase.py", line 109, in add
if filterBranches(cs.version):
File "/cygdrive/c/home/tmp/git-cc/rebase.py", line 92, in filterBranches
version = version[-1]
IndexError: list index out of range
This may well be something I'm doing wrong, but, when files are synced (this is a new install), any file in the root directory gets copied over to my git directory correctly, but, the sync fails with the first file is a sub-directory. When the copy command is called, the directory name is being stripped off, so a file not found exception is raised.
This happens if I init with a Windows style or unix style path to the gitcc init call.
I'm using Cygwin on Windows.
Any ideas?
Hi there, is this behavior by design? If yes, I'm assuming these settings are for the CC --> git direction? Maybe another section in the gitcc configuration file, dedicated to the git --> CC direction could handle this feature, what do you think?
While running gitcc rebase I get the below. When used python 2.7 all worked fine. As I didn't find somewhere that the project is python 2 specific I open this ticket. Let me know if it's not suppose to work on python 3.
> git add .gitcc
> git branch -f master_cc
Traceback (most recent call last):
File "x:\usr\git-cc-master\rebase.py", line 66, in doCommit
commit(cs)
File "x:\usr\git-cc-master\rebase.py", line 149, in commit
cs.commit()
File "x:\usr\git-cc-master\rebase.py", line 195, in commit
git_exec(['commit', '-m', comment.encode(ENCODING)], env=env)
File "x:\usr\git-cc-master\common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, encoding='UTF-8', **args)
File "x:\usr\git-cc-master\common.py", line 56, in popen
debug('> ' + ' '.join(map(f, cmd)))
File "x:\usr\git-cc-master\common.py", line 55, in <lambda>
f = lambda a: a if not a.count(' ') else '"%s"' % a
TypeError: Type str doesn't support the buffer API
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "x:\usr\git-cc-master\gitcc", line 48, in <module>
main()
File "x:\usr\git-cc-master\gitcc", line 14, in main
return invoke(cmd, args)
File "x:\usr\git-cc-master\gitcc", line 38, in invoke
cmd.main(*args)
File "x:\usr\git-cc-master\rebase.py", line 55, in main
doStash(lambda: doCommit(cs), stash)
File "x:\usr\git-cc-master\common.py", line 38, in doStash
f()
File "x:\usr\git-cc-master\rebase.py", line 55, in <lambda>
doStash(lambda: doCommit(cs), stash)
File "x:\usr\git-cc-master\rebase.py", line 72, in doCommit
git_exec(['branch', '-f', CC_TAG])
File "x:\usr\git-cc-master\common.py", line 47, in git_exec
return popen('git', cmd, GIT_DIR, encoding='UTF-8', **args)
File "x:\usr\git-cc-master\common.py", line 62, in popen
raise Exception(decodeString(encoding, stderr + stdout))
Exception: fatal: Not a valid object name: 'master'.
Can git-cc be made to import branches and merges (hyperlink data) from Clearcase?
At the moment it seems I can either:
Specify "branches=release" and get all the "merge of branch foo into release" changesets, or
Specify "branches=*" and get every single Clearcase commit mashed into multiple commits on the git master branch (with no branching/merging imported)
What I'd like is to have Clearcase branches (the feature/bugfix branches) and merge hyperlinks (where said branches have been brought into the release tree) imported into Git so I can see how the code has changed over time.
Hi,
While using gitcc rebase, i get this below error, Any idea what could cause this.
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse .
Traceback (most recent call last):
File "../gitcc", line 48, in
main()
File "../gitcc", line 14, in main
return invoke(cmd, args)
File "../gitcc", line 38, in invoke
cmd.main(_args)
File "h:\Tools\git-cc-master\git-cc-master\rebase.py", line 43, in main
history = getHistory(since)
File "h:\Tools\git-cc-master\git-cc-master\rebase.py", line 90, in getHistory
return cc_exec(lsh)
File "h:\Tools\git-cc-master\git-cc-master\common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, *_args)
File "h:\Tools\git-cc-master\git-cc-master\common.py", line 62, in popen
raise Exception(decodeString(encoding, stderr + stdout))
Exception: cleartool: Error: Not an object in a vob: ".".
Thanks,
Raghav
Help texts strongly encourages to use git bash, but that should not be used if Cygwin is installed. Using Cygwin in that situation however works fine. This should be documented.
Some details also here: http://stackoverflow.com/questions/8944527/path-issue-with-python-script-in-git-shell
The script works great for the most part ( had to modify it to take out the language checking going out to Git Bash ), but it would be much better if it could allow for multiple VOB import into a single git repository. At my work, we have a project set up over multiple VOBs including a common and driver VOB, and as we are trying to model repositories as per project, this creates a difficult time trying to wipe out our .gitcc then re-initialize it to a different VOB. Any ideas for how to move forward better? We are looking for a one time import into GIT. ( Ideally without submodules, my least favorite part of GIT )
Hi
When i try to run any of the command, it is throwing me the below error.
/bin/env: python: No such file or directory
Actually I have downloaded git-cc repository as zip file and copied to my local machine. and then i try to run the commands mentioned below
$ "/git-cc-master/gitcc" init D:/CC/View/CVOB.
Is there anything wrong in doing this. Can you please help me out in correcting it.
Note:- I have python also already installed in my local machine.
Thanks In advance..
Regards,
A.Vikramsai
gitcc does not handle moved directories. Instead it first removes the directory and then later add the directory again. If a directory is moved in ClearCase the contents of the directory still remains in the directory but in the git-repo everything is cleared and therefore files are lost.
A possible fix for this could be to scan each newly added directory for contents and recreate the files.
Another way could be to not remove directories but save them with a different name and reuse them later if they appear again. This method would preserve history for the files in the directory.
Background: in our clearcase repository we have files that presumably have so long file names/paths that they cause issues with clearcase. It would seem those files load fine in some other OS's, but not on windows. Since we use windows workstations for developing and linux servers on actual deployment, this hasn't been seen that big of an issue.
However, now trying to use git-cc to get cc stuff to git, and these files are causing the whole process to abort (which lasts several days to begin with - our repo is quite big). Can we somehow ignore such files, or skip to next one? There is only a handful of those anyway.
Error message below. I've edited the file name/path to protect the innocent, but the length is the same. the file name has to be that long due to framework requirements.
git tag -f master_ci master_cc
Traceback (most recent call last):
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 48, in
main()
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "/cygdrive/c/versioncontrol/git-cc/gitcc", line 38, in invoke
cmd.main(_args)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in main
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 39, in doStash
f()
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 52, in
doStash(lambda: doCommit(cs), stash)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 63, in doCommit
commit(cs)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 146, in commit
cs.commit()
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 183, in commit
file.add(files)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 209, in add
self._add(self.file, self.version)
File "/cygdrive/c/versioncontrol/git-cc/rebase.py", line 216, in _add
cc_exec(['get','-to', toFile, cc_file(file, version)])
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 51, in cc_exec
return popen('cleartool', cmd, CC_DIR, *_args)
File "/cygdrive/c/versioncontrol/git-cc/common.py", line 61, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: cleartool: Error: //?/C:/versioncontrol/ourprojectpath/applications/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/long/path/filename.long0000000000000000000000000000000000000000000000000000000000000000.jsp: No such file or directory
cleartool: Error: Operation "file copy" failed: No such file or directory.
I was unable to remove files from the repo.
I tried to delete two files: Desktop/.architect and Mobile/.architect.
$ gitcc checkin
> cleartool update .
> git log -z --reverse --pretty=format:%H%x01%s%n%b --first-parent master_ci..
...
> git diff --name-status -M -z --ignore-submodules 65bac0030a7fc196859d03898e0ad62c9ba1efb7^..65bac0030a7fc196859d03898e0ad62c9ba1efb7
> cleartool ls -long Desktop/.architect
> git ls-tree -z 65bac0030a7fc196859d03898e0ad62c9ba1efb7 -- Desktop/.architect
char=D filename=Desktop/.architect
[u'Desktop/.architect']
> cleartool ls -long Mobile/.architect
> git ls-tree -z 65bac0030a7fc196859d03898e0ad62c9ba1efb7 -- Mobile/.architect
char=D filename=Mobile/.architect
[u'Mobile/.architect']
> git merge-base master_ci HEAD
> cleartool co -reserved -nc Desktop
> cleartool co -reserved -nc Mobile
<status.Delete instance at 0x02BC3508>
Trying to delete d:/CC_Views/phil_tsarik_view/project_dir\Desktop/.architect
Traceback (most recent call last):
File "c:/Program Files (x86)/git-cc/gitcc", line 48, in <module>
main()
File "c:/Program Files (x86)/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "c:/Program Files (x86)/git-cc/gitcc", line 38, in invoke
cmd.main(*args)
File "c:\Program Files (x86)\git-cc\checkin.py", line 44, in main
checkout(statuses, comment.strip(), initial)
File "c:\Program Files (x86)\git-cc\checkin.py", line 111, in checkout
stat.commit(transaction)
File "c:\Program Files (x86)\git-cc\status.py", line 61, in commit
if exists(path) and os.path.filename(path) in os.listdir(os.path.dirname(path)):
AttributeError: 'module' object has no attribute 'filename'
Please note that there is a backslash in the path to delete: d:/CC_Views/phil_tsarik_view/project_dir\Desktop/.architect
. Does this something mean?
Also I tried to delete other files before but always the same error.
Windows 7 x64
Python 2.7.6. Also I tried python 3.x but I couldn't even make an initial gitcc rebase
due to some other exception. BTW what python version is supported by git-cc?
Please help
Error encountered while rebase
[root@linux git-repo]# /root/git-cc-master/gitcc rebase
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
cleartool ls -recurse -short .
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse .
Traceback (most recent call last):
File "/root/git-cc-master/gitcc", line 48, in
main()
File "/root/git-cc-master/gitcc", line 14, in main
return invoke(cmd, args)
File "/root/git-cc-master/gitcc", line 38, in invoke
cmd.main(_args)
File "/root/git-cc-master/rebase.py", line 40, in main
history = getHistory(since)
File "/root/git-cc-master/rebase.py", line 87, in getHistory
return cc_exec(lsh)
File "/root/git-cc-master/common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, *_args)
File "/root/git-cc-master/common.py", line 61, in popen
return stdout if not decode else stdout.decode(ENCODING)
File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb8 in position 7713658: invalid start byte
[root@linux git-repo]#
Would there be a way to include both the Activity name and Check-in comment from ClearCase in the commit comment in Git??
Even if this isn't desired for the main project, I would appreciate any help in implementing this in my own fork.
So I have change the user.py.example to User.py. And I've also added the code from the README.md into the user.py.
[core]
include = FolderA|FolderB
exclude = FolderA/sub/folder|FolderB/other/file
debug = False
type = UCM
[master]
clearcase = D:\views\co4222_flex\rd_poc
branches = main|ji_dev|ji___dev|iteration___dev
[sup]
clearcase = D:\views\co4222_sup\rd_poc
branches = main|sup
Now in my users.py under users I have it blank some of the people that has added code and comments are not with the company anymore so they don't have a git account. Now to the mailSuffix so I have that all set up with my company mailSuffix = 'example.com'. Now going down to the core I'm wanting to have everything from the VOB. So I have the include and exclude commented out. Is that wrong or right? For the branches I have this code.
[DEV]
clearcase = c:\Users\RobBennett\Development_2
branches = main|development
[PROD]
clearcase = c:\Users\RobBennett\Production_2
branches = main
So I'm in the folder that I place the new .git from ClearCase. I run the git init, that works, then I run gitcc init c:/Users/RobBennett/Development_2 (which is were my clearcase is located at) after that I end up with this error
gitcc init c:/Users/RobBennett/Development_2
Traceback (most recent call last):
File "c:/Users/RobBennett/Documents/git-cc-master/git-cc-master/gitcc:, line 4, in
import rebase, checkin, init, sync, reset, tag, update
File "c:/Users/RobBennett/Documetns/git-cc-master/git-cc-master/rebase.py", line 7, in
from users import users, mailSuffix
File "c:/Users/RobBennett/Documents/git-cc-master/git-cc-master/users.py", line 14
cleasecase = C:/Users|RobBennett/Development_2
^
SyntaxError: invalid syntax
So the major question is how do you set this thing up or do I have it set up correctly in order to get this to run. Or even when you do the gitcc init what path are you suppose to go to?
I do the commands and don't do nothing..
mpmartins@AGBAR006501 /d/viewsgit/occam (master)
$ /c/Python32/python.exe /d/marco/git-cc/gitcc init /d/views/OCCAM_Evo_1_2/OCCAM/FuentesOCCAM
git config core.autocrlf falsempmartins@AGBAR006501 /d/viewsgit/occam (master)
$ /c/Python32/python.exe /d/marco/git-cc/gitcc rebase
git ls-files --modified
git log -n 1 --pretty=format:%ai master_cc
cleartool ls -recurse -short .
cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse .mpmartins@AGBAR006501 /d/viewsgit/occam (master)
$ lsmpmartins@AGBAR006501 /d/viewsgit/occam (master)
$ git log
fatal: bad default revision 'HEAD'
Hi,
I just trying gitcc, and I found that by default after I do:
gitcc init ..
gitcc update ..
git has 2 unwanted files inside:
I have tried to add them to exclude but it does not seems to work.
I have check update.py and it ignores excludes.
Hello,
I've been using git-cc for almost 2 years working against dynamic views. The latest commits doesn't work. The exception is:
$ gitcc rebase
> git ls-files --modified
> cleartool update
Traceback (most recent call last):
File "d:/Tools/git-cc/gitcc", line 48, in
main()
File "d:/Tools/git-cc/gitcc", line 14, in main
return invoke(cmd, args)
File "d:/Tools/git-cc/gitcc", line 38, in invoke
cmd.main(_args)
File "d:\Tools\git-cc\rebase.py", line 35, in main
cc_exec(["update"])
File "d:\Tools\git-cc\common.py", line 50, in cc_exec
return popen('cleartool', cmd, CC_DIR, *_args)
File "d:\Tools\git-cc\common.py", line 60, in popen
raise Exception((stderr + stdout).decode(ENCODING))
Exception: cleartool: Error: 'V:\path\to\dynamic\view' is not a valid snapshot view path.
The latest working commit I used is 80c5e69. After that I've tested some commits after without success.
For reference my gitcc config is:
[master]
clearcase = V:\path\to\dynamic\view
branches = main|a_branch
Can anyone validate the Dynamic views are broken?
Thanks,
Leonidas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.