From 4bb131fdace995de47b2d2f0de95cd2d8d5895f4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 26 Jun 2007 03:26:31 +0000 Subject: r13506@Kushana: nickm | 2007-06-25 18:10:39 -0400 Clean up last commit; make reconcile.py work again. svn:r216 --- BibTeX.py | 2 +- TODO | 5 +++++ reconcile.py | 12 +++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BibTeX.py b/BibTeX.py index 3c1cd51..a7a030a 100644 --- a/BibTeX.py +++ b/BibTeX.py @@ -27,7 +27,7 @@ MONTHS = [ None, WWW_FIELDS = [ 'www_section', 'www_important', 'www_remarks', 'www_abstract_url', 'www_html_url', 'www_pdf_url', 'www_ps_url', 'www_txt_url', 'www_ps_gz_url', 'www_amazon_url', - 'www_excerpt_url', 'www_cache_section', 'www_tags'] ] + 'www_excerpt_url', 'www_cache_section', 'www_tags' ] def url_untranslate(s): """Change a BibTeX key into a string suitable for use in a URL.""" diff --git a/TODO b/TODO index 6ff9c77..c208fc2 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ + - More general tasks . Know about @book . Write unit tests for everything @@ -26,3 +27,7 @@ if the authors ask us not to cache them. - Maybe, add ability to cache images from an HTML page. +- Reconcile tasks + - Document it. + - Notice when there is new or different information of certain kinds + (pages, dates, etc) in the new information. diff --git a/reconcile.py b/reconcile.py index 895cf9f..d871def 100644 --- a/reconcile.py +++ b/reconcile.py @@ -3,7 +3,7 @@ """Code to determine which entries are new and which are old. - To merge in a new file, run "python reconcile.py new-file.bib". This + To scan a new file, run "python reconcile.py anonbib.cfg new-file.bib". This will generate a new bibtex file called 'tmp.bib', with all the new entries cleaned up a little, and all the duplicate entries commented out. """ @@ -242,18 +242,20 @@ def emitKnown(f, ent, matches): print >>f, "%"+(ent.format(77,4,1,invStrings).replace("\n", "\n%")) if __name__ == '__main__': - if len(sys.argv) != 2: - print "reconcile.py expects 1 argument" + if len(sys.argv) != 3: + print "reconcile.py expects 2 arguments" sys.exit(1) + config.load(sys.argv[1]) + print "========= Scanning master ==========" master = MasterBibTeX() - master = BibTeX.parseFile(config.MASTER_BIB, master) + master = BibTeX.parseFile(config.MASTER_BIB, result=master) master.buildIndex() print "========= Scanning new file ========" try: - fn = sys.argv[1] + fn = sys.argv[2] input = BibTeX.parseFile(fn) except BibTeX.ParseError, e: print "Error parsing %s: %s"%(fn,e) -- cgit v1.2.3-70-g09d2