Commit Graph

37 Commits

Author SHA1 Message Date
Matt Harbison
edbaac787d templatekw: make {latesttag} a hybrid list
This maintains the previous behavior of expanding {latesttag} to a string
containing all of the tags, joined by ':'.  But now it also allows list type
operations.

I'm unsure if the plural handling is correct (i.e. it seems like it is usually
"{foos % '{foo}'}"), but I guess we are stuck with this because the singular
form previously existed.
2015-07-06 23:23:22 -04:00
Matt Harbison
9e00498f91 templatekw: introduce the changessincelatesttag keyword
Archive is putting a value with the same name in the metadata file, to count all
of the changes not covered by the latest tag, instead of just along the longest
path.  It seems that this would be useful to have on the command line as well.
It might be nice for the name to start with 'latesttag' so that it is grouped
with the other tag keywords, but I can't think of a better name.

The initial version of this counted a clean wdir() and '.' as the same value,
and a dirty wdir() as the same value after it is committed.  Yuya objected on
the grounds of consistency [1].  Since revsets can be used to conditionally
select a dirty wdir() or '.' when clean, I can build the version string I need
and will defer to him on this.

[1] https://www.selenic.com/pipermail/mercurial-devel/2015-June/071588.html
2015-06-26 23:11:05 -04:00
Matt Harbison
1147e2bdb5 templatekw: use a list of tags in getlatesttags() instead of joining them
This will be used in the next patch.

It also points out that the documentation for '{latesttag}' is not quite
accurate, since it says "most recent global tag" (singular).  I assume it is too
radical of a change to convert it to a list of strings.  At least ':' is
currently a reserved character in tag names.
2015-06-26 23:23:10 -04:00
Matt Harbison
9f8b7aa09e workingctx: don't report the tags for its parents
This fixes the bad distance calculation for '{latesttagdistance}' mentioned in
the previous patch.
2015-06-28 13:38:03 -04:00
FUJIWARA Katsunori
b75f854207 tests: invoke hg command indirectly from shell script to run on Windows
Before this patch, test-tag.t can't run successfully on Windows,
because:

  - quoted hg command ('"hg"') prevents "hg.bat" from working correctly
    (only at testing with pure Python build)

    "%~f0" and "%~dp0hg" in "hg.bat" cause unexpected result in this
    case. BTW, quoted "\path\to\hg" works correctly.

  - "`pwd`" in the command line is expanded unexpectedly

    not "C:\path\to\TESTTMP" but "C;C:\path\to\TESTTMP"
2015-01-22 00:08:13 +09:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
Pierre-Yves David
d1e22facbe addset: use the ascending argument in _iterordered
Fix a bug where fastasc and fastdesc were iterator in the same order as
self._ascending.
2014-10-09 05:27:23 -07:00
Mads Kiilerich
26870bfa1d filemerge: switch the default name for internal tools from internal:x to :x 2014-09-28 17:15:28 +02:00
Matt Mackall
b33bebd371 tag: use an abort hint 2014-10-02 18:39:57 -05:00
Danek Duvall
151b68d8da tests: cat error messages are different on Solaris 2014-07-21 11:27:24 -07:00
Angel Ezquerra
38433239a4 filemerge: add internal:tagmerge merge tool
Add a new internal:tagmerge merge tool which implements an automatic merge
algorithm for mercurial's tag files

The tagmerge algorithm is able to resolve most merge conflicts that
currently would trigger a .hgtags merge conflict. The only case that
it does not (and cannot) handle is that in which two tags point to
different revisions on each merge parent _and_ their corresponding tag
histories have the same rank (i.e. the same length). In all other
cases the merge algorithm will choose the revision belonging to the
parent with the highest ranked tag history. The merged tag history is
the combination of both tag histories (special care is taken to try to
combine common tag histories where possible).

The algorithm also handles cases in which tags have been manually
removed from the .hgtags file and other similar corner cases.

In addition to actually merging the tags from two parents, taking into
account the base, the algorithm also tries to minimize the difference
between the merged tag file and the first parent's tag file (i.e. it
tries to make the merged tag order as as similar as possible to the
first parent's tag file order).

