Commit Graph

26 Commits

Author SHA1 Message Date
Matt Mackall
ab8d3b450f ui: fix extra space in username abort 2014-02-27 15:14:37 -06:00
Matt Mackall
7c4d60a93e tests: fix up config --edit breakage 2014-02-27 14:58:44 -06: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
Kevin Bullock
5747742d25 check-code: add a rule against a GNU sed-ism
BSD sed requires the 'i' command to be followed with a backslash and a
newline, like so:

  $ sed -e '/^@/i\
  > other'

We've encountered this problem before, e.g. in test-mq.t (215a8789129e).
This change adds a check-code rule and fixes two instances of the
problem in test-record.t.
2013-04-22 16:33:28 -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
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
Sumeet
de52249a43 record: checks for valid username before starting recording process (issue3456) 2012-08-27 12:41:10 -07:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Mads Kiilerich
d733986c74 tests: consistently use a HGEDITOR pattern that works with msys on windows
Removing the need for an executable sh script that can be run from a native
windows application enables some tests for running on windows.
2012-06-10 14:41:14 +02:00
Mads Kiilerich
4f14a0a969 tests: convert some 'hghave execbit' to #if
This enables some new tests for running on windows.
2012-06-10 14:14:05 +02:00
Matt Mackall
7f19fb4f8f tests: fix one more sed -i 2012-04-01 15:35:12 -05:00
Matt Mackall
4325ad525f tests: remove sed -i from test-record 2012-04-01 13:59:11 -05: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
a968007692 merge with stable 2011-12-08 16:01:44 -06:00
Matt Mackall
a69962e18c branch: warn on branching 2011-12-08 14:32:44 -06:00
Mads Kiilerich
adfff587c7 tests: use 'hghave execbit' for tests that manipulate x bit in file system 2011-11-07 03:14:54 +01:00
Patrick Mezard
4554668a40 record: do not include files into changes count
This turns the prompt sequence from something like:

  $ examine changes to foo?
  $ record change 1/4 to foo?
  $ record change 2/4 to foo?
  $ examine changes to bar?
  $ record change 4/4 to bar?

into:

  $ examine changes to foo?
  $ record change 1/3 to foo?
  $ record change 2/3 to foo?
  $ examine change to bar?
  $ record change 3/3 to bar?
2011-01-24 23:25:46 +01:00
Patrick Mezard
6d77e4eebb test-record: test peculiar changes numbering 2011-01-23 15:21:34 +01:00
timeless
2f8d0b40e3 record: quote command in use hg commit message 2010-11-21 05:07:06 -06:00
Martin Geisler
b25b3e7e4f tests: test/silence win32text deprecation warning 2010-10-25 23:55:43 +02:00
Matt Mackall
200e89394d tests: fix a bunch of pointless #s in unified tests 2010-09-17 17:03:08 -05:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Dan Villiom Podlaski Christiansen
52c63d3a07 tests: unify test-record 2010-08-27 16:25:47 +02:00