--- a/mercurial/cmdutil.py Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/cmdutil.py Tue Apr 19 10:53:58 2022 -0400
@@ -2934,7 +2934,7 @@
def filectxfn(repo, ctx_, path):
try:
# Return None for removed files.
- if path in wctx.removed():
+ if path in wctx.removed() and path in filestoamend:
return None
# If the file being considered is not amongst the files
--- a/mercurial/configitems.py Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/configitems.py Tue Apr 19 10:53:58 2022 -0400
@@ -2317,7 +2317,7 @@
coreconfigitem(
b'ui',
b'large-file-limit',
- default=10000000,
+ default=10 * (2 ** 20),
)
coreconfigitem(
b'ui',
--- a/mercurial/debugcommands.py Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/debugcommands.py Tue Apr 19 10:53:58 2022 -0400
@@ -2148,9 +2148,9 @@
"""
if opts.get('force_free_lock'):
- repo.svfs.unlink(b'lock')
+ repo.svfs.tryunlink(b'lock')
if opts.get('force_free_wlock'):
- repo.vfs.unlink(b'wlock')
+ repo.vfs.tryunlink(b'wlock')
if opts.get('force_free_lock') or opts.get('force_free_wlock'):
return 0
--- a/mercurial/helptext/config.txt Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/helptext/config.txt Tue Apr 19 10:53:58 2022 -0400
@@ -2630,7 +2630,8 @@
``large-file-limit``
Largest file size that gives no memory use warning.
Possible values are integers or 0 to disable the check.
- (default: 10000000)
+ Value is expressed in bytes by default, one can use standard units for
+ convenience (e.g. 10MB, 0.1GB, etc) (default: 10MB)
``logtemplate``
(DEPRECATED) Use ``command-templates.log`` instead.
--- a/mercurial/rewriteutil.py Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/rewriteutil.py Tue Apr 19 10:53:58 2022 -0400
@@ -214,9 +214,9 @@
for h in hashes:
try:
fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
- except error.WdirUnsupported:
- # Someone has an fffff... in a commit message we're
- # rewriting. Don't try rewriting that.
+ except (error.WdirUnsupported, error.AmbiguousPrefixLookupError):
+ # Someone has an fffff... or some other prefix that's ambiguous in a
+ # commit message we're rewriting. Don't try rewriting that.
continue
if fullnode is None:
continue
--- a/mercurial/utils/procutil.py Fri Apr 15 11:20:49 2022 -0400
+++ b/mercurial/utils/procutil.py Tue Apr 19 10:53:58 2022 -0400
@@ -111,7 +111,9 @@
total_to_write = len(s)
total_written = 0
while total_written < total_to_write:
- total_written += write1(m[total_written:])
+ c = write1(m[total_written:])
+ if c:
+ total_written += c
return total_written
--- a/tests/run-tests.py Fri Apr 15 11:20:49 2022 -0400
+++ b/tests/run-tests.py Tue Apr 19 10:53:58 2022 -0400
@@ -1402,6 +1402,9 @@
env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
env['HGEMITWARNINGS'] = '1'
env['TESTTMP'] = _bytes2sys(self._testtmp)
+ # the FORWARD_SLASH version is useful when running `sh` on non unix
+ # system (e.g. Windows)
+ env['TESTTMP_FORWARD_SLASH'] = env['TESTTMP'].replace(os.sep, '/')
uid_file = os.path.join(_bytes2sys(self._testtmp), 'UID')
env['HGTEST_UUIDFILE'] = uid_file
env['TESTNAME'] = self.name
@@ -3065,6 +3068,10 @@
if pathname:
testdir = os.path.join(testdir, pathname)
self._testdir = osenvironb[b'TESTDIR'] = testdir
+ osenvironb[b'TESTDIR_FORWARD_SLASH'] = osenvironb[b'TESTDIR'].replace(
+ os.sep.encode('ascii'), b'/'
+ )
+
if self.options.outputdir:
self._outputdir = canonpath(_sys2bytes(self.options.outputdir))
else:
@@ -3209,6 +3216,9 @@
fileb = _sys2bytes(__file__)
runtestdir = os.path.abspath(os.path.dirname(fileb))
osenvironb[b'RUNTESTDIR'] = runtestdir
+ osenvironb[b'RUNTESTDIR_FORWARD_SLASH'] = runtestdir.replace(
+ os.sep.encode('ascii'), b'/'
+ )
sepb = _sys2bytes(os.pathsep)
path = [self._bindir, runtestdir] + osenvironb[b"PATH"].split(sepb)
if os.path.islink(__file__):
--- a/tests/test-copies-in-changeset.t Fri Apr 15 11:20:49 2022 -0400
+++ b/tests/test-copies-in-changeset.t Tue Apr 19 10:53:58 2022 -0400
@@ -325,6 +325,15 @@
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
$ hg showcopies
a -> l
+
+No crash on partial amend
+ $ hg st --change .
+ A l
+ $ echo modified >> a
+ $ hg rm l
+ $ hg commit --amend a
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
+
$ cd ..
Test rebasing a commit with copy information
--- a/tests/test-racy-mutations.t Fri Apr 15 11:20:49 2022 -0400
+++ b/tests/test-racy-mutations.t Tue Apr 19 10:53:58 2022 -0400
@@ -9,12 +9,12 @@
$ hg init a
$ cd a
- $ cat > "$TESTTMP/waitlock_editor.sh" <<EOF
+ $ cat > "$TESTTMP_FORWARD_SLASH/waitlock_editor.sh" <<EOF
> [ -n "\${WAITLOCK_ANNOUNCE:-}" ] && touch "\${WAITLOCK_ANNOUNCE}"
> f="\${WAITLOCK_FILE}"
> start=\`date +%s\`
> timeout=5
- > $RUNTESTDIR/testlib/wait-on-file "\$timeout" "\$f"
+ > "$RUNTESTDIR_FORWARD_SLASH/testlib/wait-on-file" "\$timeout" "\$f"
> if [ \$# -gt 1 ]; then
> cat "\$@"
> fi
@@ -27,9 +27,9 @@
$ hg commit -qAm 'r0'
Start an hg commit that will take a while
- $ EDITOR_STARTED="$(pwd)/.editor_started"
- $ MISCHIEF_MANAGED="$(pwd)/.mischief_managed"
- $ JOBS_FINISHED="$(pwd)/.jobs_finished"
+ $ EDITOR_STARTED="$TESTTMP_FORWARD_SLASH/a/.editor_started"
+ $ MISCHIEF_MANAGED="$TESTTMP_FORWARD_SLASH/a/.mischief_managed"
+ $ JOBS_FINISHED="$TESTTMP_FORWARD_SLASH/a/.jobs_finished"
#if fail-if-detected
$ cat >> .hg/hgrc << EOF
@@ -38,14 +38,24 @@
> EOF
#endif
+ $ cat >> .hg/hgrc << EOF
+ > [ui]
+ > editor=sh $TESTTMP_FORWARD_SLASH/waitlock_editor.sh
+ > EOF
+
$ echo foo > foo
- $ (WAITLOCK_ANNOUNCE="${EDITOR_STARTED}" \
+ $ (unset HGEDITOR;
+ > WAITLOCK_ANNOUNCE="${EDITOR_STARTED}" \
> WAITLOCK_FILE="${MISCHIEF_MANAGED}" \
- > HGEDITOR="sh $TESTTMP/waitlock_editor.sh" \
> hg commit -qAm 'r1 (foo)' --edit foo > .foo_commit_out 2>&1 ; touch "${JOBS_FINISHED}") &
Wait for the "editor" to actually start
- $ WAITLOCK_FILE="${EDITOR_STARTED}" sh "$TESTTMP/waitlock_editor.sh"
+ $ sh "$RUNTESTDIR_FORWARD_SLASH/testlib/wait-on-file" 5 "${EDITOR_STARTED}"
+
+ $ cat >> .hg/hgrc << EOF
+ > [ui]
+ > editor=
+ > EOF
Break the locks, and make another commit.
$ hg debuglocks -LW
@@ -59,7 +69,7 @@
Awaken the editor from that first commit
$ touch "${MISCHIEF_MANAGED}"
And wait for it to finish
- $ WAITLOCK_FILE="${JOBS_FINISHED}" sh "$TESTTMP/waitlock_editor.sh"
+ $ WAITLOCK_FILE="${JOBS_FINISHED}" sh "$TESTTMP_FORWARD_SLASH/waitlock_editor.sh"
#if skip-detection
(Ensure there was no output)
--- a/tests/test-rebase-inmemory.t Fri Apr 15 11:20:49 2022 -0400
+++ b/tests/test-rebase-inmemory.t Tue Apr 19 10:53:58 2022 -0400
@@ -1003,6 +1003,32 @@
o 0: d20a80d4def3 'base'
+Add an explicit test for rewrite_hash_refs when the detected prefix is
+ambiguous. Here's the super low-tech way I found this collision, if the hashing
+scheme ever changes:
+# hg init
+# echo test0 > test
+# hg ci -qAm 'test0' -u 'test' -d '0 0'
+# i=1
+# while [[ $(chg log -r . -T'{shortest(node, 6)}' | wc -c) -eq 6 ]]; do
+# chg co -r 0000000000
+# echo "test$i" > test
+# chg ci -qAm "test$i" -u test -d '0 0'
+# (( ++i ))
+# done
+ $ hg co -q 0000000000
+ $ echo test5281 > test
+ $ hg ci -qAm 'test5281'
+ $ hg co -q 000000000
+ $ echo test9912 > test
+ $ hg ci -qAm 'test9912'
+ $ hg co -q 4
+ $ echo contents > some_file
+ $ hg ci -qAm 'The previous two (parentless) commits had a hash prefix of b04363. Check that rewrite_hash_refs will not fail because of that.'
+ $ hg rebase -r . -d 5
+ rebasing 8:5c4cdabf5769 tip "The previous two (parentless) commits had a hash prefix of b04363. Check that rewrite_hash_refs will not fail because of that."
+ saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/5c4cdabf5769-335e1828-rebase.hg
+
$ cd ..
Test (virtual) working directory without changes, created by merge conflict