Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 257e402

Browse files
author
Reini Urban
committed
perlhack.pod: add CPERL git rerere workflow
and how to use the cp-rb tool, rebasing all branches on every branch merge.
1 parent 396ddb7 commit 257e402

File tree

3 files changed

+143
-6
lines changed

3 files changed

+143
-6
lines changed

.git-rr-cache

STATUS.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Windows is smoked with MSVC 10 and 12 for 32 and 64bit.
3030

3131
The current stable release is [5.22.4c](https://github.com/perl11/cperl/releases/tag/cperl-5.22.4),
3232
the latest release is [5.24.0c](https://github.com/perl11/cperl/releases/).
33-
See [perl5224cdelta](perl5224cdelta.html) and the [cperl-5.24.1 delta](perlcdelta.html).
33+
See [perl5224cdelta](perl5224cdelta.html) and the [cperl-5.25.1 delta](perlcdelta.html).
3434

3535
All tests pass. CPAN works.
3636

@@ -50,7 +50,7 @@ upgrade is seemless. E.g. Test2 (the new Test::Simple) broke >15
5050
modules without any patches.
5151

5252
cperl-5.24.0c has [about 24 fixes](perldelta.html#Known-Problems-fixed-elsewhere),
53-
for problems which are not fixed in perl-5.24.1.
53+
for problems which are not fixed in perl-5.25.1.
5454
Ditto cperl-5.22.4c has about 20 fixes which are not in the latest
5555
perl-5.22.3.
5656

@@ -65,7 +65,9 @@ perl-5.22.3.
6565
# In the stable master branch are the following major features
6666

6767
* coretypes (Int, UInt, Num, Str. lowercase native types accepted)
68-
* types in signatures as designed and also as attribute
68+
* types in signatures as designed and also as attribute.
69+
* signatures are 2x faster, not 2x slower as with 5.24 or almost as slow
70+
as without as with 5.26.
6971
* function return types declarations as attribute
7072
* many more builtin function attributes
7173
* shaped arrays with compile-time checks and optims
@@ -74,7 +76,7 @@ perl-5.22.3.
7476
* convert static method to subs
7577
* Config as XS
7678
* strict, attributes, DynaLoader, XSLoader as builtin packages, rewritten in C.
77-
Security fixes for DynaLoader
79+
Security fixes for DynaLoader.
7880
* changed default hash function to the fastest FNV1A *(as in the stableperl fork)*
7981
* changed the hash collision strategy from randomize to the usual move-to-front
8082
* changed the default hash fill rate from 100% to 90%
@@ -83,9 +85,10 @@ perl-5.22.3.
8385
* add some unicode ops
8486
* improved build system (make -s, faster, CC vs LD confusion)
8587
* hash keys keep the tainted info. see [perlsec](http://perldoc.perl.org/perlsec.html#Taint-mode)
88+
There are no known taint loopholes anymore.
8689
* fix ops using lexical `$_`
8790
* readonly packages can be cloned with threads
88-
* security and overlarge data fixes for Storable
91+
* security and overlarge data fixes for Storable, YAML not yet.
8992
* include B-C, Cpanel::JSON::XS, YAML::XS, Devel::NYTProf, Term::ReadKey
9093
* improved redefined warnings
9194
* cperl specific toolchain modules, with support for cperl-only module
@@ -94,6 +97,16 @@ perl-5.22.3.
9497
sense and cause not much trouble.
9598
* some security fixes for Unicode confusables, but more are needed (use strict 'names').
9699
* handle method calls on protected stashes
100+
* disallow silent overflows of hash and array indices or string/name lengths.
101+
New "Too many elements" error and many new "overlarge" or "too large" panics.
102+
* harmonize overlarge (>2GB) data, max. I64/I32 string and array lengths,
103+
and U32 hash keys. You can properly access all elements, unlike with perl5.
104+
Do not silently wrap around indices or counts, do not silently truncate
105+
overlarge data as in perl5 upstream.
106+
* special handling for security warnings: protect against hash flood DoS. Warn on
107+
all known public attacks, as metasploit bind/reverse shells or the Storable attack
108+
with the new `warn_security` API, which logs attacks at STDERR/syslog with the
109+
remote user/IP.
97110

98111
Most of them only would have a chance to be merged upstream if a p5p
99112
committer would have written it.

pod/perlhack.pod

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,130 @@ L<http://search.cpan.org/dist/CPANPLUS-YACSmoke/> or
11181118
L<http://search.cpan.org/dist/minismokebox/> or
11191119
L<http://search.cpan.org/dist/CPAN-Reporter/>.
11201120

1121+
=head1 CPERL
1122+
1123+
The cperl development model is a bit different from perl5 porters.
1124+
This workflow can also be used for bigger projects with lots of
1125+
parallel branches being worked on.
1126+
1127+
See L<perlcperl/DEVELOPMENT SETUP> for the initial setup for C<git
1128+
rerere>, which helps in rebasing all actual branches to master for
1129+
every branch merge. This is needed for every committer.
1130+
1131+
Every non-trivial bugfix or enhancement has to got through a public
1132+
github issue or pull request.
1133+
1134+
A branch needs a prefix, like F<bugfix/>, F<feature/> or F<smoke/>,
1135+
and the GITHUB issue number as prefix, like F<feature/gh24-hash-loop>
1136+
If a branch depends on another branch being worked on, you may use
1137+
F<featurex/gh24-new-hash-loop>, i.e. a F<featurex/> prefix and the
1138+
same github number prefix. Only F<smoke/> branches are smoked by
1139+
Travis CI and Appveyor.
1140+
1141+
So you create a new branch, like F<feature/gh24-hash-loop>, make it
1142+
work locally, rename the branch to F<smoke/gh24-hash-loop>, push it
1143+
and see if the smokers run through on all platforms. Be sure to add
1144+
documentation and a perlcdelta entry also. This is different to p5p,
1145+
where deltas are written afterwards.
1146+
1147+
Then a committer will have to merge the branch. This is vastly
1148+
different to other projects. Before pushing the clean merge, one has
1149+
to fix all conflicts with all other actual branches. To ensure that
1150+
the other branches are still current and not out of date.
1151+
This is done via the B<cp-rb> tool in the C<.git-rr-cache> submodule.
1152+
1153+
Preperation (abbrevations used below):
1154+
1155+
alias g=git
1156+
g alias co checkout
1157+
g alias br branch
1158+
g alias rb rebase
1159+
g alias rbs 'rebase --skip'
1160+
g alias rbc 'rebase --continue'
1161+
g alias ciae 'commit --amend --no-edit'
1162+
alias cp-rb=.git-rr-cache/cp-rb
1163+
1164+
Merge:
1165+
1166+
# ensure your branch is clear, can be merged without conflict
1167+
g co smoke/gh24-hash-loop
1168+
g rb master # or origin/master
1169+
g co master
1170+
g merge smoke/gh24-hash-loop
1171+
1172+
Rebase all branches:
1173+
1174+
cp-rb
1175+
1176+
B<cp-rb> rebases all current branches F<bugfix/>, F<feature/>,
1177+
F<featurex/> and F<smoke/> on the new master. For F<featurex/>
1178+
branches or F<smoke/> branches there might be special rules in the
1179+
F<cp-rb> shell script. In the best case the script finishes without any
1180+
rebase CONFLICT. This might happen when there is no conflict, i.e. if
1181+
you worked on a rarely touched file, or the conflict was already
1182+
resolved before and stored in F<.git-rr-cache>. On a CONFLICT F<cp-rb>
1183+
stops, and you are prompted to either resolve or skip it. The easiest
1184+
is working in Emacs B<magit>, where you see where the rebase stopped,
1185+
which files have conflicts, and by clicking on it, jumps to the
1186+
conflict. Typically you have to merge the conflicts, stage it and
1187+
C<g rbc>, i.e. C<r r> in magit or C<git rebase --continue>. Then start
1188+
F<cb-rb> again, which then runs until the next new conflict. The
1189+
F<.git-rr-cache> stored your conflict resolution, if skipped or staged
1190+
and stored.
1191+
1192+
When F<cp-rb> ran through, your F<.git-rr-cache> changes have to be
1193+
stored, and again rebased.
1194+
1195+
1196+
g co master
1197+
cd .git-rr-cache; g add .; g ci -m'gh24-hash-loop'; cd ..
1198+
g add .git-rr-cache; g ci --amend --no-edit
1199+
# and rebase again
1200+
cp-rb
1201+
1202+
Now only the F<.git-rr-cache> submodule CONFLICT should appear which
1203+
is automatically skipped. If all goes well, check if any branch messed
1204+
up the rebase , i.e. in magit display with C<C-x g l L> all local
1205+
branches, and see if the first commit of a branch is a duplicate of a
1206+
previous branch. This sometimes happens, esp. when you rebase a
1207+
temp. work branch already. This commit needs to be inspected and most
1208+
likely skipped. C<cp-rb> should only be run when the branch is really
1209+
ready to be merged to master, otherwise you have to clean up a lot of
1210+
branches afterwards.
1211+
1212+
Then delete the merged branch:
1213+
1214+
g br -d smoke/gh24-hash-loop; g push :smoke/gh24-hash-loop
1215+
1216+
Then you can do a C<git push -f> of all remaining F<smoke/> branches
1217+
and then a C<git push master>, and then C<git push -f> of the rest.
1218+
This way Travis always displays a green status icon, as master is the
1219+
last pushed branch, not some intermediate smoke branch, which is still
1220+
being worked on.
1221+
1222+
The advantage of this workflow is that you fix branch conflicts based
1223+
on your current work and changes, and not months later, on a branch by
1224+
someone else. All branches are automatically current, based on the
1225+
current master and can be immediately being worked on. The conflicts
1226+
are minimal, and previous conflict resultions are stored in the
1227+
F<.git-rr-cache>.
1228+
1229+
Even merging thousands of commits from perl5 upstream are handled
1230+
easily with the cache. Just this is done with cherry-picking, not
1231+
rebasing.
1232+
1233+
The F<branch-point> branch is special. It is either equal to master or
1234+
one C<.git-rr-cache> commit forwards. A trick when merging a new
1235+
branch is to create a special C<.git-rr-cache> commit in
1236+
F<branch-point>, which contains only the C<.git-rr-cache> submodule
1237+
change. All branches are rebased with C<cp-rb> onto this. Conflicts
1238+
in the last master commit cannot be mixed up then with the
1239+
C<.git-rr-cache>, which will happen several times during a C<cp-rb>
1240+
procedure. After all C<cp-rb> conflicts are resolved, F<branch-point>
1241+
can be fixed up (i.e. merged via C<rebase -i>) with the last master
1242+
commit, to be only one single commit.
1243+
1244+
11211245
=head1 WHAT NEXT?
11221246

11231247
If you've read all the documentation in the document and the ones

0 commit comments

Comments
 (0)