Patchwork D5497: revset: add tests for the new merge() arguments (withbranch and samebranch)

login
register
mail settings
Submitter phabricator
Date Jan. 13, 2019, 10:45 p.m.
Message ID <98dafaaf7385a8c6c449df4a23e05332@localhost.localdomain>
Download mbox | patch
Permalink /patch/37717/
State Not Applicable
Headers show

Comments

phabricator - Jan. 13, 2019, 10:45 p.m.
angel.ezquerra updated this revision to Diff 13206.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5497?vs=13019&id=13206

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

AFFECTED FILES
  tests/test-help.t
  tests/test-revset.t

CHANGE DETAILS




To: angel.ezquerra, #hg-reviewers
Cc: mjpieters, mercurial-devel

Patch

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -2954,3 +2954,107 @@ 
   * set:
   <baseset+ [0]>
   0
+
+test the merge() revset parameters
+
+create a few merge revisions to test merge() parameters
+  $ hg up 9
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a > a
+  $ hg branch --force ".a.b.c."
+  marked working directory as branch .a.b.c.
+  $ hg add a
+  $ hg commit -m "added a"
+  created new head
+  $ hg merge 7
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m "same branch merge 1"
+  $ hg up 10
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a2 > a
+  $ hg commit -m "changed a to a2"
+  created new head
+  $ hg up 11
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 12
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m "same branch merge 2"
+  $ echo a3 > a
+  $ hg commit -m "changed a to a3"
+  $ hg up 12
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch --force "_a_b_c_"
+  marked working directory as branch _a_b_c_
+  $ hg merge 14
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m "same branch merge 3 (both parents on same branch while merge is on another branch)"
+  created new head
+  $ hg up 14
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a4 > a
+  $ hg commit -m "changed a to a4"
+  $ hg up 15
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 16
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m "different branch merge 1"
+  $ hg up 16
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a5 > a
+  $ hg branch --force "_a_b_c_"
+  marked working directory as branch _a_b_c_
+  $ hg commit -m "changed a to a5"
+  created new head
+  $ hg up 17
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 18
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m "different branch merge 2"
+
+test that the merge revisions can be split between those where
+samebranch is True and those where it is False
+  $ log 'merge()'
+  6
+  11
+  13
+  15
+  17
+  19
+
+show merges with the same branch
+  $ log 'merge(samebranch=True)'
+  11
+  13
+  15
+  19
+
+show merges with other branches (but not the same branch)
+  $ log 'merge(samebranch=False)'
+  6
+  17
+
+show merges with a particular branch
+  $ log 'merge(.a.b.c.)'
+  11
+  13
+  15
+  17
+  $ log 'merge(-a-b-c-)'
+  6
+
+  $ log 'merge(".a.b.c.", samebranch=False)'
+  17
+
+show merges with multiple branches
+  $ log 'merge("re:.a.b.c.")'
+  6
+  11
+  13
+  15
+  17
+  19
\ No newline at end of file
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1743,8 +1743,20 @@ 
 Test section lookup
 
   $ hg help revset.merge
-      "merge()"
-        Changeset is a merge changeset.
+      "merge(withbranch, samebranch=True)"
+        Changeset is a merge changeset
+  
+        All merge revisions are returned by default. If a "withbranch" pattern
+        is provided only merges with (i.e. whose second parent belongs to) those
+        branches that match the pattern will be returned. The simplest pattern
+        is the name of a single branch. It is also possible to specify a regular
+        expression by starting the pattern with "re:". This can be used to match
+        more than one branch (e.g. "re:branch1|branch2").
+  
+        It is also possible to only return merges where both parents belong to
+        the same branch by specifying samebranch=True. If samebranch=False is
+        set then only merges where both parents do not belong to the same branch
+        will be returned.
   
   $ hg help glossary.dag
       DAG