comparison mercurial/hg.py @ 3849:972d14a5a227

don't use localrepo.__init__ to create the dest repo with clone+hardlinks
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 10 Dec 2006 00:06:43 +0100
parents 8643b9f90b51
children 8f18e31c4441
comparison
equal deleted inserted replaced
3797:2aef481ac73c 3849:972d14a5a227
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 = repository(ui, dest, create=True)
131
132 dir_cleanup = None 130 dir_cleanup = None
133 if dest_repo.local(): 131 if islocal(dest):
134 dir_cleanup = DirCleanup(os.path.realpath(dest_repo.root)) 132 dir_cleanup = DirCleanup(dest)
135 133
136 abspath = source 134 abspath = source
137 copy = False 135 copy = False
138 if src_repo.local() and dest_repo.local(): 136 if src_repo.local() and islocal(dest):
139 abspath = os.path.abspath(source) 137 abspath = os.path.abspath(source)
140 copy = not pull and not rev 138 copy = not pull and not rev
141 139
142 src_lock, dest_lock = None, None 140 src_lock, dest_lock = None, None
143 if copy: 141 if copy:
151 copy = False 149 copy = False
152 150
153 if copy: 151 if copy:
154 # we lock here to avoid premature writing to the target 152 # we lock here to avoid premature writing to the target
155 src_store = os.path.realpath(src_repo.spath) 153 src_store = os.path.realpath(src_repo.spath)
156 dest_store = os.path.realpath(dest_repo.spath) 154 dest_path = os.path.realpath(os.path.join(dest, ".hg"))
155 dest_store = dest_path
156 if not os.path.exists(dest):
157 os.mkdir(dest)
158 os.mkdir(dest_path)
157 dest_lock = lock.lock(os.path.join(dest_store, "lock")) 159 dest_lock = lock.lock(os.path.join(dest_store, "lock"))
158 160
159 files = ("data", 161 files = ("data",
160 "00manifest.d", "00manifest.i", 162 "00manifest.d", "00manifest.i",
161 "00changelog.d", "00changelog.i") 163 "00changelog.d", "00changelog.i")
171 # 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
172 # into it 174 # into it
173 dest_repo = repository(ui, dest) 175 dest_repo = repository(ui, dest)
174 176
175 else: 177 else:
178 dest_repo = repository(ui, dest, create=True)
179
176 revs = None 180 revs = None
177 if rev: 181 if rev:
178 if 'lookup' not in src_repo.capabilities: 182 if 'lookup' not in src_repo.capabilities:
179 raise util.Abort(_("src repository does not support revision " 183 raise util.Abort(_("src repository does not support revision "
180 "lookup and so doesn't support clone by " 184 "lookup and so doesn't support clone by "