# HG changeset patch
# User J. H. Palmieri <palmieri@math.washington.edu>
# Date 1361134419 28800
# Node ID 8fe794689094a87515f1e59a732230dd443d9004
# Parent 5d8c13e7b81a1e152855073f97a4d48ee97255d1
Print Mercurial branch of Sage library on startup (unless it's 'main')
diff git a/sage/misc/sage_extension.py b/sage/misc/sage_extension.py
a

b


425  425  self.init_inspector() 
426  426  self.init_line_transforms() 
427  427  self.register_interface_magics() 
 428  self.init_print_branch() 
428  429  
429  430  # right now, the shutdown hook calling quit_sage() doesn't 
430  431  # work when we run doctests that involve creating test shells. 
… 
… 

518  519  preparser(True) 
519  520  
520  521  
 522  def init_print_branch(self): 
 523  """ 
 524  Print the Mercurial branch, unless it's 'main'. 
 525  
 526  That is, unless doctesting or unless the branch is 'main', 
 527  print a message of the form 'Loading Sage library. Current 
 528  Mercurial branch is: ', followed by the branch name. 
 529  
 530  Since this message is not printed during doctesting in order 
 531  to avoid doctest failures elsewhere in the Sage library, we do 
 532  not doctest this. 
 533  """ 
 534  from sage.misc.misc import branch_current_hg_notice, branch_current_hg 
 535  from sage.plot.plot import DOCTEST_MODE 
 536  branch = branch_current_hg_notice(branch_current_hg()) 
 537  if (not DOCTEST_MODE) and branch: 
 538  print branch 
 539  
521  540  # from http://stackoverflow.com/questions/4103773/efficientwayofhavingafunctiononlyexecuteonceinaloop 
522  541  from functools import wraps 
523  542  def run_once(f): 