##// END OF EJS Templates
patchbomb: add -B option to select a bookmark...
David Demelier -
r32639:c2fe2b00 default
parent child Browse files
Show More
@@ -0,0 +1,168 b''
1 Create @ bookmark as main reference
2
3 $ hg init repo
4 $ cd repo
5 $ echo "[extensions]" >> $HGRCPATH
6 $ echo "patchbomb=" >> $HGRCPATH
7 $ hg book @
8
9 Create a dummy revision that must never be exported
10
11 $ echo no > no
12 $ hg ci -Amno -d '6 0'
13 adding no
14
15 Create a feature and use -B
16
17 $ hg book booktest
18 $ echo first > a
19 $ hg ci -Amfirst -d '7 0'
20 adding a
21 $ echo second > b
22 $ hg ci -Amsecond -d '8 0'
23 adding b
24 $ hg email --date '1981-1-1 0:1' -n -t foo -s bookmark -B booktest
25 From [test]: test
26 this patch series consists of 2 patches.
27
28
29 Write the introductory message for the patch series.
30
31 Cc:
32
33 displaying [PATCH 0 of 2] bookmark ...
34 Content-Type: text/plain; charset="us-ascii"
35 MIME-Version: 1.0
36 Content-Transfer-Encoding: 7bit
37 Subject: [PATCH 0 of 2] bookmark
38 Message-Id: <patchbomb.347155260@*> (glob)
39 User-Agent: Mercurial-patchbomb/* (glob)
40 Date: Thu, 01 Jan 1981 00:01:00 +0000
41 From: test
42 To: foo
43
44
45 displaying [PATCH 1 of 2] first ...
46 Content-Type: text/plain; charset="us-ascii"
47 MIME-Version: 1.0
48 Content-Transfer-Encoding: 7bit
49 Subject: [PATCH 1 of 2] first
50 X-Mercurial-Node: accde9b8b6dce861c185d0825c1affc09a79cb26
51 X-Mercurial-Series-Index: 1
52 X-Mercurial-Series-Total: 2
53 Message-Id: <accde9b8b6dce861c185.347155261@*> (glob)
54 X-Mercurial-Series-Id: <accde9b8b6dce861c185.347155261@*> (glob)
55 In-Reply-To: <patchbomb.347155260@*> (glob)
56 References: <patchbomb.347155260@*> (glob)
57 User-Agent: Mercurial-patchbomb/* (glob)
58 Date: Thu, 01 Jan 1981 00:01:01 +0000
59 From: test
60 To: foo
61
62 # HG changeset patch
63 # User test
64 # Date 7 0
65 # Thu Jan 01 00:00:07 1970 +0000
66 # Node ID accde9b8b6dce861c185d0825c1affc09a79cb26
67 # Parent 043bd3889e5aaf7d88fe3713cf425f782ad2fb71
68 first
69
70 diff -r 043bd3889e5a -r accde9b8b6dc a
71 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72 +++ b/a Thu Jan 01 00:00:07 1970 +0000
73 @@ -0,0 +1,1 @@
74 +first
75
76 displaying [PATCH 2 of 2] second ...
77 Content-Type: text/plain; charset="us-ascii"
78 MIME-Version: 1.0
79 Content-Transfer-Encoding: 7bit
80 Subject: [PATCH 2 of 2] second
81 X-Mercurial-Node: 417defd1559c396ba06a44dce8dc1c2d2d653f3f
82 X-Mercurial-Series-Index: 2
83 X-Mercurial-Series-Total: 2
84 Message-Id: <417defd1559c396ba06a.347155262@*> (glob)
85 X-Mercurial-Series-Id: <accde9b8b6dce861c185.347155261@*> (glob)
86 In-Reply-To: <patchbomb.347155260@*> (glob)
87 References: <patchbomb.347155260@*> (glob)
88 User-Agent: Mercurial-patchbomb/* (glob)
89 Date: Thu, 01 Jan 1981 00:01:02 +0000
90 From: test
91 To: foo
92
93 # HG changeset patch
94 # User test
95 # Date 8 0
96 # Thu Jan 01 00:00:08 1970 +0000
97 # Node ID 417defd1559c396ba06a44dce8dc1c2d2d653f3f
98 # Parent accde9b8b6dce861c185d0825c1affc09a79cb26
99 second
100
101 diff -r accde9b8b6dc -r 417defd1559c b
102 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
103 +++ b/b Thu Jan 01 00:00:08 1970 +0000
104 @@ -0,0 +1,1 @@
105 +second
106
107 Do the same and combine with -o only one must be exported
108
109 $ cd ..
110 $ hg clone repo repo2
111 updating to bookmark @
112 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
113 $ cd repo
114 $ hg up @
115 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
116 (activating bookmark @)
117 $ hg book outgoing
118 $ echo 1 > x
119 $ hg ci -Am1 -d '8 0'
120 adding x
121 created new head
122 $ hg push ../repo2 -B outgoing
123 pushing to ../repo2
124 searching for changes
125 adding changesets
126 adding manifests
127 adding file changes
128 added 1 changesets with 1 changes to 1 files (+1 heads)
129 exporting bookmark outgoing
130 $ echo 2 > y
131 $ hg ci -Am2 -d '9 0'
132 adding y
133 $ hg email --date '1982-1-1 0:1' -n -t foo -s bookmark -B outgoing -o ../repo2
134 comparing with ../repo2
135 From [test]: test
136 this patch series consists of 1 patches.
137
138 Cc:
139
140 displaying [PATCH] bookmark ...
141 Content-Type: text/plain; charset="us-ascii"
142 MIME-Version: 1.0
143 Content-Transfer-Encoding: 7bit
144 Subject: [PATCH] bookmark
145 X-Mercurial-Node: 8dab2639fd35f1e337ad866c372a5c44f1064e3c
146 X-Mercurial-Series-Index: 1
147 X-Mercurial-Series-Total: 1
148 Message-Id: <8dab2639fd35f1e337ad.378691260@*> (glob)
149 X-Mercurial-Series-Id: <8dab2639fd35f1e337ad.378691260@*> (glob)
150 User-Agent: Mercurial-patchbomb/* (glob)
151 Date: Fri, 01 Jan 1982 00:01:00 +0000
152 From: test
153 To: foo
154
155 # HG changeset patch
156 # User test
157 # Date 9 0
158 # Thu Jan 01 00:00:09 1970 +0000
159 # Node ID 8dab2639fd35f1e337ad866c372a5c44f1064e3c
160 # Parent 0b24b8316483bf30bfc3e4d4168e922b169dbe66
161 2
162
163 diff -r 0b24b8316483 -r 8dab2639fd35 y
164 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
165 +++ b/y Thu Jan 01 00:00:09 1970 +0000
166 @@ -0,0 +1,1 @@
167 +2
168
@@ -90,6 +90,7 b' from mercurial import ('
90 node as nodemod,
90 node as nodemod,
91 patch,
91 patch,
92 registrar,
92 registrar,
93 repair,
93 scmutil,
94 scmutil,
94 templater,
95 templater,
95 util,
96 util,
@@ -442,6 +443,7 b' emailopts = ['
442 ('o', 'outgoing', None,
443 ('o', 'outgoing', None,
443 _('send changes not found in the target repository')),
444 _('send changes not found in the target repository')),
444 ('b', 'bundle', None, _('send changes not in target as a binary bundle')),
445 ('b', 'bundle', None, _('send changes not in target as a binary bundle')),
446 ('B', 'bookmark', '', _('send changes only reachable by given bookmark')),
445 ('', 'bundlename', 'bundle',
447 ('', 'bundlename', 'bundle',
446 _('name of the bundle attachment file'), _('NAME')),
448 _('name of the bundle attachment file'), _('NAME')),
447 ('r', 'rev', [], _('a revision to send'), _('REV')),
449 ('r', 'rev', [], _('a revision to send'), _('REV')),
@@ -480,6 +482,9 b' def email(ui, repo, *revs, **opts):'
480 body and as a regular or an inline attachment by combining the
482 body and as a regular or an inline attachment by combining the
481 -a/--attach or -i/--inline with the --body option.
483 -a/--attach or -i/--inline with the --body option.
482
484
485 With -B/--bookmark changesets reachable by the given bookmark are
486 selected.
487
483 With -o/--outgoing, emails will be generated for patches not found
488 With -o/--outgoing, emails will be generated for patches not found
484 in the destination repository (or only those which are ancestors
489 in the destination repository (or only those which are ancestors
485 of the specified revisions if any are provided)
490 of the specified revisions if any are provided)
@@ -518,6 +523,8 b' def email(ui, repo, *revs, **opts):'
518 hg email -o -r 3000 # send all ancestors of 3000 not in default
523 hg email -o -r 3000 # send all ancestors of 3000 not in default
519 hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST
524 hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST
520
525
526 hg email -B feature # send all ancestors of feature bookmark
527
521 hg email -b # send bundle of all patches not in default
528 hg email -b # send bundle of all patches not in default
522 hg email -b DEST # send bundle of all patches not in DEST
529 hg email -b DEST # send bundle of all patches not in DEST
523 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default
530 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default
@@ -540,13 +547,14 b' def email(ui, repo, *revs, **opts):'
540 mbox = opts.get('mbox')
547 mbox = opts.get('mbox')
541 outgoing = opts.get('outgoing')
548 outgoing = opts.get('outgoing')
542 rev = opts.get('rev')
549 rev = opts.get('rev')
550 bookmark = opts.get('bookmark')
543
551
544 if not (opts.get('test') or mbox):
552 if not (opts.get('test') or mbox):
545 # really sending
553 # really sending
546 mail.validateconfig(ui)
554 mail.validateconfig(ui)
547
555
548 if not (revs or rev or outgoing or bundle):
556 if not (revs or rev or outgoing or bundle or bookmark):
549 raise error.Abort(_('specify at least one changeset with -r or -o'))
557 raise error.Abort(_('specify at least one changeset with -B, -r or -o'))
550
558
551 if outgoing and bundle:
559 if outgoing and bundle:
552 raise error.Abort(_("--outgoing mode always on with --bundle;"
560 raise error.Abort(_("--outgoing mode always on with --bundle;"
@@ -565,6 +573,10 b' def email(ui, repo, *revs, **opts):'
565 if revs:
573 if revs:
566 raise error.Abort(_('use only one form to specify the revision'))
574 raise error.Abort(_('use only one form to specify the revision'))
567 revs = rev
575 revs = rev
576 elif bookmark:
577 if bookmark not in repo._bookmarks:
578 raise error.Abort(_("bookmark '%s' not found") % bookmark)
579 revs = repair.stripbmrevset(repo, bookmark)
568
580
569 revs = scmutil.revrange(repo, revs)
581 revs = scmutil.revrange(repo, revs)
570 if outgoing:
582 if outgoing:
General Comments 0
You need to be logged in to leave comments. Login now