Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can I commit individual hunks (hg record)?

In SourceTree's Preferences, the Mercurial pane mentions `record` among the extensions. While not enabled by default, I can tick it.

However, there doesn't appear to be any GUI-level support for making use of this: given a file with multiple changed hunks of which I only wish to commit a select few, I wouldn't know how to select those. The only per-hunk buttons available are "Discard Hunk" and "Discard Selected Lines", which I assume will revert those changes, rather than skip them for this commit.

2 answers

1 accepted

1 vote
Answer accepted

Hi Sören,

The 'record' extension must be appearing because it's included in your own .hgrc - SourceTree lets you enable additional (officially unsupported) extensions, for cases where the behaviour can be implicit - for example kbfiles.

You're right that there's no support for 'record' right now (essentially an equivalent to git staging). I have looked at it before, but right now you can only drive it using an interactive terminal, rather than via command line parameters, and driving console apps this way can be fragile from a non-terminal in my experience. That's why I haven't included it as an official option - this also applies to per-hunk shelving as well.

I hope some time in the future to be able to support this somehow, perhaps via my own extension which replicates record but with entirely command-line parameters.

Cheers

Steve

Yeah, I had my hopes up when I found that one myself, hoping it meant 'command line record' - but it's a curses GUI instead - damn! :)

Thanks for your answer. Yes; I must have added the extension on my own long ago. I had assumed the extension would provide an API, rather than only its own command-line interface. I see now that there is precedent for creating an own, different-interface extension: http://mercurial.selenic.com/wiki/CrecordExtension.

The record extension still works by modifying files on the file system, committing them and then restoring them to their old self (http://bz.selenic.com/show_bug.cgi?id=3591). But as I understand it nowadays Mercurial has “memctx” Python objects which allow you to stage and commit individual changes in-memory. That should be useful. I would love to have the hunk and/or line selection feature in SourceTree for Mercurial as well :).

Interesting, thanks. Unfortunately that would require adding an active Python runtime to SourceTree which is quite heavyweight as a solution. I'm really hoping that Mercurial eventually adds a 'stage for commit' feature.

Hi,

There’s some thread right now going where the TortoiseHg developers are looking into getting patch hunk selection to work again:

http://www.selenic.com/pipermail/mercurial-devel/2013-January/047452.html

Particularly, here is a very small extension that seems to do much of the work:

http://www.selenic.com/pipermail/mercurial-devel/2013-January/047552.html

http://www.selenic.com/pipermail/mercurial-devel/2013-January/047558.html

Perhaps this will be of some use to you?

Hi,

There’s some thread right now going where the TortoiseHg developers are looking into getting patch hunk selection to work again:

http://www.selenic.com/pipermail/mercurial-devel/2013-January/047452.html

Particularly, here is a very small extension that seems to do much of the work:

http://www.selenic.com/pipermail/mercurial-devel/2013-January/047552.html

Perhaps this will be of some use to you?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

5,290 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you