Next: , Up: vc-dwim


2.1 How can you use vc-dwim?

Print diffs of arbitrary files:

Use an alias like this to show all or specified diffs:

     alias cv='vc-dwim --diff'

Use that when you want to see diffs of a specified file, regardless of whether you have written new ChangeLog entries for it. It works the same for bzr, cvs, git, hg, svn repositories, as long as all you want are the difference between your local copy and the checked out version.

Print diffs of files with new ChangeLog entries:

Let's say you have made local changes to a file, and you've also added at least one corresponding entry in a ChangeLog file. Then, you can use vc-dwim ChangeLog to print the diffs for which there are ChangeLog entries, warning about the potential problems mentioned above (editor temporaries that can imply there are unsaved changes, and files listed in ChangeLog, but not cvs added). If your changes affect files covered by more than one ChangeLog, you might use vc-dwim ChangeLog lib/ChangeLog, or more concisely, vc-dwim {,lib/}ChangeLog.

Commit changes to files with new ChangeLog entries:

Use vc-dwim --commit ChangeLog or vc-dwim --commit ChangeLog lib/ChangeLog src/ChangeLog to commit the changes you would see without the --commit option.

Assuming you have completed a change and have documented everything in one or more ChangeLog file, run vc-dwim --commit ChangeLog to commit that ChangeLog file and the files “implied” by the new ChangeLog lines. The commit log message is derived from the added ChangeLog lines. With a single ChangeLog file, the log message is nearly identical to the list of added lines. One leading <TAB> is removed and any date user-name <email> lines are elided. When there are two or more ChangeLog files, the log message includes a line for each indicating the affected directory. For example:

     [ChangeLog]
     * some-file-in-top-level-dir: ...
     [lib/ChangeLog]
     * lib.c: ...
     [m4/ChangeLog]
     * foo.m4: ...