ros-infrastructure/catkinize — pull request #37 by sotte (2013-08-12 06:27:00+00:00)
Title: Refactor/Simplification changeset

This was issue #27 (which I'll close). Here is the original text.

Catkinize offers this "changeset" or "interactive mode" feature in which it basically prints a big list of all changes. I like the idea but in my experience it is not really too useful. The list is normally too big (especially when you catkinize a stack) and you should verify the changes (probably with git, your favorite diff tool) anyway.

Also the changeset approach obfuscates what really happens. Depending on if file names in the changeset exist (and/or the content) you backup/delete/change files. This is really implicit and, as you know, "explicit is better than implicit" :)

Another point is, that the description of what is going to happen (prompt_changes()) and the logic is divided. The logic itself is also divided into create_changeset() and perform_changes().

So I propose a simplified method outlined below:
(I know it must change a bit for catkinize_stack.)
```
possible = handle_manifest(dryrun=True) and handle_cmake(dryrun=True) and handle_make(dryrun=True)

if possible and confirm('continue?'):
handle_manifest(dryrun=False)
handle_cmake(dryrun=False)
handle_make(dryrun=False)
```
handle_X return True if it can perform all actions. In dryrun-mode, handle_X does not perform any file operations and therefore is side effect free.

Also the handle_X methods are more flexible that the current changeset-approach.

What do you think?

The pull request is a work in progress!