Mercurial > hg-git-sync
comparison hggit_sync.py @ 3:7d99080f276f default tip
Fix rebuild option.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 29 Jul 2016 21:33:53 -0700 |
parents | 19156ccdc3e1 |
children |
comparison
equal
deleted
inserted
replaced
2:19156ccdc3e1 | 3:7d99080f276f |
---|---|
126 parser = argparse.ArgumentParser( | 126 parser = argparse.ArgumentParser( |
127 description="Helps you fix problems with hg-git. Maybe.", | 127 description="Helps you fix problems with hg-git. Maybe.", |
128 epilog="Don't trust scripts you found on the web! Backup your stuff!") | 128 epilog="Don't trust scripts you found on the web! Backup your stuff!") |
129 parser.add_argument( | 129 parser.add_argument( |
130 '--rebuild', | 130 '--rebuild', |
131 nargs=1, | |
132 metavar='REMOTE', | 131 metavar='REMOTE', |
133 help="Rebuild the Git repo from the given remote URL.") | 132 help="Rebuild the Git repo from the given remote URL.") |
134 parser.add_argument( | 133 parser.add_argument( |
135 'mapfile', | 134 'mapfile', |
136 metavar='MAPFILE', | 135 metavar='MAPFILE', |
147 if res.rebuild: | 146 if res.rebuild: |
148 print("Removing existing Git repo...") | 147 print("Removing existing Git repo...") |
149 if os.path.isdir(git_repo): | 148 if os.path.isdir(git_repo): |
150 shutil.rmtree(git_repo) | 149 shutil.rmtree(git_repo) |
151 print("Syncing it again into: %s" % git_repo) | 150 print("Syncing it again into: %s" % git_repo) |
151 print(" from: %s" % res.rebuild) | |
152 git_output = subprocess.check_output([ | 152 git_output = subprocess.check_output([ |
153 'git', 'clone', '--bare', res.rebuild, git_repo]) | 153 'git', 'clone', '--bare', res.rebuild, git_repo]) |
154 | 154 |
155 if not os.path.exists(git_repo): | 155 if not os.path.exists(git_repo): |
156 print("This Mercurial repository doesn't seem to have any Git mirror " | 156 print("This Mercurial repository doesn't seem to have any Git mirror " |