D961: test-check-code: fail new commits which use 'atexit' instead of 'ui.atexit'

2017-10-07 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb521b3a79afd: test-check-code: fail new commits which use 
atexit instead of ui.atexit (authored by singhsrb, 
committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D961?vs=2477=2519

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -345,6 +345,7 @@
 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
 (r'\butil\.Abort\b', "directly use error.Abort"),
 (r'^@(\w*\.)?cachefunc', "module-level @cachefunc is risky, please avoid"),
+(r'^import atexit', "don't use atexit, use ui.atexit"),
 (r'^import Queue', "don't use Queue, use util.queue + util.empty"),
 (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"),
 (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),



To: singhsrb, #hg-reviewers, quark
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D961: test-check-code: fail new commits which use 'atexit' instead of 'ui.atexit'

2017-10-05 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Callbacks registered with 'atexit' are sometimes not called (like when
  hg aborts and calls os._exit). On the other hand, callbacks registered with
  'ui.atexit' are called in most cases. Therefore, encouraging the use of
  'ui.atexit' by failing the test 'test-check-code.t' appropriately.

TEST PLAN
  Ran the test 'test-check-code.t' after importing 'atexit' in one of
  the py files and confirmed that the test fails.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -345,6 +345,7 @@
 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
 (r'\butil\.Abort\b', "directly use error.Abort"),
 (r'^@(\w*\.)?cachefunc', "module-level @cachefunc is risky, please avoid"),
+(r'^import atexit', "don't use atexit, use ui.atexit"),
 (r'^import Queue', "don't use Queue, use util.queue + util.empty"),
 (r'^import cStringIO', "don't use cStringIO.StringIO, use util.stringio"),
 (r'^import urllib', "don't use urllib, use util.urlreq/util.urlerr"),



To: singhsrb, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel