Beispiel #1
0
 def run(self, args):
     opts, args = getopt(args, '', ['stdout'])
     opts = dict(opts)
     if len(args) < 1 and '--stdout' not in args:
         print('Usage: dulwich pack-objects basename')
         sys.exit(1)
     object_ids = [line.strip() for line in sys.stdin.readlines()]
     basename = args[0]
     if '--stdout' in opts:
         packf = getattr(sys.stdout, 'buffer', sys.stdout)
         idxf = None
         close = []
     else:
         packf = open(basename + '.pack', 'w')
         idxf = open(basename + '.idx', 'w')
         close = [packf, idxf]
     porcelain.pack_objects('.', object_ids, packf, idxf)
     for f in close:
         f.close()
Beispiel #2
0
 def run(self, args):
     opts, args = getopt(args, "", ["stdout"])
     opts = dict(opts)
     if len(args) < 1 and "--stdout" not in args:
         print("Usage: dulwich pack-objects basename")
         sys.exit(1)
     object_ids = [line.strip() for line in sys.stdin.readlines()]
     basename = args[0]
     if "--stdout" in opts:
         packf = getattr(sys.stdout, "buffer", sys.stdout)
         idxf = None
         close = []
     else:
         packf = open(basename + ".pack", "w")
         idxf = open(basename + ".idx", "w")
         close = [packf, idxf]
     porcelain.pack_objects(".", object_ids, packf, idxf)
     for f in close:
         f.close()