Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9edde0071c
Fetching contributors…

Cannot retrieve contributors at this time

executable file 38 lines (35 sloc) 1.188 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#!/usr/bin/env python
import optparse
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

from anygit import clisetup
from anygit import models
from anygit.client import fetch

def main():
    parser = optparse.OptionParser('%prog [options] {lookup} [args]')
    parser.add_option('-l', '--limit', dest='limit', type=int,
                      default=None, help='Limit results')
    parser.add_option('-s', '--skip', dest='skip', type=int,
                      default=None, help='Offset results')
    opts, args = parser.parse_args()
    if not len(args):
        parser.print_help()
        return 1
    if args[0] == 'lookup':
        if len(args) != 2:
            parser.print_help()
            return 2
        matching, count = models.GitObject.lookup_by_sha1(sha1=args[1],
                                                          partial=True,
skip=opts.skip,
                                                          limit=opts.limit)
print 'Found %d objects' % count
for match in matching:
            print match
    else:
        parser.print_help()
        return 3

if __name__ == '__main__':
    sys.exit(main())
Something went wrong with that request. Please try again.