1292 ('u', 'updaterev', '', _('revision, tag, or branch to check out'), |
1292 ('u', 'updaterev', '', _('revision, tag, or branch to check out'), |
1293 _('REV')), |
1293 _('REV')), |
1294 ('r', 'rev', [], _('include the specified changeset'), _('REV')), |
1294 ('r', 'rev', [], _('include the specified changeset'), _('REV')), |
1295 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), |
1295 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), |
1296 ('', 'pull', None, _('use pull protocol to copy metadata')), |
1296 ('', 'pull', None, _('use pull protocol to copy metadata')), |
1297 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), |
1297 ('', 'uncompressed', None, |
|
1298 _('an alias to --stream (DEPRECATED)')), |
|
1299 ('', 'stream', None, |
|
1300 _('clone with minimal data processing')), |
1298 ] + remoteopts, |
1301 ] + remoteopts, |
1299 _('[OPTION]... SOURCE [DEST]'), |
1302 _('[OPTION]... SOURCE [DEST]'), |
1300 norepo=True) |
1303 norepo=True) |
1301 def clone(ui, source, dest=None, **opts): |
1304 def clone(ui, source, dest=None, **opts): |
1302 """make a copy of an existing repository |
1305 """make a copy of an existing repository |
1322 To pull only a subset of changesets, specify one or more revisions |
1325 To pull only a subset of changesets, specify one or more revisions |
1323 identifiers with -r/--rev or branches with -b/--branch. The |
1326 identifiers with -r/--rev or branches with -b/--branch. The |
1324 resulting clone will contain only the specified changesets and |
1327 resulting clone will contain only the specified changesets and |
1325 their ancestors. These options (or 'clone src#rev dest') imply |
1328 their ancestors. These options (or 'clone src#rev dest') imply |
1326 --pull, even for local source repositories. |
1329 --pull, even for local source repositories. |
|
1330 |
|
1331 In normal clone mode, the remote normalizes repository data into a common |
|
1332 exchange format and the receiving end translates this data into its local |
|
1333 storage format. --stream activates a different clone mode that essentially |
|
1334 copies repository files from the remote with minimal data processing. This |
|
1335 significantly reduces the CPU cost of a clone both remotely and locally. |
|
1336 However, it often increases the transferred data size by 30-40%. This can |
|
1337 result in substantially faster clones where I/O throughput is plentiful, |
|
1338 especially for larger repositories. A side-effect of --stream clones is |
|
1339 that storage settings and requirements on the remote are applied locally: |
|
1340 a modern client may inherit legacy or inefficient storage used by the |
|
1341 remote or a legacy Mercurial client may not be able to clone from a |
|
1342 modern Mercurial remote. |
1327 |
1343 |
1328 .. note:: |
1344 .. note:: |
1329 |
1345 |
1330 Specifying a tag will include the tagged changeset but not the |
1346 Specifying a tag will include the tagged changeset but not the |
1331 changeset containing the tag. |
1347 changeset containing the tag. |
1374 |
1390 |
1375 - clone from an absolute path on an ssh server (note double-slash):: |
1391 - clone from an absolute path on an ssh server (note double-slash):: |
1376 |
1392 |
1377 hg clone ssh://user@server//home/projects/alpha/ |
1393 hg clone ssh://user@server//home/projects/alpha/ |
1378 |
1394 |
1379 - do a high-speed clone over a LAN while checking out a |
1395 - do a streaming clone while checking out a specified version:: |
1380 specified version:: |
1396 |
1381 |
1397 hg clone --stream http://server/repo -u 1.5 |
1382 hg clone --uncompressed http://server/repo -u 1.5 |
|
1383 |
1398 |
1384 - create a repository without changesets after a particular revision:: |
1399 - create a repository without changesets after a particular revision:: |
1385 |
1400 |
1386 hg clone -r 04e544 experimental/ good/ |
1401 hg clone -r 04e544 experimental/ good/ |
1387 |
1402 |
1397 if opts.get('noupdate') and opts.get('updaterev'): |
1412 if opts.get('noupdate') and opts.get('updaterev'): |
1398 raise error.Abort(_("cannot specify both --noupdate and --updaterev")) |
1413 raise error.Abort(_("cannot specify both --noupdate and --updaterev")) |
1399 |
1414 |
1400 r = hg.clone(ui, opts, source, dest, |
1415 r = hg.clone(ui, opts, source, dest, |
1401 pull=opts.get('pull'), |
1416 pull=opts.get('pull'), |
1402 stream=opts.get('uncompressed'), |
1417 stream=opts.get('stream') or opts.get('uncompressed'), |
1403 rev=opts.get('rev'), |
1418 rev=opts.get('rev'), |
1404 update=opts.get('updaterev') or not opts.get('noupdate'), |
1419 update=opts.get('updaterev') or not opts.get('noupdate'), |
1405 branch=opts.get('branch'), |
1420 branch=opts.get('branch'), |
1406 shareopts=opts.get('shareopts')) |
1421 shareopts=opts.get('shareopts')) |
1407 |
1422 |