4176 else: |
4180 else: |
4177 ui.status(_(b"(run 'hg heads' to see heads)\n")) |
4181 ui.status(_(b"(run 'hg heads' to see heads)\n")) |
4178 elif not ui.configbool(b'commands', b'update.requiredest'): |
4182 elif not ui.configbool(b'commands', b'update.requiredest'): |
4179 ui.status(_(b"(run 'hg update' to get a working copy)\n")) |
4183 ui.status(_(b"(run 'hg update' to get a working copy)\n")) |
4180 return False |
4184 return False |
|
4185 |
|
4186 |
|
4187 def unbundle_files(ui, repo, fnames, unbundle_source=b'unbundle'): |
|
4188 """utility for `hg unbundle` and `hg debug::unbundle`""" |
|
4189 assert fnames |
|
4190 # avoid circular import |
|
4191 from . import hg |
|
4192 |
|
4193 with repo.lock(): |
|
4194 for fname in fnames: |
|
4195 f = hg.openpath(ui, fname) |
|
4196 gen = exchange.readbundle(ui, f, fname) |
|
4197 if isinstance(gen, streamclone.streamcloneapplier): |
|
4198 raise error.InputError( |
|
4199 _( |
|
4200 b'packed bundles cannot be applied with ' |
|
4201 b'"hg unbundle"' |
|
4202 ), |
|
4203 hint=_(b'use "hg debugapplystreamclonebundle"'), |
|
4204 ) |
|
4205 url = b'bundle:' + fname |
|
4206 try: |
|
4207 txnname = b'unbundle' |
|
4208 if not isinstance(gen, bundle2.unbundle20): |
|
4209 txnname = b'unbundle\n%s' % urlutil.hidepassword(url) |
|
4210 with repo.transaction(txnname) as tr: |
|
4211 op = bundle2.applybundle( |
|
4212 repo, |
|
4213 gen, |
|
4214 tr, |
|
4215 source=unbundle_source, # used by debug::unbundle |
|
4216 url=url, |
|
4217 ) |
|
4218 except error.BundleUnknownFeatureError as exc: |
|
4219 raise error.Abort( |
|
4220 _(b'%s: unknown bundle feature, %s') % (fname, exc), |
|
4221 hint=_( |
|
4222 b"see https://mercurial-scm.org/" |
|
4223 b"wiki/BundleFeature for more " |
|
4224 b"information" |
|
4225 ), |
|
4226 ) |
|
4227 modheads = bundle2.combinechangegroupresults(op) |
|
4228 return modheads |