[PATCH] Commit: Add git-like partial file commit functionality

22 views
Skip to first unread message

Mitja Špes

unread,
Oct 7, 2026, 3:26:28 AMOct 7
to TortoiseSVN-dev
Hi,

This patch series adds a "partial commit" functionality to the commit dialog,
similar to the line staging in Git clients. The patches are against trunk r29830.

The commit dialog shows the diff of the selected file at the right of the
file list. A check box in front of each added or removed line selects the
line for the commit. The check box in front of a "@@" line selects the
whole change. When the user clicks OK, TortoiseSVN writes only the selected
changes to the file, commits, and restores the full file after the commit.
This uses the existing "Restore after commit" mechanism.

Files in the series:

0001-commit-restore-touch.patch
    Commit: fixed restored files not detected as modified
    - the final restore in CommitCommand touches the file, like the other restore paths

0002-commit-dialog-partial-commit-code.patch
0003-commit-dialog-partial-commit-new-files.patch
0004-commit-dialog-partial-commit-resources-doc.patch
    Commit dialog: commit selected lines of a file
    - diff panel at the right of the file list, check box for each changed line and each change
    - splitter between the file list and the diff panel, "Show changes" hides the panel
    - Space toggles the selected lines, the context menu selects or deselects a change or all changes
    - unselected changes stay in the working copy after the commit, also after a failed commit
    - available for modified text files only (no binary, UTF-16/32, symlinks, files over 10 MB)

    The feature is in three patches, for review:
    - 0002: changes to existing source files and the project files
    - 0003: new files PartialDiff.cpp/.h and DiffSelectCtrl.cpp/.h
    - 0004: dialog layout and strings (TortoiseProcENG.rc, resource.h)
      and the user guide

Implementation notes:
- PartialDiff reads BASE with svn_client_cat3 (keywords expanded, working copy
  eol style), diffs it with svn_diff_mem_string_diff and builds the partial
  file from raw byte ranges, so BOM, line endings and encoding stay unchanged.
- DiffSelectCtrl is a read-only Scintilla control with RGBA check box markers
  in a sensitive margin.
- CSVNStatusListCtrl::CreateRestoreCopy() is the "Restore after commit" code,
  moved into a public method so that the commit dialog can use it.

Preview:
preview.PNG

Kind regards,
Mitja
0002-commit-dialog-partial-commit-code.patch
0003-commit-dialog-partial-commit-new-files.patch
0001-commit-restore-touch.patch
0004-commit-dialog-partial-commit-resources-doc.patch

Stefan

unread,
Oct 11, 2026, 5:19:44 AM (11 days ago) Oct 11
to TortoiseSVN-dev
Ok, wow!
Thanks for the patch!
I've committed your changes in r29833 and r29834.

Stefan

Mitja Špes

unread,
Oct 12, 2026, 3:49:20 AM (10 days ago) Oct 12
to TortoiseSVN-dev on behalf of Stefan
Thank you for including it.

Mitja

--
You received this message because you are subscribed to a topic in the Google Groups "TortoiseSVN-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tortoisesvn-dev/AAMxCberHfg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tortoisesvn-d...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/tortoisesvn-dev/b1e43ef9-a735-4835-a751-d9eb8e5094c0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages