Update of /cvsroot/mailman/mailman/bin
In directory usw-pr-cvs1:/tmp/cvs-serv23712/bin

Modified Files:
        arch 
Log Message:
Add -s/--start and -e/--end switches to manually specify the start and
end message numbers (counted from zero) with which to archive.  This
can be useful when re-archiving a huge .mbox file, even though you
have to manually chunk it.


Index: arch
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/arch,v
retrieving revision 2.4
retrieving revision 2.5
diff -C2 -d -r2.4 -r2.5
*** arch        7 Sep 2001 23:18:47 -0000       2.4
--- arch        16 Mar 2002 02:11:08 -0000      2.5
***************
*** 1,5 ****
  #! @PYTHON@
  #
! # Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc.
  #
  # This program is free software; you can redistribute it and/or
--- 1,5 ----
  #! @PYTHON@
  #
! # Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
  #
  # This program is free software; you can redistribute it and/or
***************
*** 23,27 ****
  an archive.
  
! Usage: %(PROGRAM)s <listname> [<mbox>] [-h]
  
  Where <mbox> is the path to a list's complete mbox archive.  Usually this will 
--- 23,43 ----
  an archive.
  
! Usage: %(PROGRAM)s [options] <listname> [<mbox>] [-h]
! 
! Where options are:
!     -h / --help
!         Print this help message and exit.
! 
!     -s N
!     --start=N
!         Start indexing at article N, where article 0 is the first in the mbox.
!         Defaults to 0.
! 
!     -e M
!     --end=M
!         End indexing at article M.  This script is not very efficient with
!         respect to memory management, and for large archives, it may not be
!         possible to index the mbox entirely.  For that reason, you can specify
!         the start and end article numbers.
  
  Where <mbox> is the path to a list's complete mbox archive.  Usually this will 
***************
*** 61,71 ****
      # get command line arguments
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
      except getopt.error, msg:
          usage(1, msg)
  
      for opt, arg in opts:
          if opt in ('-h', '--help'):
              usage(0)
  
      # grok arguments
--- 77,100 ----
      # get command line arguments
      try:
!         opts, args = getopt.getopt(sys.argv[1:], 'hs:e:',
!                                    ['help', 'start', 'end'])
      except getopt.error, msg:
          usage(1, msg)
  
+     start = None
+     end = None
      for opt, arg in opts:
          if opt in ('-h', '--help'):
              usage(0)
+         elif opt in ('-s', '--start'):
+             try:
+                 start = int(arg)
+             except ValueError:
+                 usage(1)
+         elif opt in ('-e', '--end'):
+             try:
+                 end = int(arg)
+             except ValueError:
+                 usage(1)
  
      # grok arguments
***************
*** 116,121 ****
          archiver = HyperArchive(mlist)
          archiver.VERBOSE = 1
!         archiver.processUnixMailbox(fp, Article)
!         archiver.close()
          fp.close()
      finally:
--- 145,152 ----
          archiver = HyperArchive(mlist)
          archiver.VERBOSE = 1
!         try:
!             archiver.processUnixMailbox(fp, Article, start, end)
!         finally:
!             archiver.close()
          fp.close()
      finally:


_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to