changeset 5345:e9d187e87678

branching: merge with stable
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 31 May 2020 14:09:17 +0800
parents c5a92ab4d2de (current diff) 3c5bcb8ecf3a (diff)
children f06c76832c81
files
diffstat 7 files changed, 74 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-compat-strings.sh	Fri May 29 14:29:03 2020 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-unset GREP_OPTIONS
-
-# This script finds compatibility-related comments with a node hash specified
-# in all files in a given directory (. by default) and looks up the hash in a
-# repo (~/hg by default) to determine if each of the comments is correct and,
-# if not, it suggests the correct release. This can prevent accidentally
-# removing a piece of code that was misattributed to a different (earlier)
-# release of core hg.
-
-# Usage: $0 WDIR HGREPO where WDIR is usually evolve/hgext3rd/ and HGREPO is
-# the place with core Mercurial repo (not just checkout). Said repo has to be
-# sufficiently up-to-date, otherwise this script may not work correctly.
-
-workdir=${1:-'.'}
-hgdir=${2:-~/hg}
-grep -Ern 'hg <= [0-9.]+ \([0-9a-f+]+\)' "$workdir" | while read -r line; do
-    bashre='hg <= ([0-9.]+) \(([0-9a-f+]+)\)'
-    if [[ $line =~ $bashre ]]; then
-        expected=${BASH_REMATCH[1]}
-        revset=${BASH_REMATCH[2]}
-        tagrevset="max(tag('re:^[0-9]\\.[0-9]$') - ($revset)::)"
-        lastrel=$(HGPLAIN=1 hg --cwd "$hgdir" log -r "$tagrevset" -T '{tags}')
-        if [[ "$lastrel" != "$expected" ]]; then
-            echo "$line"
-            echo "actual last major release without $revset is $lastrel"
-            echo
-        fi
-    fi
-done
--- a/hgext3rd/evolve/__init__.py	Fri May 29 14:29:03 2020 +0800
+++ b/hgext3rd/evolve/__init__.py	Sun May 31 14:09:17 2020 +0800
@@ -153,35 +153,28 @@
 you create will not cause interference with other clients or servers without
 the effect flag recording.
 
-Templates
-=========
+Template keywords
+=================
+
+Evolve provides one template keyword that helps explore obsolescence history:
 
-Evolve ship several templates that you can use to have a better visibility
-about your obs history:
+  - obsorigin, for each changeset display a line summarizing what changed
+    between the changeset and its predecessors. Depending on the verbosity
+    level (-q and -v) it displays the users that created the obsmarkers and the
+    date range of these operations.
 
-  - precursors, for each obsolete changeset show the closest visible
-    precursors.
-  - successors, for each obsolete changeset show the closest visible
-    successors. It is useful when your working directory is obsolete to see
-    what are its successors. This information can also be retrieved with the
-    obslog command and the --all option.
-  - obsfate, for each obsolete changeset display a line summarizing what
-    changed between the changeset and its successors. Depending on the
-    verbosity level (-q and -v) it display the changeset successors, the users
-    that created the obsmarkers and the date range of these changes.
+Evolve used to provide these template keywords, which since have been included
+in core Mercurial (see :hg:`help templates -v`):
+
+  - obsolete
+  - obsfate (including obsfatedata, see also obsfate* template functions)
 
-    The template itself is not complex, the data are basically a list of
-    successortset. Each successorset is a dict with these fields:
+For compatibility, this extension also provides the following aliases to
+template keywords from core Mercurial:
 
-      - "verb", how did the revision changed, pruned or rewritten for the moment
-      - "users" a sorted list of users that have create obs marker between current
-        changeset and one of its successor
-      - "min_date" the tiniest date of the first obs marker between current
-        changeset and one of its successor
-      - "max_date" the biggest date between current changeset and one of its
-        successor
-      - "successors" a sorted list of locally know successors node ids
-      - "markers" the raw list of changesets.
+  - precursors (deprecated, use predecessors instead)
+  - successors (deprecated, use successorssets instead)
+  - troubles (deprecated, use instabilities instead)
 """
 
 evolutionhelptext = b"""
--- a/hgext3rd/evolve/obshistory.py	Fri May 29 14:29:03 2020 +0800
+++ b/hgext3rd/evolve/obshistory.py	Sun May 31 14:09:17 2020 +0800
@@ -219,9 +219,14 @@
         r = obsutil.successorsandmarkers(repo, ctx)
         if r is None:
             r = []
