155 |
155 |
156 if copy: |
156 if copy: |
157 # we lock here to avoid premature writing to the target |
157 # we lock here to avoid premature writing to the target |
158 dest_lock = lock.lock(os.path.join(dest_path, ".hg", "lock")) |
158 dest_lock = lock.lock(os.path.join(dest_path, ".hg", "lock")) |
159 |
159 |
160 # we need to remove the (empty) data dir in dest so copyfiles |
160 # we need to remove the (empty) data dir in dest so copyfiles |
161 # can do its work |
161 # can do its work |
162 os.rmdir(os.path.join(dest_path, ".hg", "data")) |
162 os.rmdir(os.path.join(dest_path, ".hg", "data")) |
163 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" |
163 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" |
164 for f in files.split(): |
164 for f in files.split(): |
165 src = os.path.join(source, ".hg", f) |
165 src = os.path.join(source, ".hg", f) |
166 dst = os.path.join(dest_path, ".hg", f) |
166 dst = os.path.join(dest_path, ".hg", f) |
167 try: |
167 try: |
168 util.copyfiles(src, dst) |
168 util.copyfiles(src, dst) |
169 except OSError, inst: |
169 except OSError, inst: |
170 if inst.errno != errno.ENOENT: |
170 if inst.errno != errno.ENOENT: |
171 raise |
171 raise |
172 |
172 |
173 # we need to re-init the repo after manually copying the data |
173 # we need to re-init the repo after manually copying the data |
174 # into it |
174 # into it |
175 dest_repo = repository(ui, dest) |
175 dest_repo = repository(ui, dest) |
176 |
176 |
177 else: |
177 else: |
178 revs = None |
178 revs = None |
179 if rev: |
179 if rev: |