##// END OF EJS Templates
patchbomb: check that targets exist at the publicurl...
Pierre-Yves David -
r26626:dca16172 default
parent child Browse files
Show More
@@ -527,6 +527,37 b' def patchbomb(ui, repo, *revs, **opts):'
527 if bundle:
527 if bundle:
528 opts['revs'] = [str(r) for r in revs]
528 opts['revs'] = [str(r) for r in revs]
529
529
530 # check if revision exist on the public destination
531 publicurl = repo.ui.config('patchbomb', 'publicurl')
532 if publicurl is not None:
533 repo.ui.debug('checking that revision exist in the public repo')
534 try:
535 publicpeer = hg.peer(repo, {}, publicurl)
536 except error.RepoError:
537 repo.ui.write_err(_('unable to access public repo: %s\n')
538 % publicurl)
539 raise
540 if not publicpeer.capable('known'):
541 repo.ui.debug('skipping existence checks: public repo too old')
542 else:
543 out = [repo[r] for r in revs]
544 known = publicpeer.known(h.node() for h in out)
545 missing = []
546 for idx, h in enumerate(out):
547 if not known[idx]:
548 missing.append(h)
549 if missing:
550 if 1 < len(missing):
551 msg = _('public "%s" is missing %s and %i others')
552 msg %= (publicurl, missing[0], len(missing) - 1)
553 else:
554 msg = _('public url %s is missing %s')
555 msg %= (publicurl, missing[0])
556 revhint = ''.join('-r %s' % h
557 for h in repo.set('heads(%ld)', missing))
558 hint = _('use "hg push %s %s"') % (publicurl, revhint)
559 raise error.Abort(msg, hint=hint)
560
530 # start
561 # start
531 if date:
562 if date:
532 start_time = util.parsedate(date)
563 start_time = util.parsedate(date)
@@ -2845,15 +2845,34 b' single rev'
2845 Test pull url header
2845 Test pull url header
2846 =================================
2846 =================================
2847
2847
2848 basic version
2849
2848 $ echo 'intro=auto' >> $HGRCPATH
2850 $ echo 'intro=auto' >> $HGRCPATH
2849 $ echo 'publicurl=http://example.com/myrepo/' >> $HGRCPATH
2851 $ echo "publicurl=$TESTTMP/t2" >> $HGRCPATH
2850 $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep '^#'
2852 $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep '^#'
2851 # HG changeset patch
2853 abort: public url $TESTTMP/t2 is missing 3b6f1ec9dde9
2852 # User test
2854 (use "hg push $TESTTMP/t2 -r 3b6f1ec9dde9")
2853 # Date 5 0
2855 [1]
2854 # Thu Jan 01 00:00:05 1970 +0000
2856
2855 # Branch test
2857 remote missing
2856 # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af
2858
2857 # Parent 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268
2859 $ echo 'publicurl=$TESTTMP/missing' >> $HGRCPATH
2858 # Available At http://example.com/myrepo/
2860 $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10'
2859 # hg pull http://example.com/myrepo/ -r 3b6f1ec9dde9
2861 unable to access public repo: $TESTTMP/missing
2862 abort: repository $TESTTMP/missing not found!
2863 [255]
2864
2865 node missing at remote
2866
2867 $ hg clone -r '9' . ../t3
2868 adding changesets
2869 adding manifests
2870 adding file changes
2871 added 3 changesets with 3 changes to 3 files
2872 updating to branch test
2873 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
2874 $ echo 'publicurl=$TESTTMP/t3' >> $HGRCPATH
2875 $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10'
2876 abort: public url $TESTTMP/t3 is missing 3b6f1ec9dde9
2877 (use "hg push $TESTTMP/t3 -r 3b6f1ec9dde9")
2878 [255]
General Comments 0
You need to be logged in to leave comments. Login now