Partial commit, partial undo

[email protected] (Ludovic Courtès)
Newsgroups gmane.comp.version-control.arch.user
Organization LAAS-CNRS
Message-ID <[email protected]>
Hi,

"Andy Tai" <[email protected]> writes:

> So the problem does not depend on how the file list to commit is specified..

I believe that's exactly what he meant.  But still, there _is_ a problem
and now one more way to exercise it.  ;-)

But basically, it seems to me that this problem depends on the semantics
of partial commit.  Suppose this:

  # Pristine tree
  $ tla mv b c
  $ tla mv a b
  $ vi b
  # ...
  $ chmod a+x b
  $ tla commit -x b

What does this `commit' mean?

  1. Commit everything but the renaming of `b' to `c'.

  2. Commit everything but the renaming of `a' to `b'.

  3. Commit everything but the changes made to the file that used to be
     named `b'.

  4. Commit everything but the changes made to the file currently known as
     `b'.

  5. Commit everything but the permission changes made to the file
     that used to be named `b'.

  6. Commit everything but the permission changes made to the file
     currently named `b'.

  7. Any combination of the above.  ;-)

I'm not sure there exists a general solution to this problem, because
sometimes you'll want some semantics, and sometimes some other.  Note
that the same problem arises with partial undo.

A better approach would be to list file IDs instead of file names.  For
instance:

  $ tla commit -x `tla id b | cut -f 2`

This is much less ambiguous but also less convenient.  Then we could
assume, in this example, that both data and meta-data modifications
(including renaming and permissions) are excluded from the commit.  But
then, in this very example, `commit -x b' would be impossible because of
the other renaming --- but after all, that is something the user should
expect.

Conclusion: as a first approach, I'd add a `--ids' option to all the
selective commands (`commit' and `undo') so that one can specify things
less ambiguously.

Then we could also add a `--name' and a `--permissions' option to
specify that we only want to undo/commit/exclude changes made to the
name or permissions.  But that is probably less useful.

Thanks,
Ludovic.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.