Patchwork D12141: rank: add minimal test

login
register
mail settings
Submitter phabricator
Date Feb. 7, 2022, 5:25 p.m.
Message ID <differential-rev-PHID-DREV-73cmpyb3cjaukbortygs-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50474/
State New
Headers show

Comments

phabricator - Feb. 7, 2022, 5:25 p.m.
pacien created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This adds a small test checking the rank computation in the case of a merge.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-rank.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rank.t b/tests/test-rank.t
new file mode 100644
--- /dev/null
+++ b/tests/test-rank.t
@@ -0,0 +1,42 @@ 
+=============================================================
+Check that we can compute and exchange revision rank properly
+=============================================================
+
+  $ cat << EOF >> $HGRCPATH
+  > [format]
+  > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data
+  > EOF
+
+
+Test minimal rank computation with merge
+
+  $ hg init rank-repo-minimal
+  $ cd rank-repo-minimal
+  $ touch 0
+  $ hg add 0
+  $ hg commit -m 0
+  $ touch 1
+  $ hg add 1
+  $ hg commit -m 1
+  $ hg update -r 0 >> /dev/null
+  $ touch 2
+  $ hg add 2
+  $ hg commit -m 2 >> /dev/null
+  $ hg merge -r 1 >> /dev/null
+  $ hg commit -m 3
+  $ touch 4
+  $ hg add 4
+  $ hg commit -m 4
+  $ hg log --graph --template '{rev} {_fast_rank}\n'
+  @  4 5
+  |
+  o    3 4
+  |\
+  | o  2 2
+  | |
+  o |  1 2
+  |/
+  o  0 1
+  
+  $ cd ..
+