Previous: Using vc-dwim, Up: vc-dwim


2.2 Invoking vc-dwim

Synopsis:

     vc-dwim [option...] [changelog_file...]
     vc-dwim [option...] --commit changelog_file...
     vc-dwim [option...] --diff [file...]
     vc-dwim [option...] --print-vc-list

By default, each command line argument should be a locally modified, version-controlled ChangeLog file. If there is no command line argument, vc-dwim tries to use the ChangeLog file in the current directory. In this default mode, vc-dwim works by first computing diffs of those files and parsing the diff output to determine which named files are being changed. Then, it diffs the affected files and prints the resulting output. One advantage of using this tool is that before printing any diffs, it warns you if it sees that a ChangeLog or an affected file has unsaved changes. It detects that by searching for an editor temporary file corresponding to each affected file. Another common error you can avoid with this tool is the one where you create a new file, add its name to Makefiles, etc., mention the addition in ChangeLog but forget to e.g., git add (or hg add, etc.) the file to the version control system. vc-dwim detects this discrepancy and fails with a diagnostic explaining the probable situation. You might also have simply mistyped the file name in the ChangeLog.

Once you are happy with your ChangeLog-derived diffs, you can commit those changes and the ChangeLog simply by rerunning the command with the --commit option.

But what if you'd like to use vc-dwim on a project that doesn't have or want a ChangeLog file? In that case, you can maintain your own, private, version-controlled ChangeLog file in a different hierarchy. Then just make a symlink to it from the top level directory of the hierarchy in which you'd like to use it and everything should work. Your private ChangeLog file need not even use the same version control system as the rest of the project hierarchy.

vc-dwim accepts the following options:

--help
Display help and exit.
--version
Output version information and exit.
--author="User Name <user@example.org>"
Specify the user name and email address of the author of this change set.
--commit
Perform the commit, too.
--diff
Determine which version control system manages the first file, then use that to print diffs of the named files. If no file is specified, print all diffs for the current hierarchy.
--print-vc-list
Print the list of recognized version control names, then exit.
--verbose
Generate verbose output.
--debug
Generate debug output.

This tool can be useful to you only if you use a version control system. It's most useful if you maintain a ChangeLog file and create a log entry per file per “commit” operation.

Relies on fairly strict adherence to recommended ChangeLog syntax. Detects editor temporaries created by Emacs and Vim. Eventually, it will detect temporaries created by other editors.