##// END OF EJS Templates
merge with stable
Matt Mackall -
r25695:ce3d4b85 merge default
parent child Browse files
Show More
@@ -629,8 +629,14 b' def transplant(ui, repo, *revs, **opts):'
629 if sourcerepo:
629 if sourcerepo:
630 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
630 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
631 heads = map(peer.lookup, opts.get('branch', ()))
631 heads = map(peer.lookup, opts.get('branch', ()))
632 target = set(heads)
633 for r in revs:
634 try:
635 target.add(peer.lookup(r))
636 except error.RepoError:
637 pass
632 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
638 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
633 onlyheads=heads, force=True)
639 onlyheads=sorted(target), force=True)
634 else:
640 else:
635 source = repo
641 source = repo
636 heads = map(source.lookup, opts.get('branch', ()))
642 heads = map(source.lookup, opts.get('branch', ()))
@@ -85,7 +85,6 b' def buildmetadata(ctx):'
85 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
85 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
86 ltags, dist = repo.ui.popbuffer().split('\n')
86 ltags, dist = repo.ui.popbuffer().split('\n')
87 ltags = ltags.split(':')
87 ltags = ltags.split(':')
88 # XXX: ctx.rev() needs to be handled differently with wdir()
89 if ctx.rev() is None:
88 if ctx.rev() is None:
90 changessince = len(repo.revs('only(%d,%s)', ctx.p1(),
89 changessince = len(repo.revs('only(%d,%s)', ctx.p1(),
91 ltags[0])) + 1
90 ltags[0])) + 1
@@ -585,11 +585,13 b' def changegroupsubset(repo, roots, heads'
585 cl = repo.changelog
585 cl = repo.changelog
586 if not roots:
586 if not roots:
587 roots = [nullid]
587 roots = [nullid]
588 # TODO: remove call to nodesbetween.
589 csets, roots, heads = cl.nodesbetween(roots, heads)
590 discbases = []
588 discbases = []
591 for n in roots:
589 for n in roots:
592 discbases.extend([p for p in cl.parents(n) if p != nullid])
590 discbases.extend([p for p in cl.parents(n) if p != nullid])
591 # TODO: remove call to nodesbetween.
592 csets, roots, heads = cl.nodesbetween(roots, heads)
593 included = set(csets)
594 discbases = [n for n in discbases if n not in included]
593 outgoing = discovery.outgoing(cl, discbases, heads)
595 outgoing = discovery.outgoing(cl, discbases, heads)
594 bundler = packermap[version][0](repo)
596 bundler = packermap[version][0](repo)
595 return getsubset(repo, outgoing, bundler, source, version=version)
597 return getsubset(repo, outgoing, bundler, source, version=version)
@@ -73,6 +73,41 b' def tokenize(program, start, end):'
73 pos += 1
73 pos += 1
74 yield ('integer', program[s:pos], s)
74 yield ('integer', program[s:pos], s)
75 pos -= 1
75 pos -= 1
76 elif (c == '\\' and program[pos:pos + 2] in (r"\'", r'\"')
77 or c == 'r' and program[pos:pos + 3] in (r"r\'", r'r\"')):
78 # handle escaped quoted strings for compatibility with 2.9.2-3.4,
79 # where some of nested templates were preprocessed as strings and
80 # then compiled. therefore, \"...\" was allowed. (issue4733)
81 #
82 # processing flow of _evalifliteral() at 5ab28a2e9962:
83 # outer template string -> stringify() -> compiletemplate()
84 # ------------------------ ------------ ------------------
85 # {f("\\\\ {g(\"\\\"\")}"} \\ {g("\"")} [r'\\', {g("\"")}]
86 # ~~~~~~~~
87 # escaped quoted string
88 if c == 'r':
89 pos += 1
90 token = 'rawstring'
91 else:
92 token = 'string'
93 quote = program[pos:pos + 2]
94 s = pos = pos + 2
95 while pos < end: # find closing escaped quote
96 if program.startswith('\\\\\\', pos, end):
97 pos += 4 # skip over double escaped characters
98 continue
99 if program.startswith(quote, pos, end):
100 try:
101 # interpret as if it were a part of an outer string
102 data = program[s:pos].decode('string-escape')
103 except ValueError: # unbalanced escapes
104 raise error.ParseError(_("syntax error"), s)
105 yield (token, data, s)
106 pos += 1
107 break
108 pos += 1
109 else:
110 raise error.ParseError(_("unterminated string"), s)
76 elif c.isalnum() or c in '_':
111 elif c.isalnum() or c in '_':
77 s = pos
112 s = pos
78 pos += 1
113 pos += 1
@@ -2860,6 +2860,16 b' Test string escaping of quotes:'
2860 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2860 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2861 \\\"
2861 \\\"
2862
2862
2863
2864 $ hg log -Ra -r0 -T '{"\""}\n'
2865 "
2866 $ hg log -Ra -r0 -T '{"\\\""}\n'
2867 \"
2868 $ hg log -Ra -r0 -T '{r"\""}\n'
2869 \"
2870 $ hg log -Ra -r0 -T '{r"\\\""}\n'
2871 \\\"
2872
2863 Test exception in quoted template. single backslash before quotation mark is
2873 Test exception in quoted template. single backslash before quotation mark is
2864 stripped before parsing:
2874 stripped before parsing:
2865
2875
@@ -2877,6 +2887,47 b' stripped before parsing:'
2877 valid
2887 valid
2878 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
2888 $ hg log -r 2 -T esc --config templates.esc="'"'{\'"'"'valid\'"'"'}\n'"'"
2879 valid
2889 valid
2890
2891 Test compatibility with 2.9.2-3.4 of escaped quoted strings in nested
2892 _evalifliteral() templates (issue4733):
2893
2894 $ hg log -r 2 -T '{if(rev, "\"{rev}")}\n'
2895 "2
2896 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\"{rev}\")}")}\n'
2897 "2
2898 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\"{rev}\\\")}\")}")}\n'
2899 "2
2900
2901 $ hg log -r 2 -T '{if(rev, "\\\"")}\n'
2902 \"
2903 $ hg log -r 2 -T '{if(rev, "{if(rev, \"\\\\\\\"\")}")}\n'
2904 \"
2905 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, \\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
2906 \"
2907
2908 $ hg log -r 2 -T '{if(rev, r"\\\"")}\n'
2909 \\\"
2910 $ hg log -r 2 -T '{if(rev, "{if(rev, r\"\\\\\\\"\")}")}\n'
2911 \\\"
2912 $ hg log -r 2 -T '{if(rev, "{if(rev, \"{if(rev, r\\\"\\\\\\\\\\\\\\\"\\\")}\")}")}\n'
2913 \\\"
2914
2915 escaped single quotes and errors:
2916
2917 $ hg log -r 2 -T "{if(rev, '{if(rev, \'foo\')}')}"'\n'
2918 foo
2919 $ hg log -r 2 -T "{if(rev, '{if(rev, r\'foo\')}')}"'\n'
2920 foo
2921 $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n'
2922 hg: parse error at 11: unterminated string
2923 [255]
2924 $ hg log -r 2 -T '{if(rev, \"\\"")}\n'
2925 hg: parse error at 11: syntax error
2926 [255]
2927 $ hg log -r 2 -T '{if(rev, r\"\\"")}\n'
2928 hg: parse error at 12: syntax error
2929 [255]
2930
2880 $ cd ..
2931 $ cd ..
2881
2932
2882 Test leading backslashes:
2933 Test leading backslashes:
@@ -272,9 +272,8 b' Check that the right ancestors is used w'
272 removing f1.txt
272 removing f1.txt
273 f2.txt: remote created -> g
273 f2.txt: remote created -> g
274 getting f2.txt
274 getting f2.txt
275 3 changesets found
275 2 changesets found
276 list of changesets:
276 list of changesets:
277 4c9fbe56a16f30c0d5dcc40ec1a97bbe3325209c
278 e31216eec445e44352c5f01588856059466a24c9
277 e31216eec445e44352c5f01588856059466a24c9
279 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
278 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
280 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-backup.hg (glob)
279 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-backup.hg (glob)
@@ -692,3 +692,137 b" Verify bundles don't get overwritten:"
692 $ ls .hg/strip-backup
692 $ ls .hg/strip-backup
693 3903775176ed-54390173-backup.hg
693 3903775176ed-54390173-backup.hg
694 3903775176ed-e68910bd-backup.hg
694 3903775176ed-e68910bd-backup.hg
695 $ cd ..
696
697 Test that we only bundle the stripped changesets (issue4736)
698 ------------------------------------------------------------
699
700 initialisation (previous repo is empty anyway)
701
702 $ hg init issue4736
703 $ cd issue4736
704 $ echo a > a
705 $ hg add a
706 $ hg commit -m commitA
707 $ echo b > b
708 $ hg add b
709 $ hg commit -m commitB
710 $ echo c > c
711 $ hg add c
712 $ hg commit -m commitC
713 $ hg up 'desc(commitB)'
714 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
715 $ echo d > d
716 $ hg add d
717 $ hg commit -m commitD
718 created new head
719 $ hg up 'desc(commitC)'
720 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
721 $ hg merge 'desc(commitD)'
722 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
723 (branch merge, don't forget to commit)
724 $ hg ci -m 'mergeCD'
725 $ hg log -G
726 @ changeset: 4:d8db9d137221
727 |\ tag: tip
728 | | parent: 2:5c51d8d6557d
729 | | parent: 3:6625a5168474
730 | | user: test
731 | | date: Thu Jan 01 00:00:00 1970 +0000
732 | | summary: mergeCD
733 | |
734 | o changeset: 3:6625a5168474
735 | | parent: 1:eca11cf91c71
736 | | user: test
737 | | date: Thu Jan 01 00:00:00 1970 +0000
738 | | summary: commitD
739 | |
740 o | changeset: 2:5c51d8d6557d
741 |/ user: test
742 | date: Thu Jan 01 00:00:00 1970 +0000
743 | summary: commitC
744 |
745 o changeset: 1:eca11cf91c71
746 | user: test
747 | date: Thu Jan 01 00:00:00 1970 +0000
748 | summary: commitB
749 |
750 o changeset: 0:105141ef12d0
751 user: test
752 date: Thu Jan 01 00:00:00 1970 +0000
753 summary: commitA
754
755
756 Check bundle behavior:
757
758 $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg
759 2 changesets found
760 $ hg log -r 'bundle()' -R ../issue4736.hg
761 changeset: 3:6625a5168474
762 parent: 1:eca11cf91c71
763 user: test
764 date: Thu Jan 01 00:00:00 1970 +0000
765 summary: commitD
766
767 changeset: 4:d8db9d137221
768 tag: tip
769 parent: 2:5c51d8d6557d
770 parent: 3:6625a5168474
771 user: test
772 date: Thu Jan 01 00:00:00 1970 +0000
773 summary: mergeCD
774
775
776 check strip behavior
777
778 $ hg --config extensions.strip= strip 'desc(commitD)' --debug
779 resolving manifests
780 branchmerge: False, force: True, partial: False
781 ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
782 c: other deleted -> r
783 removing c
784 d: other deleted -> r
785 removing d
786 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
787 2 changesets found
788 list of changesets:
789 6625a516847449b6f0fa3737b9ba56e9f0f3032c
790 d8db9d1372214336d2b5570f20ee468d2c72fa8b
791 saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg (glob)
792 invalid branchheads cache (served): tip differs
793 truncating cache/rbc-revs-v1 to 24
794 $ hg log -G
795 o changeset: 2:5c51d8d6557d
796 | tag: tip
797 | user: test
798 | date: Thu Jan 01 00:00:00 1970 +0000
799 | summary: commitC
800 |
801 @ changeset: 1:eca11cf91c71
802 | user: test
803 | date: Thu Jan 01 00:00:00 1970 +0000
804 | summary: commitB
805 |
806 o changeset: 0:105141ef12d0
807 user: test
808 date: Thu Jan 01 00:00:00 1970 +0000
809 summary: commitA
810
811
812 strip backup content
813
814 $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg
815 changeset: 3:6625a5168474
816 parent: 1:eca11cf91c71
817 user: test
818 date: Thu Jan 01 00:00:00 1970 +0000
819 summary: commitD
820
821 changeset: 4:d8db9d137221
822 tag: tip
823 parent: 2:5c51d8d6557d
824 parent: 3:6625a5168474
825 user: test
826 date: Thu Jan 01 00:00:00 1970 +0000
827 summary: mergeCD
828
@@ -298,7 +298,7 b' remote transplant with pull'
298 updating to branch default
298 updating to branch default
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
300 $ cd ../rp
300 $ cd ../rp
301 $ hg transplant -s http://localhost:$HGPORT/ 2 4
301 $ hg transplant -s http://localhost:$HGPORT/ 37a1297eb21b a53251cdf717
302 searching for changes
302 searching for changes
303 searching for changes
303 searching for changes
304 adding changesets
304 adding changesets
@@ -313,10 +313,11 b' remote transplant with pull'
313 0 r1
313 0 r1
314
314
315 remote transplant without pull
315 remote transplant without pull
316 (It was using "2" and "4" (as the previous transplant used to) which referenced
317 revision different from one run to another)
316
318
317 $ hg pull -q http://localhost:$HGPORT/
319 $ hg pull -q http://localhost:$HGPORT/
318 $ hg transplant -s http://localhost:$HGPORT/ 2 4
320 $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76
319 searching for changes
320 skipping already applied revision 2:8d9279348abb
321 skipping already applied revision 2:8d9279348abb
321 applying 722f4667af76
322 applying 722f4667af76
322 722f4667af76 transplanted to 76e321915884
323 722f4667af76 transplanted to 76e321915884
General Comments 0
You need to be logged in to leave comments. Login now