changeset 47785:324c8a299324 stable

tests: add explicit coverage for update_hash_refs from rewriteutil I couldn't find any evidence this is covered by tests in core (but there's a good chance I missed it). We've seen a cute bug in that code, but first let's just cover the cases that work correctly. Differential Revision: https://phab.mercurial-scm.org/D11231
author Augie Fackler <augie@google.com>
date Thu, 29 Jul 2021 16:18:35 -0400
parents 59bc92a7c60f
children 48da5c325750
files tests/test-rebase-inmemory.t
diffstat 1 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-rebase-inmemory.t	Tue Jul 27 19:36:20 2021 +0200
+++ b/tests/test-rebase-inmemory.t	Thu Jul 29 16:18:35 2021 -0400
@@ -963,6 +963,46 @@
   o  0: d20a80d4def3 'base'
   
 
+Test that update_hash_refs works.
+  $ hg co 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo update_hash_refs > update_hash_refs
+  $ hg add update_hash_refs
+  $ hg ci -m 'this will change hash'
+  created new head
+  $ echo changed >> update_hash_refs
+  $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but not 506e2454484b"
+  $ hg tglog
+  @  5: becd28036887 'this starts as the child of 98789aa60148 but not 506e2454484b'
+  |
+  o  4: 98789aa60148 'this will change hash'
+  |
+  | o    3: 506e2454484b 'merge'
+  | |\
+  +---o  2: 531f80391e4a 'c'
+  | |
+  | o  1: 6f252845ea45 'a'
+  |/
+  o  0: d20a80d4def3 'base'
+  
+  $ hg rebase -r '.^::' -d 3
+  rebasing 4:98789aa60148 "this will change hash"
+  rebasing 5:becd28036887 tip "this starts as the child of 98789aa60148 but not 506e2454484b"
+  saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-72ec40bd-rebase.hg
+  $ hg tglog
+  @  5: a445b8426f4b 'this starts as the child of c16c25696fe7 but not 506e2454484b'
+  |
+  o  4: c16c25696fe7 'this will change hash'
+  |
+  o    3: 506e2454484b 'merge'
+  |\
+  | o  2: 531f80391e4a 'c'
+  | |
+  o |  1: 6f252845ea45 'a'
+  |/
+  o  0: d20a80d4def3 'base'
+  
+
   $ cd ..
 
 Test (virtual) working directory without changes, created by merge conflict