[PATCH RFC] check-commit: add magic string to bypass check-commit

David Soria Parra david.soriaparra at oculus.com
Wed Dec 21 17:32:47 EST 2016

> On 12/21/2016 10:47 PM, David Soria Parra wrote:
> >
> >
> >> -----Original Message-----
> >> From: Pierre-Yves David [mailto:pierre-yves.david at ens-lyon.org]
> >>
> >> I would prefer to have that exclusion logic in 'test-check-commit.t',
> >> These commit still fails our commit checks, but we skip them from
> >> automated testing.
> >>
> >> Just add "and not desc('#no-check-commit')" to the revset there
> >
> > Seems reasonable, note however it changes the behavior as `# no-check-
> commit`
> > can appear anywhere when using `desc()` while my implementation
> searches for it
> > at the starting of a line.
> The regex to feed 'desc()' with in order to mark start of line only is
> left as an exercise with the reader ;-)

Please read the code before making bold statements:

From hg help revsets
      Search commit message for string. The match is case-insensitive.

Note "string" not pattern. If we look into the implementation:

  @predicate('desc(string)', safe=True)
  def desc(repo, subset, x):
      # ...
      def matches(x):
          c = repo[x]
          return ds in encoding.lower(c.description())

note `ds in encoding.lower(c.description())`. Maybe my Python is not as strong as yours but last time
I checked this does not support regex unless I am mistaken.

I leave it to the reviewer to decide if we are taking the v1 with proper regex matching on multiline or settle
with desc() which does not support patterns.


More information about the Mercurial-devel mailing list