The algorithm works as follows:
1. read the tags from p1, p2 and the base
    - when reading the p1 tags, also get the line numbers associated to each
      tag node (these will be used to sort the merged tags in a way that
      minimizes the diff to p1). Ignore the file numbers when reading p2 and
      the base
2. recover the "lost tags" (i.e. those that are found in the base but not on p1
   or p2) and add them back to p1 and/or p2
    - at this point the only tags that are on p1 but not on p2 are those new
      tags that were introduced in p1. Same thing for the tags that are on p2
      but not on p2
3. take all tags that are only on p1 or only on p2 (but not on the base)
    - Note that these are the tags that were introduced between base and p1 and
      between base and p2, possibly on separate clones
4. for each tag found both on p1 and p2 perform the following merge algorithm:
    - the tags conflict if their tag "histories" have the same "rank" (i.e.
      length) _AND_ the last (current) tag is _NOT_ the same
    - for non conflicting tags:
        - choose which are the high and the low ranking nodes
            - the high ranking list of nodes is the one that is longer.
              In case of draw favor p1
            - the merged node list is made of 3 parts:
                - first the nodes that are common to the beginning of both the
                  low and the high ranking nodes
                - second the non common low ranking nodes
                - finally the non common high ranking nodes (with the last one
                  being the merged tag node)
            - note that this is equivalent to putting the whole low ranking node
              list first, followed by the non common high ranking nodes
    - note that during the merge we keep the "node line numbers", which will
      be used when writing the merged tags to the tag file
5. write the merged tags taking into account to their positions in the first
   parent (i.e. try to keep the relative ordering of the nodes that come
   from p1). This minimizes the diff between the merged and the p1 tag files
   This is done by using the following algorithm
    - group the nodes for a given tag that must be written next to each other
        - A: nodes that come from consecutive lines on p1
        - B: nodes that come from p2 (i.e. whose associated line number is None)
             and are next to one of the a nodes in A
        - each group is associated with a line number coming from p1
    - generate a "tag block" for each of the groups
        - a tag block is a set of consecutive "node tag" lines belonging to the
          same tag and which will be written next to each other on the merged
          tags file
    - sort the "tag blocks" according to their associated number line
        - put blocks whose nodes come all from p2 first
    - write the tag blocks in the sorted order

Notes:
- A few tests have been added to test-tag.t. These tests are very specific to
the new internal:tagmerge tool, so perhaps they should be moved to their own
test file.
- The merge algorithm was discussed in a thread on the mercurial mailing list.
In http://markmail.org/message/anqaxldup4tmgyrx a slightly different algorithm
was suggested. In it the p1 and p2 tags would have been interleaved instead of
put one before the other. It would be possible to implement that but my tests
suggest that the merge result would be more confusing and harder to understand.
2014-06-26 01:20:25 +02:00
FUJIWARA Katsunori
4b34ba6872 tag: use the editor gotten by "getcommiteditor()" instead of "ui.edit()"
This patch also enhances "test-tag.t", because "hg tag" hasn't been
explicitly tested around editor invocation and "--edit" option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
ec5abb7d1f localrepo: add "editor" argument to "tag()"
Before this patch, "localrepository.tag()" doesn't take "editor"
argument, and this prevents callers from passing "editor" argument to
"localrepository.commit()" invoked internally.

This patch adds "editor" argument to "localrepository.tag()" (and
"_tag()", too), and makes "commands.tag()" invoke it with "editor"
argument.

This patch also omits explicit "localrepository.savecommitmesssage()"
invocation, because "localrepository.commit()" will invoke specified
"editor" and save edited commit message into ".hg/last-message.txt"
automatically.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
3acb83dcfb tag: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg tag -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "hg tag -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m option (-l is not supported for "hg
tag") as same as other commands.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.
2014-03-19 01:07:41 +09:00
Matt Mackall
2d6d229def check-code: add more path sep glob checks 2013-05-02 15:21:47 -05:00
Mads Kiilerich
c0e7f36590 tag: clarify cryptic error message when tagging null revision 2013-04-11 14:44:22 +02:00
Wagner Bruna
cc8c722c61 scmutil: generalize message to make it more i18n-friendly 2012-10-21 11:20:33 -02:00
Kevin Bullock
64977a5e28 test-tag: test that all reserved names are rejected 2012-10-17 22:25:41 -05:00
Brad Hall
6b8032746f tag: don't allow tagging the null revision (issue1915)
Also fixed the tests that were doing this and expected it to work
2012-06-05 17:00:13 -07: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
93c3b99c27 tag: run commit hook when lock is released (issue3344) 2012-05-12 20:06:02 +02: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
d648884b09 tests: add 'hghave system-sh' to skip tests on windows 2011-11-16 03:45:14 +01:00
Peter Arrenbrecht
5fbc4a50f1 localrepo: reuse parent manifest in commitctx if no files have changed
This speeds up the in-memory version of debugbuilddag that I'm
working on considerably for the case where we want to build just
a 00changelog.i (for discovery tests, for instance).

