#11142: clean up sage/misc/hg.py
-----------------------------------+----------------------------------------
   Reporter:  jhpalmieri           |          Owner:  jason        
       Type:  enhancement          |         Status:  needs_work   
   Priority:  minor                |      Milestone:  sage-4.7.2   
  Component:  misc                 |       Keywords:  sd31         
Work_issues:                       |       Upstream:  N/A          
   Reviewer:  Karl-Dieter Crisman  |         Author:  John Palmieri
     Merged:                       |   Dependencies:  #10594       
-----------------------------------+----------------------------------------

Comment(by jhpalmieri):

 The warning about the `.hgrc` file is printed by the `_warning` method,
 not by Mercurial itself.  What do you think about not printing that
 warning if doctesting?  I'm considering this patch:
 {{{
 #!diff

 diff --git a/sage/misc/hg.py b/sage/misc/hg.py
 --- a/sage/misc/hg.py
 +++ b/sage/misc/hg.py
 @@ -336,7 +336,8 @@

              sage: hg_sage._warning() # random
          """
 -        if not os.path.exists(os.path.join(os.environ['HOME'], '.hgrc')):
 +        from sage.plot.plot import DOCTEST_MODE
 +        if not os.path.exists(os.environ['HOME'] + '/.hgrc') and not
 DOCTEST_MODE:
              print "\nWARNING:"
              print "Make sure to create a ~/.hgrc file:"
              print "-"*70
 }}}
 With this, all tests pass even if I don't have a `.hgrc` file.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11142#comment:24>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to