Commit Graph

36 Commits

Author SHA1 Message Date
Yuya Nishihara
ed7051c6c7 tests: write hgrc of more than two lines by using shell heredoc
Here document should be readable than repeating echo commands.
2014-11-04 23:41:46 +09:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Matt Mackall
f3ce636a9c rebase: move duplicatecopies next to merge
This is preparation for removing open-coded rebase/graft operations.

As a side-effect, this exposes proper renames in the working copy when
there are conflicts, which shows up in test-shelve.t.
2014-10-13 17:55:45 -05:00
Matt Mackall
7e6c7ddb4e merge with stable 2014-10-10 12:15:46 -05:00
Jordi Gutiérrez Hermoso
e02b19218d shelve: don't delete "." when rebase is a no-op (issue4398)
When unshelving and facing a conflict, if we resolve all conflicts in
favour of the committed changes instead of the shelved changes, then
the ensuing implicit rebase is a no-op. That is, there is nothing to
rebase. In this case, there are no extra intermediate shelve commits
to strip either. Prior to this change, the commit being unshelved to
would be marked for destruction in a rather catastrophic way.

The relevant part of the test case failed as follows:

    $ hg unshelve -c
    unshelve of 'default' complete
    $ hg diff
    warning: ignoring unknown working parent 33f7f61e6c5e!
    diff --git a/a/a b/a/a
    new file mode 100644
    --- /dev/null
           b/a/a
    @@ -0,0   1,3 @@
      a
      c
      x
    $ hg status
    warning: ignoring unknown working parent 33f7f61e6c5e!
    M a/a
    ? a/a.orig
    ? foo/foo
    $ hg summary
    warning: ignoring unknown working parent 33f7f61e6c5e!
    parent: -1:000000000000  (no revision checked out)
    branch: default
    commit: 1 modified, 2 unknown (new branch head)
    update: 4 new changesets (update)

With this change, this test case now passes.
2014-10-08 07:47:11 -04:00
Pierre-Yves David
708550e527 revert: also track clean files
Tracking clean files is the simplest way to be able to reports files that need
no changes. So we explicitly retrieve them.

This fixes a couple of test outputs where the lack of changes was not reported.
2014-07-31 15:52:56 -07:00
Matt Mackall
931b87a60d tests: fixup issue markers to make check-commit happy 2014-08-15 10:47:03 -05: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
FUJIWARA Katsunori
dc3a08f408 shelve: accept '--edit' like other commands creating new changeset
After this patch, users can invoke editor for the commit message by
'--edit' option regardless of '--message'.
2014-06-20 16:15:38 +09:00
FUJIWARA Katsunori
d79f20e375 shelve: add option combination tests for refactoring in succeeding patch 2014-06-05 22:20:32 +09:00
Pierre-Yves David
21bb02d08f merge: drop the quotes around commit description
We already have a ":" after the user name to denote the start of the
description. The current usage of quotes around the description is
problematic as the truncation to 80 chars is likely to drop the
closing quote. This may confuse syntax coloration in some editors.
2014-05-26 11:44:58 -07:00
Siddharth Agarwal
265738b91b resolve: don't abort resolve -l even when no merge is in progress
This broke some internal automation that was quite reasonably checking for
unresolved files as a way to determine whether a merge happened cleanly. We
still abort for resolve --mark etc.
2014-05-23 13:10:31 -07:00
Durham Goode
91de13260e rebase: specify custom conflict marker labels for rebase (BC)
Changes rebase conflict markers to say 'source' and 'dest' instead of
'local' and 'other'.  This ends up looking like:

  one
  <<<<<<< dest:   a3e5c7fd master - bob: "A commit to master"
  master
  =======
  mine
  >>>>>>> source: c7fda3e5 - durham: "A commit to my feature branch"
  three
2014-05-08 16:55:56 -07:00
Durham Goode
bcc0ea1fe2 merge: add conflict marker formatter (BC)
Adds a conflict marker formatter that can produce custom conflict marker
descriptions. It can be set via ui.mergemarkertemplate. The old behavior
can be used still by setting ui.mergemarkers=basic.

The default format is similar to:

  {node|short} {tag} {branch} {bookmarks} - {author}: "{desc|firstline}"

And renders as:

  contextblahblah
  <<<<<<< local: c7fdd7ce4652 - durham: "Fix broken stuff in my feature branch"
  line from my changes
  =======
  line from the other changes
  >>>>>>> other: a3e55d7f4d38  master - sid0: "This is a commit to master th...
  morecontextblahblah
2014-05-08 16:50:22 -07: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
Gregory Szorc
8e5e922c37 resolve: abort when not applicable (BC)
The resolve command is only relevant when mergestate is present.
This patch will make resolve abort when no mergestate is present.

This change will let people know when they are using resolve when they
shouldn't be. This change will let people know when their use of resolve
doesn't do anything.

Previously, |hg resolve -m| would allow mergestate to be created. This
patch now forbids that. Strictly speaking, this is backwards
incompatible. The author of this patch believes creating mergestate via
resolve doesn't make much sense and this side-effect was unintended.
2014-04-18 19:08:32 -07:00
Mads Kiilerich
4622fdf46c tests: make unshelve tests more tricky - don't depend on size change
One reason shelve and largefiles doesn't work could be rapidly changing standin
files. Prove that shelve in general doesn't have problems with that.
2014-04-07 23:10:20 +02:00
Mads Kiilerich
7e476308af shelve: introduce secret option for using fixed date for temporary commit
Using a fixed date makes hashes stable and makes debugging simpler. The date
and hashes of this changeset are normally not exposed.
2014-04-07 23:10:20 +02:00
Simon Heimberg
617e52dc43 tests: rewrite path in test-shelve.t for not being mangled on msys
msys (on windows) converets '-R bundle:.XX/XX' to '-R bundle:;.XX/XX'. Avoid
this by writing '-R bundle://.XX/XX'. This is used more often than the
alternative work arounds like '-Rbundle://.XX/XX' or '-R bundle:Y/../.XX/XX'.
2014-02-10 22:56:10 +01:00
Mads Kiilerich
64b341109f shelve: better (and slightly redundant) test coverage for unshelve conflicts 2014-02-10 00:54:40 +01:00
Mads Kiilerich
2f8ea0775f shelve: status messages from unshelve
It was hard for the user to know what was going on when unshelving - especially
if the user had to resolve conflicts and thus got to see the intermediate
states.

Seeing that pending changes was gone could scare the user, make him panic, and
do stuff that really made him lose data.

Merging (both when rebasing and with pending changes) also requires some
understanding of where in the process you are and what you are merging.

To help the user we now show a couple of status messages (when relevant):
  temporarily committing pending changes (restore with 'hg unshelve --abort')
  rebasing shelved changes
2014-02-10 00:54:27 +01:00
Mads Kiilerich
bdf9713a66 shelve: be quiet when unshelve pulls from the shelve bundle
unshelve was quite verbose and it was hard for a user to follow what really was
going on. It ended up saying 'added 1 changesets' ... but the user just
expected and got pending changes and never saw any changeset.

The use of bundles is an implementation detail that we don't have to leak here.

Pulling is quite verbose, optimized for pulling many changesets from remote
repos - that is not the case here.

Instead, set the quiet flag when pulling the bundle - not only when temporarily
committing pending changes.

The 'finally' restore of ui.quiet is moved to the outer try/finally used for
locking.
2014-02-10 00:54:12 +01:00
Mads Kiilerich
a9a1d1164b shelve: add 'changes to' prefix to default shelve message
The shelved changes _could_ perhaps be amended to the parent changeset but it
_is_ not the parent changeset. Using the description from the parent changeset
is thus wrong and confusing.

Instead, add a 'changes to' prefix.
2014-02-10 00:53:27 +01:00
Durham Goode
3357a8eb2b unshelve: add tests for unknown files
Adds a basic test for shelving/unshelving with an unknown file present.

Adds a test for unshelving on top of an existing unknown file.
2013-11-26 16:30:52 -08:00
David Soria Parra
1ffeccc726 shelve: unshelve using an unfiltered repository
when evolve is enabled and a hidden obsolete changeset exists
in the repository, the strip during unshelve will fail due to
filtered revs. we use an unfiltered repository like to
repair.strip to strip the proper nodes.
2013-11-07 20:36:26 -08:00
Johan Bjork
6055bcdec2 patch: ensure valid git diffs if source/destination file is missing (issue4046)
This is arguably a workaround, a better fix may be in the repo to
ensure that it won't list a file 'modified' unless there is a file
context for the previous version.
2013-10-13 08:38:30 -04:00
FUJIWARA Katsunori
98a7c1d4c1 shelve: disallow commit while unshelve is in progress
Before this patch, commit is allowed even while unshelve is in
progress.

In the other hand, "hg unshelve --abort" and "hg unshelve --continue"
check whether parent revisions of the working directory have changed
or not since last "hg unshelve", and abort without clearing state for
unshelve in progress if they have.

This causes that accidental commit makes clearing state for unshelve
difficult in ordinary ways.

This patch disallows commit while unshelve is in progress for
consistency.
2013-10-29 01:03:43 +09:00
Durham Goode
4791cb4594 shelve: use rebase instead of merge (issue4068)
Previously, shelve used merge to unshelve things. This meant that if you shelved
changes on one branch, then unshelved on another, all the changes from the first
branch would be present in the second branch, and not just the shelved changes.

The fix is to use rebase to pick the shelve commit off the original branch and
place it on top of the new branch. This means only the shelved changes are
brought across.

This has the side effect of fixing several other issues in shelve:

- you can now unshelve into a file that already has pending changes
- unshelve a mv/cp now has the correct dirstate value (A instead of M)
- you can now unshelve to an ancestor of the shelve
- unshelve now no longer deletes untracked .orig files

Updates tests and adds a new one to cover the issue. The test changes fall into
a few categories:

- I removed some excess output
- The --continue/--abort state is a little different, so the parents and
  dirstate needed updating
- Removed some untracked files at certain points that cluttered the output
2013-10-23 13:12:48 -07:00
Takumi IINO
c3c2c45028 shelve: make unshelve work even if it don't run in repository root
revertfiles are relative to the repository root. not paths relative to the cwd.
2013-10-22 12:41:05 +09:00
Durham Goode
b8e2488338 shelve: fix dirstate corruption during unshelve (issue4055)
If you shelved on top of commit A, then rebased A to @ and unshelved, any file
changed in A would appear as modified in hg status despite the contents not having
changed.

The fix is to use dirstate.setparents() instead of doing it manually. This will
be a little slower since it has to iterate through everything in the dirstate
instead of only what's in the mergestate, but this will be more correct since
the mergestate did not include files which were merged but had no conflict.

The tests also had several bad dirstate's hardcoded in them. This change updates
the tests appropriately and adds a new test to cover this specific rebase case.
2013-10-11 17:19:40 -07:00
Sean Farley
a17a87c1b4 shelve: only save mq state if enabled
Test coverage has been added.
2013-10-09 14:15:20 -07:00
David Soria Parra
943d81b08d shelve: copy bookmarks and restore them after a commit
cmdutil.commit() will advance the bookmarks. Therefore we have to restore
them afterwards. We have to use update() to ensure we preserve the bmstore
object.
2013-10-03 19:41:25 +02:00
David Soria Parra
e6d74860f3 shelve: allow shelving of a change with an mq patch applied
We allow shelving of of changes on top of a MQ repository. MQ will
not allow repository changes on top of applied patches. We introduce
checkapplied in MQ to bypass this check.
2013-08-29 09:22:15 -07:00
David Soria Parra
db3958fb08 shelve: new output format for shelve listings
Use a more condensed and mercurial-like output format for shelve listing.
We don't prefix the message with 'shelved from...' anymore as our default
name contains the branch name or the user used his own name. To avoid
just printing the last commit message, we drop writing the description
to stdout.

old output:
  default         [1s ago]    shelved from default (01ba9745): create conflict

new output:
  default         (1s ago)    create conflict
2013-10-01 12:20:31 +02:00
David Soria Parra
72600cc4d7 shelve: add a shelve extension to save/restore working changes
This extension saves shelved changes using a temporary draft commit,
and bundles the temporary commit and its draft ancestors, then
strips them.

This strategy makes it possible to use Mercurial's bundle and merge
machinery to resolve conflicts if necessary when unshelving, even
when the destination commit or its ancestors have been amended,
squashed, or evolved. (Once a change has been unshelved, its
associated unbundled commits are either rolled back or stripped.)

Storing the shelved change as a bundle also avoids the difficulty
that hidden commits would cause, of making it impossible to amend
the parent if it is a draft commits (a common scenario).

Although this extension shares its name and some functionality with
the third party hgshelve extension, it has little else in common.
Notably, the hgshelve extension shelves changes as unified diffs,
which makes conflict resolution a matter of finding .rej files and
conflict markers, and cleaning up the mess by hand.

We do not yet allow hunk-level choosing of changes to record.
Compared to the hgshelve extension, this is a small regression in
usability, but we hope to integrate that at a later point, once the
record machinery becomes more reusable and robust.
2013-08-29 09:22:13 -07:00