There are a couple of test changes because node ids in tests
have changed.

The changes to the patch names in test-mq-qdelete.t were required
because they could collide with nodeid abbreviations and newly
actually do (patch "c" collides with id "cafe..." for patch "b").
2011-05-02 19:20:29 +02:00
Gilles Moris
dcdc58f0a5 rollback: clarifies the message about the reverted state (issue2628)
Previously, when rolling back a transaction, some users could be confused
between the level to which the store is rolled back, and the new parents
of the working directory.

  $ hg rollback
  rolling back to revision 4 (undo commit)

With this change:
  $ hg rollback
  repository tip rolled back to tip revision 4 (undo commit)
  working directory now based on revision 2 and 1

So now the user can realize that the store has been rolled back to an older
tip, but also that the working directory may not on the tip (here we are
rolling back the merge of the heads 2 and 1)
2011-02-10 09:03:06 +01:00
Afuna
d6a03de859 tag: add tests for tags with whitespace (issue2174) 2011-02-11 22:24:10 +08:00
Matt Mackall
ad6fe18c9c tests: eliminate fast-forward merge in test-tag 2010-12-16 14:50:27 -06:00
Kevin Bullock
6d031e2cdb tag: abort if not at a branch head (issue2552)
Since it's usually only desirable to make tag commits on top of branch
heads, abort if the working dir parent is not a branch head. -f/--force
may be passed to commit at a non-head anyway.

Does not abort if working dir parent is a named branch head but not a
topological head.
2010-12-06 22:04:10 -06:00
Kevin Bullock
90e6b3e885 tag: fix uncommitted merge check and error message (issue2542)
This patch corrects the check for tagging on an uncommitted merge. We
should never commit a new tag changeset on an uncommitted merge, whether
or not --rev is specified. It also changes the error message from:

  abort: cannot partially commit a merge (do not specify files or patterns)

to the much more accurate (and terse):

  abort: uncommitted merge

Local tags are ok.
2010-12-07 08:02:54 +01:00
Kevin Bullock
85d737621f tag: don't check .hgtags status if --local passed
Local tags don't create a commit, so we don't need to check the status
of .hgtags.
2010-12-13 21:20:30 -06:00
Mads Kiilerich
a8aa4fec4a tests: remove the last traces of $HGTMP
$HGTMP isn't needed - and if we need something like that then $TESTTMP is more
appropriate.
2010-10-08 22:36:11 -05:00
Martin Geisler
3d112b3042 tests: added a short description to issue numbers
Many tests already had a short line to describe what IssueXXX is
about. I find that quite useful when reading a test.
2010-09-24 10:13:49 +02:00
Matt Mackall
ac660e9f65 tests: cleanup exit code handling in unified tests 2010-09-21 16:00:02 -05:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Martin Geisler
cc612c476f tests: remove unneeded -d flags
Many tests fixed the commit date of their changesets at '1000000 0' or
similar. However testing with "Mon Jan 12 13:46:40 1970 +0000" is not
better than testing with "Thu Jan 01 00:00:00 1970 +0000", which is
the default run-tests.py installs.

Removing the unnecessary flag removes some clutter and will hopefully
make it clearer what the tests are really trying to test. Some tests
did not even change their output when the dates were changed, in which
case the -d flag was truly irrelevant.

Dates used in sequence (such as '0 0', '1 0', etc...) were left alone
since they may make the test easier to understand.
2010-09-02 23:22:51 +02:00
Nicolas Dumazet
a27c7cc939 tests: unify test-tag 2010-08-12 16:35:34 +09:00