Mercurial > evolve
view contrib/check-compat-strings.sh @ 5295:ebfd0d875600
evolve: handle relocation during divergence resolution producing no changes
When resolving divergence and the two divergent commits have different
parents, we start by rebasing one of them to have the same parent as
the other. That step can result in no changes to commit. When it does,
we would crash with a TypeError before this patch.
This patch fixes it by instead creating an empty commit in that
scenario. The existing code then continues to attempt to merge it,
which produces no changes, and no commit is created on top. The other
side of the divergence is marked as successor as usual, so orphans
from the side that became empty will be evolved to the right place
(see test).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 09 Dec 2019 11:09:11 -0800 |
parents | f5b366a31740 |
children |
line wrap: on
line source
#!/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