Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebase.py fails under cygwin #3

Closed
AndreyPavlenko opened this issue Sep 21, 2011 · 9 comments
Closed

rebase.py fails under cygwin #3

AndreyPavlenko opened this issue Sep 21, 2011 · 9 comments

Comments

@AndreyPavlenko
Copy link
Contributor

python --version

Python 2.6.5

gitcc rebase --dry-run

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

@AndreyPavlenko
Copy link
Contributor Author

And another issue:

gitcc update "Initial commit"

cleartool update .
Copying /cygdrive/c/home/tmp/tmp_proj/build.properties
Copying /cygdrive/c/home/tmp/tmp_proj/build.xml
Copying /cygdrive/c/home/tmp/tmp_proj/Schema.config
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/update.py", line 8, in main
sync.main()
File "/cygdrive/c/home/tmp/git-cc/sync.py", line 26, in main
copy(join(reldir, file))
File "/cygdrive/c/home/tmp/git-cc/sync.py", line 32, in copy
shutil.copy(join(CC_DIR, file), newFile)
File "/usr/lib/python2.6/shutil.py", line 88, in copy
copyfile(src, dst)
File "/usr/lib/python2.6/shutil.py", line 52, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: 'C:/home/tmp/view/sandbox/tmp_proj/Schema.config'

The file Schema.config is located in the tmp_proj/src directory, but not in the tmp_proj.

@charleso
Copy link
Owner

Hi Andrey,

Well for I'm just going to ignore the second part (for now). While it's unfortunate, you can easily do what 'update' does by copying the files from Clearcase into Git, commit them, and run 'git branch -f master_cc && git tag -f master_ci'. It doesn't do anything complex. Just out of interested there's no symlinks or anything funny in tmp_proj? What does your gitcc config file look like? Maybe put some 'print' statements in sync.py and see what you can see.

I don't quite know what the issue is the first exception. I've added some debugging to the code and pushed it to master. Let me know what it prints. Depending on the size of .git/lshistory.bak file is would you mind sending a zip to me so I can take a look?

Cheers,

Charles

@AndreyPavlenko
Copy link
Contributor Author

Hi Charles,

Seems I've found the cause of the first issue. In version = version.split(os.sep) you use os.sep which is '/' under Cygwin environment, but it's Windows and the version, provided by cleartool, is separated by ''. Setting os.sep = '' in rebase.py works around this particular issue, but I'm not sure whether everything works fine, since gitcc rebase does not create any files:

$ ../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 .

The second issue, I think, is also caused by Windows paths. For example, I have 'tools' directory in my repository, but gitcc update creates 'ools' directory.

@charleso
Copy link
Owner

Hi Andrey,

Ahh. That would explain it. I always used msysgit which I guess behaves itself in regards to os.sep.

It's a bit hard to tell why rebase didn't find anything. Without being too unhelpful you might want to stick a few debugs in filterBranches and see why it's not matching anything. Alternatively if you want to send me a few lines of .git/lshistory.bak with your 'branches' config setting that would be helpful too.

Sorry I can't be of more use.

Charles

@AndreyPavlenko
Copy link
Contributor Author

Charles,

I've added debugs and found out that filterBranches does not recognize my branch name in version = '\main\fp01_7.0_rus\1'. The function fnmatch() is called with 'fp01_7.0_rus' and 'main' arguments, thus it always returns false. I've added one more version.pop() and faced with another issue:

cleartool get -to /cygdrive/c/home/tmp/tmp_proj/META-INF\MANIFEST.MF META-INF\MANIFEST.MF@@\main\fp01_7.0_rus\1

cleartool can't find the cygwin's path - /cygdrive/c.

@charleso
Copy link
Owner

Ahh. So you're trying to import a file on the 'fp01_7.0_rus' branch, but your 'branches' is only set to 'main'? You need to have your gitcc config file with something like:

[master]
branches=main|fp01_7.0_rus

You have to name the tip of the branch - it doesn't match on parents branches. You might want to remove that extra pop() if that's the case.

As to your problem, there isn't much we can do if cleartool doesn't understand 'cygdrive'. I'm happy to accept a patch that strips it from cleartool commands if that fixes it. Alternatively you can run gitcc under msysygit, which I know works.

@AndreyPavlenko
Copy link
Contributor Author

Hi Charles,

Please look at this patch https://gist.github.com/1240430.

I've added new function path() which converts cygwin's paths using the cygpath utility.

@charleso
Copy link
Owner

Hi Andrey,

Sorry for the delay. Been very busy here. The patch looks good. If you send me a pull request I'll happily accept.

Are things working now you've made that change?

Charles

@AndreyPavlenko
Copy link
Contributor Author

Hi Charles,

I've sent you the pull request.

Yes, gitcc rebase works fine after applying this patch. Thank you for your help.

@charleso charleso closed this as completed Oct 7, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants