#12258: Prune .hgtags files
-----------------------+----------------------------------------------------
   Reporter:  kini     |          Owner:  leif                        
       Type:  defect   |         Status:  needs_review                
   Priority:  trivial  |      Milestone:  sage-4.8                    
  Component:  scripts  |       Keywords:  .hgtags mercurial repository
Work_issues:           |       Upstream:  N/A                         
   Reviewer:           |         Author:  Keshav Kini                 
     Merged:           |   Dependencies:                              
-----------------------+----------------------------------------------------

Comment(by kini):

 Oh, here is the code I used to generate this patch:

 {{{
 #!python
 #!/usr/bin/env python

 import subprocess

 real_tags = subprocess.check_output('hg tags', shell=True).splitlines()
 real_tags = [x.split(':')[1] for x in real_tags]

 infile = open('.hgtags')
 tags = infile.read().splitlines()
 infile.close()
 outfile = open('.hgtags', 'w')

 for tag in tags:
     if tag[:12] in real_tags:
         outfile.write(tag)
         outfile.write('\n')

 outfile.close()
 }}}

 Basically it checks what tags Mercurial itself is able to find when it
 reads the `.hgtags` file, against what is actually in the `.hgtags` file,
 and deletes any invalid tags which Mercurial is not recognizing. I ran the
 script on all the Mercurial repositories in the Sage source distribution
 which had a `.hgtags` file.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12258#comment:2>
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