full clearcase history for gource

2019-05-27 11:49发布

问题:

I have tried to get the full history of a clearcase vob to parse it and use it with gource to get a visual representation of the changes, but I do not find the right commands to get an easy log history to parse with clearcase2gource python script. I do not use UCM, there are no streams, just plain cleacase.

With this command I get elements with @@ in the middle of a path:

cleartool lshistory -fmt "Element: %n| Date: %d| User:%u| Operation: %e| Object:%[type]p| SimpleType: %m| OperationKind: %o\n" -all /vobs/vob_name

With this command I get elements like this (deleted at some point):

Element: /vobs/vob_name/dir1@@/main/branch_dev/2/dir2/main/branch_pilot/1/file@@/main/branch_pilot/1| Date: 2008-04-15T16:58:28+02:00| User:reeasjp| Operation: create version| Object:compressed_file| SimpleType: version| OperationKind: checkin

That makes more difficult to parse for gource because of several branch names in the middle.

Is there any way to get a full history of all the elements with just plain directories and file names?

Thanks in advance.

NOTE: In the config Spec I have just "/main/LATEST".

回答1:

The issues are:

  • clearcase2gource.py processed the extended paths (see "About the version-extended path") found by cleartool lshistory with some hard-coded assumptions.
    e = d['Element']
    splitElement = e.split("@@")
    d['FileName'] = splitElement[0]
    d['StreamName'] = splitElement[1]
    # StreamName starts with /main/ which we aren't interested in.
    # Remove the /main/ (slice on 5 because there are 5 chars in /main/)
    d['StreamName'] = d['StreamName'][5:]
  • the cleartool lshistory --all will list history of deleted elements (non-visible anymore in the current ClearCase view), hence the multiple branch names.

The easiest solution would be to:

  • redirect the cleartool lshistory output to a file, and
  • then filter out all the extended paths which don't conform to clearcase2gource.py expectation: for instance, just for testing, keep only the ones in a specific branch or in /main only, just to see if that works better.
  • finally feed that file as input to clearcase2gource.py