tests/test-revset-legacy-lookup.t
changeset 37759 aa3f63e02c3c
child 37760 29eb4cafeeb8
equal deleted inserted replaced
37758:9b3a348c9b2f 37759:aa3f63e02c3c
       
     1 
       
     2   $ cat >> $HGRCPATH << EOF
       
     3   > [ui]
       
     4   > logtemplate="{rev}:{node|short} {desc} [{tags}]\n"
       
     5   > EOF
       
     6 
       
     7   $ hg init legacy-lookup
       
     8   $ cd legacy-lookup
       
     9   $ echo a > a
       
    10   $ hg add a
       
    11   $ hg commit -m 'first'
       
    12   $ echo aa > a
       
    13   $ hg commit -m 'second'
       
    14   $ hg log -G
       
    15   @  1:43114e71eddd second [tip]
       
    16   |
       
    17   o  0:a87874c6ec31 first []
       
    18   
       
    19 
       
    20 Create a tag that looks like a revset
       
    21 
       
    22   $ hg tag 'rev(0)'
       
    23   $ hg log -G
       
    24   @  2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd [tip]
       
    25   |
       
    26   o  1:43114e71eddd second [rev(0)]
       
    27   |
       
    28   o  0:a87874c6ec31 first []
       
    29   
       
    30 
       
    31 See how various things are resolved
       
    32 -----------------------------------
       
    33 
       
    34 Revision numbers
       
    35 
       
    36   $ hg log -r '0'
       
    37   0:a87874c6ec31 first []
       
    38   $ hg log -r '1'
       
    39   1:43114e71eddd second [rev(0)]
       
    40 
       
    41 "rev(x)" form (the one conflicting with the tags)
       
    42 (resolved as a label)
       
    43 
       
    44   $ hg log -r 'rev(0)'
       
    45   1:43114e71eddd second [rev(0)]
       
    46   $ hg log -r 'rev(1)'
       
    47   1:43114e71eddd second [rev(0)]
       
    48 
       
    49 same within a simple revspec
       
    50 (still resolved as the label)
       
    51 
       
    52   $ hg log -r ':rev(0)'
       
    53   0:a87874c6ec31 first []
       
    54   1:43114e71eddd second [rev(0)]
       
    55   $ hg log -r 'rev(0):'
       
    56   1:43114e71eddd second [rev(0)]
       
    57   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd [tip]
       
    58 
       
    59 within a more advances revset
       
    60 (still resolved as the label)
       
    61 
       
    62   $ hg log -r 'rev(0) and branch(default)'
       
    63   0:a87874c6ec31 first []
       
    64 
       
    65 some of the above with quote to force its resolution as a label
       
    66 
       
    67   $ hg log -r ':"rev(0)"'
       
    68   0:a87874c6ec31 first []
       
    69   1:43114e71eddd second [rev(0)]
       
    70   $ hg log -r '"rev(0)":'
       
    71   1:43114e71eddd second [rev(0)]
       
    72   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd [tip]
       
    73   $ hg log -r '"rev(0)" and branch(default)'
       
    74   1:43114e71eddd second [rev(0)]
       
    75 
       
    76 confusing bits within parents
       
    77 
       
    78   $ hg log -r '(rev(0))'
       
    79   0:a87874c6ec31 first []
       
    80   $ hg log -r '( rev(0))'
       
    81   0:a87874c6ec31 first []
       
    82   $ hg log -r '("rev(0)")'
       
    83   1:43114e71eddd second [rev(0)]
       
    84 
       
    85 Test label with quote in them.
       
    86 
       
    87   $ hg tag '"foo"'
       
    88 
       
    89   $ hg log -r '"foo"'
       
    90   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
    91   $ hg log -r '("foo")'
       
    92   abort: unknown revision 'foo'!
       
    93   [255]
       
    94   $ hg log -r '("\"foo\"")'
       
    95   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
    96 
       
    97 Test label with dash in them.
       
    98 
       
    99   $ hg tag 'foo-bar'
       
   100 
       
   101   $ hg log -r 'foo-bar'
       
   102   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   103   $ hg log -r '(foo-bar)'
       
   104   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   105   $ hg log -r '"foo-bar"'
       
   106   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   107   $ hg log -r '("foo-bar")'
       
   108   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   109 
       
   110 Test label with + in them.
       
   111 
       
   112   $ hg tag 'foo+bar'
       
   113 
       
   114   $ hg log -r 'foo+bar'
       
   115   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   116   $ hg log -r '(foo+bar)'
       
   117   abort: unknown revision 'foo'!
       
   118   [255]
       
   119   $ hg log -r '"foo+bar"'
       
   120   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   121   $ hg log -r '("foo+bar")'
       
   122   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   123 
       
   124 Test tag with numeric version number.
       
   125 
       
   126   $ hg tag '1.2'
       
   127 
       
   128   $ hg log -r '1.2'
       
   129   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   130   $ hg log -r '(1.2)'
       
   131   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   132   $ hg log -r '"1.2"'
       
   133   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   134   $ hg log -r '("1.2")'
       
   135   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   136   $ hg log -r '::"1.2"'
       
   137   0:a87874c6ec31 first []
       
   138   1:43114e71eddd second [rev(0)]
       
   139   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   140   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   141   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   142   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   143   $ hg log -r '::1.2'
       
   144   0:a87874c6ec31 first []
       
   145   1:43114e71eddd second [rev(0)]
       
   146   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   147   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   148   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   149   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   150 
       
   151 Test tag with parenthesis (but not a valid revset)
       
   152 
       
   153   $ hg tag 'release_4.1(candidate1)'
       
   154 
       
   155   $ hg log -r 'release_4.1(candidate1)'
       
   156   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   157   $ hg log -r '(release_4.1(candidate1))'
       
   158   hg: parse error: unknown identifier: release_4.1
       
   159   [255]
       
   160   $ hg log -r '"release_4.1(candidate1)"'
       
   161   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   162   $ hg log -r '("release_4.1(candidate1)")'
       
   163   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   164   $ hg log -r '::"release_4.1(candidate1)"'
       
   165   0:a87874c6ec31 first []
       
   166   1:43114e71eddd second [rev(0)]
       
   167   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   168   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   169   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   170   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   171   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   172   $ hg log -r '::release_4.1(candidate1)'
       
   173   hg: parse error: unknown identifier: release_4.1
       
   174   [255]
       
   175 
       
   176 Test tag with parenthesis and other function like char
       
   177 
       
   178   $ hg tag 'release_4.1(arch=x86,arm)'
       
   179 
       
   180   $ hg log -r 'release_4.1(arch=x86,arm)'
       
   181   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   182   $ hg log -r '(release_4.1(arch=x86,arm))'
       
   183   hg: parse error: unknown identifier: release_4.1
       
   184   [255]
       
   185   $ hg log -r '"release_4.1(arch=x86,arm)"'
       
   186   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   187   $ hg log -r '("release_4.1(arch=x86,arm)")'
       
   188   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   189   $ hg log -r '::"release_4.1(arch=x86,arm)"'
       
   190   0:a87874c6ec31 first []
       
   191   1:43114e71eddd second [rev(0)]
       
   192   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   193   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   194   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   195   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   196   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   197   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   198   $ hg log -r '::release_4.1(arch=x86,arm)'
       
   199   hg: parse error: unknown identifier: release_4.1
       
   200   [255]
       
   201 
       
   202 Test tag conflicting with revset function
       
   203 
       
   204   $ hg tag 'secret(team=foo,project=bar)'
       
   205 
       
   206   $ hg log -r 'secret(team=foo,project=bar)'
       
   207   8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)]
       
   208   $ hg log -r '(secret(team=foo,project=bar))'
       
   209   hg: parse error: secret takes no arguments
       
   210   [255]
       
   211   $ hg log -r '"secret(team=foo,project=bar)"'
       
   212   8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)]
       
   213   $ hg log -r '("secret(team=foo,project=bar)")'
       
   214   8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)]
       
   215   $ hg log -r '::"secret(team=foo,project=bar)"'
       
   216   0:a87874c6ec31 first []
       
   217   1:43114e71eddd second [rev(0)]
       
   218   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   219   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   220   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   221   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   222   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   223   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   224   8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)]
       
   225   $ hg log -r '::secret(team=foo,project=bar)'
       
   226   hg: parse error: secret takes no arguments
       
   227   [255]
       
   228 
       
   229 Test tag with space
       
   230 
       
   231   $ hg tag 'my little version'
       
   232 
       
   233   $ hg log -r 'my little version'
       
   234   9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version]
       
   235   $ hg log -r '(my little version)'
       
   236   hg: parse error at 4: unexpected token: symbol
       
   237   ((my little version)
       
   238        ^ here)
       
   239   [255]
       
   240   $ hg log -r '"my little version"'
       
   241   9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version]
       
   242   $ hg log -r '("my little version")'
       
   243   9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version]
       
   244   $ hg log -r '::"my little version"'
       
   245   0:a87874c6ec31 first []
       
   246   1:43114e71eddd second [rev(0)]
       
   247   2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"]
       
   248   3:a50aae922707 Added tag "foo" for changeset fb616635b18f [foo-bar]
       
   249   4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar]
       
   250   5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2]
       
   251   6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)]
       
   252   7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)]
       
   253   8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)]
       
   254   9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version]
       
   255   $ hg log -r '::my little version'
       
   256   hg: parse error at 5: invalid token
       
   257   (::my little version
       
   258         ^ here)
       
   259   [255]