Commit Graph

25 Commits

Author SHA1 Message Date
Matt Mackall
fe7062dd37 tests: update for commit --secret 2013-07-18 16:29:05 -05:00
Julien Cristau
2c91c44855 tests: don't hardcode errno==2 for ENOENT
Hurd seems to set ENOENT to 2 + 2**30, unlike everyone else.
2012-12-04 14:35:02 +01:00
FUJIWARA Katsunori
477c2590ac help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.

So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.

Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.

This patch indicates help omitting, if help document is not fully
displayed.

For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:

    use "hg -v help xxxx" to show more complete help and the global
    options

and otherwise:

    use "hg -v help xxxx" to show the global options

For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:

    use "hg help -v xxxx" to show more complete help

This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.

This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 10:31:15 +09:00
timeless@mozdev.org
f029229d67 spelling: nonexistent 2012-08-17 13:58:18 -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
Olav Reinert
c77c77574f help: format all output using RST
This change is the last patch needed to implement help text generation based
only on formatting a single text object marked up with RST.
2012-06-02 11:28:43 +02:00
Idan Kamara
66000da94d commit: add option to amend the working dir parent
The --amend flag can be used to amend the parent of the working directory
with a new commit that contains the changes in the parent in addition to
those currently reported by "hg status", if there are any. The old commit
is stored in a backup bundle in ".hg/strip-backup"(see "hg help bundle"
and "hg help unbundle" on how to restore it).

Message, user and date are taken from the amended commit unless specified.
When a message isn't specified on the command line, the editor will open
with the message of the amended commit.

It is not possible to amend public changesets (see "hg help phases") or
changesets that have children.

Behind the scenes, first commit the update (if there is one) as a regular
child of the current parent. Then create a new commit on the parent's
parent with the updated contents. Then change the working copy parent
to this new combined changeset. Finally, strip the amended commit and
update commit created in the beginning.

An alternative (cleaner?) approach of doing this is suggested here:
http://selenic.com/pipermail/mercurial-devel/2012-March/038540.html

It is currently not possible to amend merge commits or recursively,
this can be added at a later time.
2012-04-18 01:20:16 +03: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
Olav Reinert
cfc7a5074e minirst: simplify and standardize field list formatting
The default width of field lists is changed from 12 to 14 to align minirst with
the rst2html tool. Shrinking the width of the left column to fit the content is
removed, to keep formatting simple and uniform.
2012-01-11 18:08:25 +01:00
Mads Kiilerich
637e2ecde2 tests: hide 'No such file or directory' messages
Windows will use a different and localized message.
2011-11-16 03:45:14 +01:00
Martin Geisler
acfa971cf1 subrepos: abort commit by default if a subrepo is dirty (BC)
This changeset flips the default value of ui.commitsubrepos setting
from True to False and adds a --subrepos flag to commit.

The commit, status, and diff commands behave like this with regard to
recusion and the ui.commitsubrepos setting:

          | recurses      | recurses
          | by default    | with --subrepos
  --------+---------------+----------------
  commit: | commitsubrepo | True
  status: | False         | True
  diff:   | False         | True

By changing the default from True to False, the table becomes
consistent in the two columns:

* without --subrepos on the command line, commit will abort if a
  subrepo is dirty and status/diff wont show changes inside subrepos.

* with --subrepos, all three commands will recurse.

A --subrepos flag on the command line overrides the config settin.g
2011-10-21 00:33:08 +02:00
Matt Mackall
58c81fa35e help: unify the two -v notes for command help 2011-10-07 16:36:54 -05:00
Matt Mackall
4204f3ffa5 help: use RST to format option lists 2011-09-21 13:00:48 -05:00
Ingo Proetel
bef424c7fa record: add white space diff options 2011-06-10 10:58:10 +02:00
Idan Kamara
1c58f33fac mq: allow --mq for qrecord 2011-05-27 17:49:54 +03:00
Idan Kamara
91b788592f record: check patch name is valid before prompting in qrecord 2011-05-24 19:17:02 +03:00
Idan Kamara
d5c206ffa2 extensions: raise when trying to find an extension that failed to load
extensions that depend on other extensions (such as record) use this pattern
to check if the dependant extension is available:

    try:
        mq = extensions.find('mq')
    except KeyError:
        return

but since if an error occurs while loading an extension it leaves its entry
in the _extensions map as None, we want to raise in that situation too.

(rather than adding another check if the return value is None)
2011-05-23 23:09:00 +03:00
Martin Geisler
539e56249b merge with stable 2011-04-26 13:13:35 +02:00
Adrian Buehlmann
3efb31d590 help: do not show full help text for command on option errors
Example

  $ hg clone --jump foo bar
  hg clone: option --jump not recognized
  hg clone [OPTION]... SOURCE [DEST]

  make a copy of an existing repository

  options:

   -U --noupdate           the clone will include an empty working copy (only a
                           repository)
   -u --updaterev REV      revision, tag or branch to check out
   -r --rev REV [+]        include the specified changeset
   -b --branch BRANCH [+]  clone only the specified branch
      --pull               use pull protocol to copy metadata
      --uncompressed       use uncompressed transfer (fast over LAN)
   -e --ssh CMD            specify ssh command to use
      --remotecmd CMD      specify hg command to run on the remote side
      --insecure           do not verify server certificate (ignoring
                           web.cacerts config)

  [+] marked option can be specified multiple times

  use "hg help clone" to show the full help text

Motivation for this change

  If the user already has specified the command, he probably already knows
  the command to some extent. Apparently, he has a problem with the options,
  so we show him just the synopsis with the short help and the details about
  the options, with a hint on the last line how to get the full help text.

Why is Mercurial better with this change?

  Experts who just forgot about the details of an option don't get that
  much text thrown at them, while the newbies still get a hint on the last
  line how to get the full help text.
2011-04-17 11:37:11 +02:00
timeless
ccf3a292e9 qrecord: provide help when mq is not enabled 2011-04-14 10:00:15 +02:00
timeless
b539dea45e record: improve help test coverage 2011-04-14 10:00:14 +02: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
Mads Kiilerich
2fcf673aef tests: handle .t files without trailing LF
203ffed27f86 made this simple test-test.t succeed silently:
  $ printf '  $ true' > test-test.t
but did not give a usable .err in this case:
  $ printf '  $ false' > test-test.t

The missing LF will now be fixed in the test output and it will thus give a
test failure and a solution in the .err file.
2010-11-06 00:31:44 +01:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Dan Villiom Podlaski Christiansen
f84e31bda1 tests: unify test-qrecord 2010-08-27 16:25:47 +02:00