You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run into this problem during executing "gitcc rebase" command. Let me elaborate the reproduce steps:
check in a new file using some tools like CCRC (clear case remote client) which makes the version 1 of this file shares the same modified time as that in its parent folder
then migrate that repository to git. After rebase the new file's content is lost, it becomes an empty file.
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:
classUncataloged(Changeset):
defadd(self, files):
......
history=filter(None, history.split('\n')) # contains version1 and version0all_versions=self.parse_history(history)
date=cc_exec(['describe', '-fmt', '%Nd', dir])
actual_versions=self.filter_versions(all_versions, lambdax: 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 nowifnotversions:
print("No proper versions of '%s' file. Check if it is empty."%added)
versions=self.empty_file_versions(actual_versions) #version 0 is added backifnotversions:
print("It appears that you may be missing a branch in the includes section of your gitcc config for file '%s'."%added)
continueself._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:
change
lambdax: x[1] <date
to
lambdax: x[1] <=date
if the versions is empty after
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.
The text was updated successfully, but these errors were encountered:
Yes, you are right, it is due to issue #20 . But I don't think it is an issue. As far as I know, if you create a new branch and add a new file in the new branch, not only the version 0 and version 1 will be added in the new branch, but also version 0 (empty file) will be added in the origin branch.
in #20's case, XieDong added the file in the "css_refactor" branch, there should be no such file in the main branch, but due to some mechanism in clear case, this file is added into main branch as an empty file.
So I don't think we should add this empty file back after migrating. Let me fork and make the change.
Thanks
Lei
jslhcl
added a commit
to jslhcl/git-cc
that referenced
this issue
Apr 24, 2015
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:
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:
to
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.
The text was updated successfully, but these errors were encountered: