Commit Graph

37 Commits

Author SHA1 Message Date
Durham Goode
2591767a70 bundles: do not overwrite existing backup bundles (BC)
Previously, a backup bundle could overwrite an existing bundle and cause user
data loss. For instance, if you have A<-B<-C and strip B, it produces backup
bundle B-backup.hg. If you then hg pull -r B B-backup.hg and strip it again, it
overwrites the existing B-backup.hg and C is lost.

The fix is to add a hash of all the nodes inside that bundle to the filename.
Fixed up existing tests and added a new test in test-strip.t
2015-01-09 10:52:14 -08:00
FUJIWARA Katsunori
855293b5eb memctx: calculate exact status being committed from specified files
Before this patch, "memctx._status" is initialized by "(files, [], [],
[], [], [], [])" and this causes "memctx.modified" to include not
only modified files but also added and removed ones incorrectly.

This patch adds "_status" method to calculate exact status being
committed according to "files" specified at construction time.

Exact "_status" is useful to share/reuse logic of committablectx.

This patch is also preparation for issues fixed by subsequent patches.

Some details of changes for tests in this patch:

  - some filename lines are omitted in "test-convert-svn-encoding.t",
    because they are correctly listed up as "removed" files

    those lines are written out in "localrepository.commitctx" for
    "modified" and "added" files by "ui.note".

  - "| fixbundle" filterring in "test-histedit-fold.t" is omitted to
    check lines including "added" correctly

    "fixbundle" discards all lines including "added".
2014-12-17 15:09:38 +09:00
Matt Harbison
299f5087fd tests: choose the proper environment variable style for the platform
Windows was printing out 'commit $HG_NODE' instead of the actual hash.
2014-11-20 22:33:40 -05:00
Pierre-Yves David
fddc78071a hook: protect commit hooks against stripping of temporary commit (issue4422)
History rewriting commands like histedit tend to use temporary
commits. They may schedule hook execution on these temporary commits
for after the lock has been released. But temporary commits are likely
to have been stripped before the lock is released (and the hook run).
Hook executed for missing revisions leads to various crashes.

We disable hooks execution for revision missing in the repo. This
provides a dirty but simple fix to user issues.
2014-11-01 23:17:50 +00:00
Matt Mackall
25d1182c5d merge with stable 2014-08-14 15:21:48 -05:00
Martin von Zweigbergk
69e9a354a2 histedit: preserve initial author on fold (issue4296)
When the authorship of the changeset folded in does not match that of
the base changeset, we currently use the configured ui.username
instead. This is especially surprising when the user is not the author
of either of the changesets. In such cases, the resulting authorship
(the user's) is clearly incorrect. Even when the user is folding in a
patch they authored themselves, it's not clear whether they should
take over the authorship. Let's instead keep it simple and always
preserve the base changeset's authorship. This is also how
"git rebase -i" handles folding/squashing.
2014-08-13 11:50:13 -07:00
Mike Edgar
fb41d0ff84 histedit: add "roll" command to fold commit data and drop message (issue4256)
This new histedit command (short for "rollup") is a variant of "fold" akin to
"hg amend" for working copy: it accumulates changes without interrupting
the user and asking for an updated commit message.
2014-08-06 16:51:41 -04:00
Pierre-Yves David
3efa776f85 resolve: add parenthesis around "no more unresolved files" message
This message may be confused with an error message. Adding parenthesis around it
will make it more recognisable as an informative message.
2014-07-26 03:32:49 +02:00
Matt Mackall
0cb0a7ba67 resolve: simplify "finished" message
The recently introduced message was:

  no unresolved files; you may continue your unfinished operation

This had three problems:

- looks a bit like an error message because it's not saying "we've
  just resolved the last file"
- refers to "unfinished operation", which won't be the case with
  "update" or "merge"
- introduces semicolons to error messages, which is stylistically
  questionable

I've simplified this to:

  no more unresolved files

In the future, if we want to prompt someone to continue a particular operation, we should use
a hint style:

  no more unresolved files
  (use 'hg graft --continue' to finish grafting)
2014-05-09 14:46:50 -05:00
Gregory Szorc
85e363fea8 resolve: print message when no unresolved files remain (issue4214)
When using resolve, users often have to consult with the output of |hg
resolve -l| to see if any unresolved files remain. This step is tedious
and adds overhead to resolving.

This patch will notify a user if there are no unresolved files remaining
after executing |hg resolve|::

    no unresolved files; you may continue your unfinished operation

The patch stops short of telling the user exactly what command should be
executed to continue the unfinished operation. That is because this
information is not currently captured anywhere. This would make a
compelling follow-up feature.
2014-04-18 22:19:25 -07:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Sean Farley
04ea4eb32d tests: use TESTTMP instead of TESTDIR
In d87f1c1d18fa, be4d37a43992, 394118f2cf71, and 7594c2ea371e, new tests were
added that used TESTDIR instead of TESTTMP thereby leading to polluting the
working directory with these temporary files. Now, we use TESTTMP so that they
will be cleaned up properly.
2014-03-28 14:33:27 -05:00
FUJIWARA Katsunori
7ccf898121 histedit: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "fold" command
in histedit-ing is never saved into ".hg/last-message.txt", because it
uses "localrepository.commitctx()" instead of
"localrepository.commit()": saving into ".hg/last-message.txt" is
executed only in the latter.

This patch saves manually edited commit message for "fold" command in
histedit-ing into ".hg/last-message.txt" just after user editing.

This is the simplest implementation to fix on stable. Editing and
saving commit message for memctx should be centralized into the
framework like "localrepository.commit()" with "editor" argument or so
in the future.
2014-03-19 01:07:41 +09:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Matt Mackall
6d0d30f28a checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
2013-07-25 02:17:52 -05:00
Matt Mackall
90a5bc169d histedit: add checkunfinished support (issue3955)
The tests contain a couple corner cases where workarounds are now
required. Strictly speaking, these are behavior regressions, but of an
extremely obscure and marginal sort. Commits or updates in the middle
of a histedit would have almost always been fairly serious user error.
2013-07-24 23:51:44 -05:00
Martin Geisler
ed39a6fe25 histedit: use base for computing renames when folding (issue3729)
When a file was renamed in the very first changeset being histedited,
the rename was not detected. Consider a history like this:

   0  base: add a.txt
   1  first: rename a.txt to b.txt
   2  last: edit b.txt

When 1 and 2 are edited, copies.pathcopies(first, last) correctly
returns that nothing was renamed. We must instead use
copies.pathcopies(first, last) to detect the initial rename.
2013-07-15 15:04:42 +02:00
Martin Geisler
f6ba9139e9 test-histedit-fold: remove unnecessary --template
The template is already set by the logt alias.
2013-07-15 13:20:39 +02:00
Pierre-Yves David
6397296e45 histedit-test: generalise --commands "-" usage
This is simpler than temporary file version. There some minor test
changes since commit messages are no longer modifed. There is still
some tests using --commands with a real file.
2013-04-16 21:57:25 -05:00
Pierre-Yves David
aabd767b0a histedit: allow "-" as a command file
When "-" is specified as a command file, we read rules from stdin. Alter a
single test to demo the behavior, but most of them could benefit from this.

There is minor change in test output resulting from the fact we no
longer change log messages.
2013-04-16 20:48:37 +02:00
Pierre-Yves David
ab56a3f4b1 histedit: properly handle --continue on empty fold
When all changes from the fold have been dropped, the --continue code was
confused. This changeset handles this case.

The test for this case existed but was broken.
2013-04-16 16:58:25 +02:00
Pierre-Yves David
3f2619a450 histedit-test: replace obscure python script by a plain file
One of the tests uses a python script to edit the histedit commands on
the fly. It was hard to read and likely to break. This is replaced by
a plain command file.

Doing so made me discover that the python script is incorrect. The
"+6" regexp never matched because the revision number is wrong.

This error is kept in the replacement for now. Fixing the histedit command
triggers a traceback in histedit.

A later changeset will fix the error and restore the intended test.
2013-04-16 20:50:17 +02:00
Pierre-Yves David
679c34c0bb test: improve documentation of some histedit tests
Each test section is clearly separated from the others and gains some
helpful documentation.
2013-04-16 16:22:38 +02:00
Pierre-Yves David
76fce8f621 test: use a lighter log style in histedit test
The default log displays a log of information that is useless for
histedit tests. Having a cleaner log help readability of those tests a
lot.

This does not change anything to the test semantic.
2013-04-16 23:24:52 +02:00
Augie Fackler
be59bb31f7 dispatch: exit with status 1 for an InterventionRequired exception (bc) 2013-02-08 16:17:46 -06:00
Augie Fackler
45ed657bf8 histedit: switch from util.Abort to util.InterventionRequired where appropriate (bc) 2013-02-08 16:27:49 -06:00
Mads Kiilerich
ef317883c7 export: show 'Date' header in a format that also is readable for humans
'export' is the official export format and used by patchbomb, but it would only
show date as a timestamp that most humans might find it hard to relate to. It
would be very convenient when reviewing a patch to be able to see what
timestamp the patch will end up with.

Mercurial has always used util.parsedate for parsing these headers. It can
handle 'all' date formats, so we could just as well use a readable one.

'export' will now use the format used by 'log' - which is the format described
as 'Unix date format' in the templating help. We assume that all parsers of '#
HG changeset patch'es can handle that.
2013-02-08 22:54:17 +01:00
Pierre-Yves David
5bda497c6d histedit: record histedit source (issue3681)
Have histedit record the hex of the original changeset as already done by:
- graft
- commit --amend
- rebase

My main motivation for adding this is to prevent the creation of obsolescence cycle
(see issue3681).

Note that commit created during edit are not affected yet.
2013-01-16 19:14:22 +01:00
Pierre-Yves David
6714af104f histedit-test: make test-fold more verbose
This helps to check the validity of fold result and debug potential issue.
2012-09-24 15:46:01 +02:00
Pierre-Yves David
7053ba6e9e histedit: replaces patching logic by merges
The old and fragile patching logic is replaced by smart merges (as rebase and
graft do). This should prevents some conflicts and smoother human resolution.

For this purpose the "foldchanges" function is renamed to "applychanges" and
handle a single revision only.
2012-09-21 19:27:22 +02:00
Pierre-Yves David
56df9607c6 histedit: fold in memory
Update the folding code to works in memory instead of applying patches on the
working directory. This is cleaner, faster and prepare the removal of the whole
patching logic.

This new collapse function will probably move into core sooner or later. A lot
of other rewriting operation may benefit from it.
2012-09-21 19:24:31 +02:00
Adrian Buehlmann
41df87291e test-histedit-fold: fix for Windows
Fixes 6d445c2db0df failing with MSYS.

MSYS sh.exe mangled that path by applying its path magic, which caused the
test to fail on Windows.
2012-07-26 23:08:34 +02:00
Patrick Mezard
e7c675580e histedit: fix new nodes computation with --continue (issue3534)
When running the following actions:

  pick 617f94f13c0f 1 +4
  drop 888f9082bf99 2 +5
  fold 251d831eeec5 3 +6

if the fold fails, is fixed by the user with a new changeset, --continue
will ignore the new revision when generating the fold changelog. This
was caused by --continue detecting new changesets as descendants of the
parent not descendants of changesets in the initial list. In this case,
dropped changesets must be ignored.

Even with the computation fixed, the 'newchildren' list was always
emptied by the filtering loop and passed empty to finishfold().

Note that changesets dropped and recreated identically will still be
missed. This probably cannot be solved but is unlikely to happen.

Other things, like 'newchildren' having multiple heads, should be
checked as well.
2012-07-25 16:27:26 +02:00
Augie Fackler
39b1dce60e histedit: don't crash if the result of fixing up a fold is empty 2012-07-06 11:39:02 -05:00
Mads Kiilerich
e1e9922b2d tests: make histedit pass on Windows MSYS
The command file will now be named with $TESTTMP (with '\') instead of `pwd`
(with '/') to avoid wrong path conversions.
2012-07-02 01:47:59 +02:00
Mads Kiilerich
9fd035159b tests: make histedit tests more resilient to filesystem variation
Better quoting of odd filesystem paths and no dependency to execute bit.
2012-06-30 03:34:50 +02:00
Mads Kiilerich
db710d2031 tests: convert histedit tests to .t
Mostly a trivial conversion.
2012-06-30 03:34:44 +02:00