You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Andrew Thorburn <nz...@gmail.com> on 2010/01/19 01:10:48 UTC

Partial Commits of an individual file?

I'm wondering if there has been any discussion about the ability to
commit bits and pieces of a file.

e.g.:

I have a particular bit of code in a project I'm working on which is
very large (too large), and I frequently need to make changes to it
for multiple issues. This means that when I go to commit, I have to
make a single commit which fixes or implements multiple issues. This
isn't really ideal, as it means that you can't look at the diffs of
the file to see which change applies to which issue - you just see a
nice big list of changes, and have to guess at what changes apply to
what issue.

I can't always commit straight away, as I need to wait for
confirmation that the fix is *actually* required, so I might move on
to the next issue which could require changes to the same file.

Ideally, I would like to be able to select the lines I want to commit
(or not commit, as the case may be), but as far as I'm aware, this
isn't possible with SVN, or any third-party tools? For what it's
worth, I currently use Subversive in Eclipse, and SVN 1.6 (not sure
exactly what version) as the client, and something really, really old
on the server.

Thanks,

- Andrew Thorburn

Re: Partial Commits of an individual file?

Posted by Tyler Roscoe <ty...@cryptio.net>.
On Tue, Jan 19, 2010 at 02:10:48PM +1300, Andrew Thorburn wrote:
> I have a particular bit of code in a project I'm working on which is
> very large (too large), and I frequently need to make changes to it
> for multiple issues. This means that when I go to commit, I have to
> make a single commit which fixes or implements multiple issues. This
> isn't really ideal, as it means that you can't look at the diffs of
> the file to see which change applies to which issue - you just see a
> nice big list of changes, and have to guess at what changes apply to
> what issue.

I would use a shelf (or branch). Copy the file from trunk, make change
#1, commit to shelf, make change #2, commit to shelf, etc.

Then when you know what changes are actually needed, you can merge them
one-by-one back to trunk.

tyler

Re: Partial Commits of an individual file?

Posted by Lieven Govaerts <sv...@mobsol.be>.
On Tue, Jan 19, 2010 at 2:10 AM, Andrew Thorburn <nz...@gmail.com> wrote:
> I'm wondering if there has been any discussion about the ability to
> commit bits and pieces of a file.
>
> e.g.:
>
> I have a particular bit of code in a project I'm working on which is
> very large (too large), and I frequently need to make changes to it
> for multiple issues. This means that when I go to commit, I have to
> make a single commit which fixes or implements multiple issues. This
> isn't really ideal, as it means that you can't look at the diffs of
> the file to see which change applies to which issue - you just see a
> nice big list of changes, and have to guess at what changes apply to
> what issue.
>
> I can't always commit straight away, as I need to wait for
> confirmation that the fix is *actually* required, so I might move on
> to the next issue which could require changes to the same file.
>
> Ideally, I would like to be able to select the lines I want to commit
> (or not commit, as the case may be),

While I'd like to have such a  feature in svn, I don't think this is
what you need (as Tyler also indicates in his response).

If you work on one issue after the other, you can commit your work on
some temporary branch (shelf,...). When it's decided that the fix is
needed, you can merge the changes from your temporary branch to your
main development branch easily. With this approach your work is cut
into pieces (per issue), it's safe in the repository and your working
copy is clean to continue working on other issues.

I'd never use a 'commit only these chunks of these files' tool on Java
code. You build and probably test your code before commit, and if you
only take parts of it and move those to the repository, you risk that
the resulting commit will break the build on your branch.

What such a tool would be handy for is when working with text files
(documents), HTML etc. I'm thinking of committing parts of a file,
reverting chunks of change set or marking such chunks as to-be-ignored
during a commit.

> but as far as I'm aware, this isn't possible with SVN, or any third-party tools?

Not that I'm aware of.

[..]

Lieven