Patchwork D11231: tests: add explicit coverage for update_hash_refs from rewriteutil

login
register
mail settings
Submitter phabricator
Date July 29, 2021, 8:39 p.m.
Message ID <differential-rev-PHID-DREV-re6kj4zjiv74dyrucy4i-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49545/
State Superseded
Headers show

Comments

phabricator - July 29, 2021, 8:39 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11231

AFFECTED FILES
  tests/test-rebase-inmemory.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -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