Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hg.py @ 3037:3acb76f0124d
clone: simplifying dest repo creation
since creating a repo raises an exception if the repo already
exists, there's no need to try to create one.
add some test for repo creation when the destination exists
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 02 Sep 2006 23:26:10 +0200 |
parents | 345bac2bc4ec |
children | bc3fe3b5b785 |
comparison
equal
deleted
inserted
replaced
3036:adf7f3421c55 | 3037:3acb76f0124d |
---|---|
125 self.dir_ = None | 125 self.dir_ = None |
126 def __del__(self): | 126 def __del__(self): |
127 if self.dir_: | 127 if self.dir_: |
128 self.rmtree(self.dir_, True) | 128 self.rmtree(self.dir_, True) |
129 | 129 |
130 dest_repo = None | 130 dest_repo = repository(ui, dest, create=True) |
131 try: | |
132 dest_repo = repository(ui, dest) | |
133 raise util.Abort(_("destination '%s' already exists." % dest)) | |
134 except RepoError: | |
135 dest_repo = repository(ui, dest, create=True) | |
136 | 131 |
137 dest_path = None | 132 dest_path = None |
138 dir_cleanup = None | 133 dir_cleanup = None |
139 if dest_repo.local(): | 134 if dest_repo.local(): |
140 dest_path = os.path.realpath(dest_repo.root) | 135 dest_path = os.path.realpath(dest_repo.root) |