make a non-bare repo by default
This commit is contained in:
parent
71f4fef0d7
commit
efaf81fa7b
|
@ -5,9 +5,10 @@ This program allows you to download and convert any Wikipedia article's history
|
|||
|
||||
### Usage
|
||||
|
||||
$ wp2git.py article_name
|
||||
$ wp2git.py [--bare] article_name
|
||||
|
||||
`wp2git` will create a directory, in which a new bare `git` repository will be created.
|
||||
`wp2git` will create a directory, in which a new `git` repository will be created.
|
||||
The repository will contain a single file named `article_name.mw`, along with its entire edit history.
|
||||
|
||||
Run `wp2git --help` for more options.
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@ def sanitize(s):
|
|||
def parse_args():
|
||||
p = argparse.ArgumentParser(description='Create a git repository with the history of the specified Wikipedia article.')
|
||||
p.add_argument('article_name')
|
||||
p.add_argument('-n', '--no-import', dest='doimport', default=True, action='store_false',
|
||||
g=p.add_mutually_exclusive_group()
|
||||
g.add_argument('-n', '--no-import', dest='doimport', default=True, action='store_false',
|
||||
help="Don't invoke git fast-import; only generate fast-import data stream")
|
||||
g.add_argument('-b', '--bare', action='store_true', help="Import to a bare repository (no working tree)")
|
||||
p.add_argument('-o', '--out', help='Output directory or fast-import stream file')
|
||||
g=p.add_mutually_exclusive_group()
|
||||
g.add_argument('--lang', default=lang, help='Wikipedia language code (default %(default)s)')
|
||||
|
@ -77,7 +79,7 @@ def main():
|
|||
else:
|
||||
os.mkdir(path)
|
||||
os.chdir(path)
|
||||
sp.check_call(['git','init','--bare'])
|
||||
sp.check_call(['git','init'] + (['--bare'] if args.bare else []))
|
||||
pipe = sp.Popen(['git', 'fast-import','--quiet','--done'], stdin=sp.PIPE)
|
||||
fid = pipe.stdin
|
||||
else:
|
||||
|
@ -105,6 +107,8 @@ def main():
|
|||
|
||||
if args.doimport:
|
||||
pipe.communicate()
|
||||
if not args.bare:
|
||||
sp.check_call(['git','checkout'])
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue