4

The revsets help mentions

"x::y" A DAG range, meaning all changesets that are descendants of x and ancestors of y, including x and y themselves. If the first endpoint is left out, this is equivalent to "ancestors(y)", if the second is left out it is equivalent to "descendants(x)". An alternative syntax is "x..y".

"x:y" All changesets with revision numbers between x and y, both inclusive. Either endpoint can be left out, they default to 0 and tip.

"x % y" Changesets that are ancestors of x but not ancestors of y (i.e. ::x - ::y). This is shorthand notation for "only(x, y)" (see below). The second argument is optional and, if left out, is equivalent to "only(x)".

It is not clear what the results are differentiated. In general, "x % y" returns what I want to choose, but I want to understand others.

sato
  • 101
  • 3
  • [revsets](https://www.mercurial-scm.org/repo/hg/help/revsets) –  Jan 24 '18 at 07:17
  • 1
    You're literally quoting from the documentation that explains the difference. Maybe explain a little bit more what you find confusing? – ngoldbaum Jan 24 '18 at 17:12
  • having no example (or counter-example) makes indeed confusing the interpretation of "range" vs "between", and one can ask whether both things are exactly the same thing or which scenarios will make them have different results (and why) – arhak Jan 25 '18 at 09:44

1 Answers1

0

the difference between the statements may be subtle indeed, there is a "between" and a "range"

take for instance ordered an linear revisions 1 to 5 (in a new dummy repo) then notice the difference between 1:5 5:1 1::5 5::1

5:1 gives the same as 1:5, everything between the two, no matter which one goes first

OTHO 5::1 gives NO revisions at all, since their order is inverted, so the ancestors/descendants are none while 1::5 in this example would give the same as 1:5

$ hg init tmptrial
$ cd tmptrial
$ echo 0 > file.txt
$ hg add file.txt
$ hg commit -m 'r0'
$ for i in {1..5} ; do echo $i > file.txt ; hg commit -m r$i ; done
$ hg log -r 1::5 --template "{desc}\n"
$ for range in 1::5 5::1 1:5 5:1 ; do echo -- $range -- ; hg log -r $range --template "{desc}\n" ; done

run the above example and notice the empty output of 5::1

arhak
  • 2,488
  • 1
  • 24
  • 38