1

For automation/scripting purposes I rebase my ClearCase snapshot view on the UNIX command line using:

cleartool rebase -recommended -complete

Sometimes, while this command runs, even if my snapshot view does not contain any changes at all, I get prompted for manual input to solve some merge conflicts. E.g. "Do you want INSERTION from file x? [yes/no]" or "Do you want DELETION from file y?" or "Do you want CHANGES from file z? [yes/no]". Etc.

When this scenario happens "cleartool rebase -recommended -complete" shows just a few columns of context. I haven't counted, but it feels like only 20 characters are used in the width of the column that display the conflicting changes. With such a narrow view there's no way anyone can make useful merge decisions and it very often leads to bad merges (not to say broken builds).

How can one instruct "cleartool rebase -recommended -complete" to prompt with, say, 80 columns wide of context so one can at least clearly see what the conflicting parts of the code are?

Assume there are no X-Window server available so that graphical merging is not an option. And remember, this is for automation purposes.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user972301
  • 137
  • 8

1 Answers1

1

Considering that only a non-UCM command like cleartool merge has a -column option, a workaround might be to:

  • skip those files with conflicts during the rebase
  • try and merge the source version with the currently checked out version of the file not yet rebased because of conflict, but with a column width larger.

That is:

-col/umns n

Establishes the overall width of side-by-side output.
The default width is 80; only the first 40 or so characters of corresponding difference lines appear.
If n does not exceed the default width, this option is ignored.

The merge would take place while usung the UCM activity set by the rebase, using the destination UCM view.

That would obviously doesn't scale well for many files with conflicts, but as I mentioned before, it could be a workaround.

The OP confirms in the comments that a GUI-based solution remains the way to go:

The alternative using X-Windows worked:

cleartool rebase -recommended -complete -gmerge

As one would expect, this has the same behavior as cleartool rebase -recommended -complete, except that it pops up the xmerge 3-way GUI tool if any non-trivial/non-auto-resolvable merge conflicts are encountered.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It seems so far that this problem is impossible to fix and/or to automate. It brings a question about the root cause... please see this: http://stackoverflow.com/questions/28911519/clearcase-merge-conflict-on-rebase-mystery-why-does-manual-merges-are-sometim – user972301 Mar 07 '15 at 04:54
  • The following link indicates that one can also add the "-force" parameter to suppress user input prompts -- but what's the consequence of that parameter? How is the merge done? Are default prompt answer used and merge results somewhat random? ---- http://www.ipnom.com/ClearCase-Commands/rebase.html – user972301 Mar 07 '15 at 05:56
  • @user972301 the rebase man page (http://www-01.ibm.com/support/knowledgecenter/SSSH27_7.1.1/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_rebase.htm?cp=SSSH27_7.1.1%2F9-0-0-2-20&lang=en) does mention: "The merge options to the rebase command are not affected by the `-force` option": you would still be asked in case of conflict. You would use the `-force` option for other rebase commands, like cancel: `cleartool rebase -cancel -force` – VonC Mar 07 '15 at 08:47
  • @user972301 what version of ClearCase are you using by the way? – VonC Mar 07 '15 at 08:47
  • On the UNIX system I use at work it is 8.0-something. I can double-check for the exact version number if necessary. – user972301 Mar 07 '15 at 17:56
  • Sounds like I might be forced to use the GUI. If I could use "cleartool rebase -recommended -complete -gmerge", would it only pop up the GUI when such an unexpected merge is necessary? Also would it automatically complete the rebase after the merge is done, or would the user manually need to click on "complete" ? Hard for me to test as I'm not too sure on how I could provoke this situation. – user972301 Mar 07 '15 at 22:26
  • @user972301 gmerge is for "graphical merge", and you said you have no GUI available. You always have a "complete" step after a merge (or rebase, or deliver): a merge leaves files and directories checked out. The "complete" step will check them in, and (for rebase or deliver) unset the UCM activity set for that operation. – VonC Mar 07 '15 at 22:42
  • Well there's a way I could get a GUI, as a last resort, to make it simple for users of the automation. I'm just wondering if this could all be doable in a single atomic step with "cleartool rebase -recommended -complete -gmerge". If yes, then all I would need is a way to test it (e.g. provoke a fake merge conflict to try it out). – user972301 Mar 08 '15 at 00:35
  • @user972301 I never saw an "atomic" operation for a merge. The `-complete` is always specified as a second step, when every files and folders have been merged (and are still checked out). – VonC Mar 08 '15 at 00:36
  • Usually specifying everything on a single command line did everything in one step for me (with the occasional user input prompts during the merge part). I'll try to do "cleartool rebase -recommended -complete -gmerge" for a while and see if it helps. That could be the ideal solution to this problem. I wish I could provoke a fake merge conflict to test it out though. – user972301 Mar 08 '15 at 19:18
  • I got very lucky today and reproduced the merge issue while I had to do yet another rebase on my child stream's view which hasn't done any delivery in over a month. The alternative using X-Windows worked: `cleartool rebase -recommended -complete -gmerge` -- As one would expect, this has the same behavior as `cleartool rebase -recommended -complete`, except that it pops up the xmerge 3-way GUI tool if any non-trivial/non-auto-resolvable merge conflicts are encountered. – user972301 Mar 10 '15 at 00:41
  • @user972301 Ok. I have included your conclusion in the answer for more visibility. – VonC Mar 10 '15 at 06:40