Commit Graph

140 Commits

Author SHA1 Message Date
Laurent Charignon
1e69c9cdfb record: make hg record always use the non curses interface
Before this patch, hg record was running hg commit -i, therefore with the
experimental.crecord=True flag, hg record was actually launching the curses
record interface. Some of our users could be confused by that.
This patch makes the hg record command set this flag to False, ensuring that
hg record never shows the curses interface.
commit -i, shelve -i and revert -i remain unchanged and use the curses
interface if the experimental.crecord flag is set.
2015-05-13 20:30:12 -07:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Laurent Charignon
8e36c9d449 record: change interface of dorecord to accept new filters
This makes it easier to add different filtering logic (record /crecord ...)
2015-03-11 16:39:38 -07:00
Laurent Charignon
d98e8547de record: make record use commit -i 2015-03-11 15:54:11 -07:00
Laurent Charignon
00e39c0a37 record: add interactive option to the commit command 2015-03-11 15:22:04 -07:00
Laurent Charignon
b5de5559b7 record: move dorecord from record to cmdutil
Part of a serie of patches to move record from hgext to core
2015-03-10 17:14:33 -07:00
Laurent Charignon
e4283d0dfb record: remove dependency on hg module in record
Part of a series of patches to move record from hgext to core
2015-03-10 17:09:07 -07:00
Laurent Charignon
c30de5b61f record: remove dependency on extensions module in dorecord
Part of a series of patches to move record from hgext to core
2015-03-10 17:03:40 -07:00
Laurent Charignon
742d78e9af record: move filterpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-10 14:42:07 -07:00
Siddharth Agarwal
8e295dc1a9 patch.internalpatch: add a default value for prefix
Rev cb4d72125aae adding a parameter here. This breaks third-party extensions
like crecord and also makes the issue fairly hard to fix on the extension's
side if it wants to retain compatibility across Mercurial versions -- in old
versions, the positional argument will be passed into the next unknown
argument, which is 'files'.

The patch also undoes a change to the record extension that is no longer
necessary.
2015-03-10 17:34:42 -07:00
Laurent Charignon
39d2901c91 record: move parsepatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:16:25 -07:00
Laurent Charignon
18e7b1d4da record: move scanpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:14:31 -07:00
Laurent Charignon
b8126743d5 record: move hunk class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:09:15 -07:00
Laurent Charignon
ccb2a5f8f4 record: move countChanges in the hunk class
Part of a series of patches to move record from hgext to core
2015-03-09 13:08:19 -07:00
Laurent Charignon
3b17682474 record: move header class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:04:50 -07:00
Siddharth Agarwal
f5f1d70d92 patch.internalpatch: accept a prefix parameter 2015-03-06 22:43:47 -08:00
Laurent Charignon
e0bce75a1d record: allow editing new files (issue4304)
While using the record extension to select changes, the user couldn't see the
content of newly added files and had to select/reject them based on filename.
The test is changed accordingly in two places.
2015-03-06 15:57:43 -08:00
Siddharth Agarwal
0b150be7b2 record: don't honor format-changing diffopts (issue4459)
record does support the whitespace options, so honor those. In upcoming patches
we'll replace all the other uses.
2014-11-18 20:00:37 -08:00
Yuya Nishihara
ceda6fbba9 util.system: use ui.system() in place of optional ui.fout parameter 2014-11-08 13:06:22 +09:00
Martin von Zweigbergk
5ea3a9fbd3 record: access status fields by name rather than index
It is safe to pass the full status to patch.diff() since it does its
own slicing.
2014-10-03 10:44:07 -07:00
Jordi Gutiérrez Hermoso
a3f845b50e record: update comment to match code
Commit 9bcdffd81aaf changed how newfiles get passed to commitfunc, but
did not change the corresponding comment that explains this. This
commit also updates this comment.
2014-06-26 11:10:28 -04:00
Gregory Szorc
6000635fc2 record: define inferrepo in command decorator 2014-05-04 22:36:07 -07:00
Gregory Szorc
5785fc1837 record: declare commands using decorator 2014-05-04 22:35:37 -07:00
Pierre-Yves David
0d013e32a2 record: use absolute path instead of os.chdir
Record was changing the current directory to `repo.root` in order to be able to
feed `command.commit` file name relative to this `repo.root`. This is a bit
overkill and prevent an incoming fix to rebase. This would also break
multi-threaded usage.

