##// END OF EJS Templates
streamclone: include obsstore file into stream bundle if client can read it
av6 -
r40434:0ac794e0 default
parent child Browse files
Show More
@@ -1697,8 +1697,15 b' def addpartbundlestream2(bundler, repo, '
1697 if (includepats or excludepats) and not narrowstream:
1697 if (includepats or excludepats) and not narrowstream:
1698 raise error.Abort(_('server does not support narrow stream clones'))
1698 raise error.Abort(_('server does not support narrow stream clones'))
1699
1699
1700 includeobsmarkers = False
1701 if repo.obsstore:
1702 remoteversions = obsmarkersversion(bundler.capabilities)
1703 if repo.obsstore._version in remoteversions:
1704 includeobsmarkers = True
1705
1700 filecount, bytecount, it = streamclone.generatev2(repo, includepats,
1706 filecount, bytecount, it = streamclone.generatev2(repo, includepats,
1701 excludepats)
1707 excludepats,
1708 includeobsmarkers)
1702 requirements = _formatrequirementsspec(repo.requirements)
1709 requirements = _formatrequirementsspec(repo.requirements)
1703 part = bundler.newpart('stream2', data=it)
1710 part = bundler.newpart('stream2', data=it)
1704 part.addparam('bytecount', '%d' % bytecount, mandatory=True)
1711 part.addparam('bytecount', '%d' % bytecount, mandatory=True)
@@ -532,7 +532,7 b' def _emit2(repo, entries, totalfilesize)'
532 finally:
532 finally:
533 fp.close()
533 fp.close()
534
534
535 def generatev2(repo, includes, excludes):
535 def generatev2(repo, includes, excludes, includeobsmarkers):
536 """Emit content for version 2 of a streaming clone.
536 """Emit content for version 2 of a streaming clone.
537
537
538 the data stream consists the following entries:
538 the data stream consists the following entries:
@@ -567,6 +567,9 b' def generatev2(repo, includes, excludes)'
567 if repo.svfs.exists(name):
567 if repo.svfs.exists(name):
568 totalfilesize += repo.svfs.lstat(name).st_size
568 totalfilesize += repo.svfs.lstat(name).st_size
569 entries.append((_srcstore, name, _filefull, None))
569 entries.append((_srcstore, name, _filefull, None))
570 if includeobsmarkers and repo.svfs.exists('obsstore'):
571 totalfilesize += repo.svfs.lstat('obsstore').st_size
572 entries.append((_srcstore, 'obsstore', _filefull, None))
570 for name in cacheutil.cachetocopy(repo):
573 for name in cacheutil.cachetocopy(repo):
571 if repo.cachevfs.exists(name):
574 if repo.cachevfs.exists(name):
572 totalfilesize += repo.cachevfs.lstat(name).st_size
575 totalfilesize += repo.cachevfs.lstat(name).st_size
@@ -514,3 +514,48 b' stream v1 unsuitable for non-publishing '
514 #endif
514 #endif
515
515
516 $ killdaemons.py
516 $ killdaemons.py
517
518 #if stream-legacy
519
520 With v1 of the stream protocol, changeset are always cloned as public. There's
521 no obsolescence markers exchange in stream v1.
522
523 #endif
524 #if stream-bundle2
525
526 Stream repository with obsolescence
527 -----------------------------------
528
529 Clone non-publishing with obsolescence
530
531 $ cat >> $HGRCPATH << EOF
532 > [experimental]
533 > evolution=all
534 > EOF
535
536 $ cd server
537 $ echo foo > foo
538 $ hg -q commit -m 'about to be pruned'
539 $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test --record-parents
540 obsoleted 1 changesets
541 $ hg up null -q
542 $ hg log -T '{rev}: {phase}\n'
543 1: draft
544 0: draft
545 $ hg serve -p $HGPORT -d --pid-file=hg.pid
546 $ cat hg.pid > $DAEMON_PIDS
547 $ cd ..
548
549 $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence
550 streaming all changes
551 1035 files to transfer, 97.1 KB of data
552 transferred 97.1 KB in * seconds (* */sec) (glob)
553 $ hg -R with-obsolescence log -T '{rev}: {phase}\n'
554 1: draft
555 0: draft
556 $ hg debugobsolete -R with-obsolescence
557 50382b884f66690b7045cac93a540cba4d4c906f 0 {c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
558
559 $ killdaemons.py
560
561 #endif
General Comments 0
You need to be logged in to leave comments. Login now