-        for succset in sorted(r):
-            if succset[b'markers']:
-                yield (succset[b'successors'], succset[b'markers'])
+        # replacing dicts and sets, they can't be compared
+        data = [
+            (succset[b'successors'], tuple(sorted(succset[b'markers'])))
+            for succset in r
+        ]
+        for (nodes, markers) in sorted(data):
+            if markers:
+                yield (nodes, markers)
     else:
         markers = successors.get(ctx.node(), ())
         for marker in sorted(markers):
--- a/tests/test-check-compat-strings.t	Fri May 29 14:29:03 2020 +0800
+++ b/tests/test-check-compat-strings.t	Sun May 31 14:09:17 2020 +0800
@@ -5,4 +5,4 @@
   > evolution = all
   > EOF
 
-  $ $TESTDIR/../contrib/check-compat-strings.sh "$TESTDIR/../hgext3rd/" "$RUNTESTDIR/.."
+  $ $TESTDIR/testlib/check-compat-strings.sh "$TESTDIR/../hgext3rd/" "$RUNTESTDIR/.."
--- a/tests/test-evolve-obshistory-content-divergent.t	Fri May 29 14:29:03 2020 +0800
+++ b/tests/test-evolve-obshistory-content-divergent.t	Sun May 31 14:09:17 2020 +0800
@@ -98,6 +98,11 @@
          +A1
   
   
+  $ hg obslog --hidden 'desc(A0)' --no-origin -f
+  x  471f378eab4c (1) A0
+       reworded(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       reworded(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
 
 Check that with all option, every changeset is shown
   $ hg obslog --hidden --all 471f378eab4c --patch
@@ -123,6 +128,15 @@
   |
   x  471f378eab4c (1) A0
   
+  $ hg obslog --hidden --all 'desc(A0)' --no-origin -f
+  @  65b757b745b9 (3) A2
+  |
+  | *  fdf9bde5129a (2) A1
+  |/
+  x  471f378eab4c (1) A0
+       reworded(description) as 65b757b745b9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       reworded(description) as fdf9bde5129a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
   $ hg obslog --hidden 471f378eab4c --no-graph --no-origin -Tjson | python -m json.tool
   [
       {
--- a/tests/test-evolve-obshistory.t	Fri May 29 14:29:03 2020 +0800
+++ b/tests/test-evolve-obshistory.t	Sun May 31 14:09:17 2020 +0800
@@ -1,5 +1,4 @@
-This test file test the various messages when accessing obsolete
-revisions.
+Testing obslog and other commands accessing obsolete revisions.
 
 Global setup
 ============
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/testlib/check-compat-strings.sh	Sun May 31 14:09:17 2020 +0800
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+unset GREP_OPTIONS
+
+# This script finds compatibility-related comments with a node hash specified
+# in all files in a given directory (. by default) and looks up the hash in a
+# repo (~/hg by default) to determine if each of the comments is correct and,
+# if not, it suggests the correct release. This can prevent accidentally
+# removing a piece of code that was misattributed to a different (earlier)
+# release of core hg.
+
+# Usage: $0 WDIR HGREPO where WDIR is usually evolve/hgext3rd/ and HGREPO is
+# the place with core Mercurial repo (not just checkout). Said repo has to be
+# sufficiently up-to-date, otherwise this script may not work correctly.
+
+workdir=${1:-'.'}
+hgdir=${2:-~/hg}
+grep -Ern 'hg <= [0-9.]+ \([0-9a-f+]+\)' "$workdir" | while read -r line; do
+    bashre='hg <= ([0-9.]+) \(([0-9a-f+]+)\)'
+    if [[ $line =~ $bashre ]]; then
+        expected=${BASH_REMATCH[1]}
+        revset=${BASH_REMATCH[2]}
+        tagrevset="max(tag('re:^[0-9]\\.[0-9]$') - ($revset)::)"
+        lastrel=$(HGPLAIN=1 hg --cwd "$hgdir" log -r "$tagrevset" -T '{tags}')
+        if [[ "$lastrel" != "$expected" ]]; then
+            echo "$line"
+            echo "actual last major release without $revset is $lastrel"
+            echo
+        fi
+    fi
+done