Instead we just feed `command.commit` with absolute path name. works as well as
before but without chdir.
2014-01-31 14:52:53 -08:00
Jordi Gutiérrez Hermoso
aeb19f9922 record: re-enable whitespace-ignoring options
It looks like somewhere down the line, patch.diffopts changed the
names of the options that it recognises, but record.recordfunc wasn't
updated to the new names. Instead of trying to write down names at
all, we now use whatever names are provided in commands.diffwsopts and
pass that along to patch.diffopts, along with a couple of custom
options
2014-01-16 15:05:03 -05:00
Jordi Gutiérrez Hermoso
ccf7869bdf record: use commands.diffwsopts instead of ad-hoc diffopts
The record extension is writing its own version of commands.diffwsopts
which is identical to commands.diffwsopts. Based on the principle that
code duplication increases maintenance burden, this patch removes
record's ad-hoc diffopts in favour of commands.diffwsopts
2014-01-16 14:57:52 -05:00
FUJIWARA Katsunori
c2ab815c76 record: use "ui.extractchoices()" to get the list of available responses
Before this patch, record extension gets the list of available
responses from online help document of "hg record" in the tricky way,
even though the value passed to "ui.promptchoice()" has enough (maybe
i18n-ed) information.

This patch uses "ui.extractchoices()" to get the list of available
responses.
2013-12-02 00:50:30 +09:00
Prasoon Shukla
7c782e5502 record: --user/-u now works with record when ui.username not set (issue3857)
The -u flag didn't work when ui.username was not set and resulted in an
abort message. This was fixed by checking for the 'user' key in the opts
dictionary. If the key is present, the step causing the exception is not
executed.
2013-12-12 12:25:56 +05:30
Matt Mackall
d177c8d161 record: add checkunfinished support (issue3955) 2013-07-25 02:34:09 -05:00
Matt Mackall
13d2a13ea6 ui: merge prompt text components into a singe string
This will help avoid problems with partial or mismatched translation
of the components.
2013-05-22 17:31:43 -05:00
Mads Kiilerich
886d6922c4 record: ignore trailing content when parsing patches - introduce 'other' lines
This makes record work more like import which ignores for instance mail footers
in a patch file.

This also makes it possible for TortoiseHg to preview unapplied patches
containing such footers.
2012-06-13 23:06:34 +02:00
Mads Kiilerich
dbfffc0abf record: abort on malformed patches instead of crashing 2013-04-11 19:03:33 +02:00
Idan Kamara
ba14804c98 record: remove unused import 2013-01-09 21:13:52 +02:00
Denis Laxalde
b706c87e50 record: use patch.diffopts to account for user diffopts
This allows user defined diff options (e.g. showfunc) to be accounted for
when using record. A test has been updated accordingly.
2013-01-08 21:16:39 +01:00
Siddharth Agarwal
a5e71891bd commands: don't infer repo for commands like update (issue2748)
Maintain a whitelist of commands to infer the repo for instead. The whitelist
contains those commands that take file(s) in the working dir as arguments.
2012-10-16 11:43:15 -07:00
Nikolaj Sjujskij
88edfbe265 record: fix display of non-ASCII names in chunk selection
46cdcb89086f fixed display of non-ASCII names in file-selecting prompt, but
display in chunk selection remained broken. The reason is that using '%r' in
string formatting results in calling `repr` on file names, thus mangling
non-ASCII ones.
2012-09-15 00:06:08 +04:00
Sumeet
de52249a43 record: checks for valid username before starting recording process (issue3456) 2012-08-27 12:41:10 -07:00
Mads Kiilerich
2372d51b68 fix wording and not-completely-trivial spelling errors and bad docstrings 2012-08-15 22:39:18 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Matt Mackall
f52103b924 merge with stable 2012-07-01 21:20:30 -05:00
Matt Mackall
921065f3f8 record: fix display of non-ASCII names
spotted by Nikolaj Sjujskij
2012-07-01 13:10:54 -05:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Matt Mackall
58dccf8b84 record: fix up test issues
sed on BSD requires an arg to -i
sed failing exposed an uninitialized variable issue
2012-03-31 14:04:39 -05:00
A. S. Budden
285680e0f0 record: allow splitting of hunks by manually editing patches
It is possible that unrelated changes in a file are on sequential lines.  The
current record extension does not allow these to be committed independently.

An example use case for this is in software development for deeply embedded
real-time systems.  In these environments, it is not always possible to use a
debugger (due to time-constraints) and hence inline UART-based printing is
often used.  When fixing a bug in a module, it is often convenient to add a
large number of 'printf's (linked to the UART via a custom fputc) to the module
in order to work out what is going wrong.  printf is a very slow function (and
also variadic so somewhat frowned upon by the MISRA standard) and hence it is
highly undesirable to commit these lines to the repository.  If only a partial
fix is implemented, however, it is desirable to commit the fix without deleting
all of the printf lines.  This is also simplifies removal of the printf lines
as once the final fix is committed, 'hg revert' does the rest.  It is likely
that the printf lines will be very near the actual fix, so being able to split
the hunk is very useful in this case.

There were two alternatives I considered for the user interface.  One was to
manually edit the patch, the other to allow a hunk to be split into individual
lines for consideration.  The latter option would require a significant
refactor of the record module and is less flexible.  While the former is
potentially more complicated to use, this is a feature that is likely to only
be used in certain exceptional cases (such as the use case proposed above) and
hence I felt that the complexity would not be a considerable issue.

I've also written a follow-up patch that refactors the 'prompt' code to base
everything on the choices variable.  This tidies up and clarifies the code a
bit (removes constructs like 'if ret == 7' and removes the 'e' option from the
file scope options as it's not relevant there.  It's not really a necessity, so
I've excluded it from this submission for now, but I can send it separately if
there's a desire and it's on bitbucket (see below) in the meantime.

Possible future improvements include:

* Tidying up the 'prompt' code to base everything on the choices variable.
  This would allow entries to be removed from the prompt as currently 'e' is
  offered even for entire file patches, which is currently unsupported.
* Allowing the entire file (or even multi-file) patch to be edited manually:
  this would require quite a large refactor without much benefit, so I decided
  to exclude it from the initial submission.
* Allow the option to retry if a patch fails to apply (this is what Git does).
  This would require quite a bit of refactoring given the current 'hg record'
  implementation, so it's debatable whether it's worth it.

Output is similar to existing record user interface except that an additional
option ('e') exists to allow manual editing of the patch.  This opens the
user's configured editor with the patch.  A comment is added to the bottom of
the patch explaining what to do (based on Git's one).

A large proportion of the changeset is test-case changes to update the options
reported by record (Ynesfdaq? instead of Ynsfdaq?).  Functional changes are in
record.py and there are some new test cases in test-record.t.
2012-03-30 22:08:46 +01:00
Matt Mackall
4dc5f821e2 record: use command wrapper properly for qnew/qrefresh (issue3001) 2011-10-01 15:47:03 -05:00
Ingo Proetel
bef424c7fa record: add white space diff options 2011-06-10 10:58:10 +02:00
Idan Kamara
a7eca9ebe7 record: fix options placeholder 2011-05-26 19:00:47 +03:00
Idan Kamara
67e075c860 record: alias qrecord to qnew -i/--interactive 2011-05-24 19:17:22 +03:00
Idan Kamara
dcebc5aaa6 record: add qrefresh -i/--interactive
interactively select changes to refresh
2011-05-24 19:17:19 +03:00