comparison ja/hook.tex @ 377:4a9d7e24b915

a bit more hook.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 09 Jan 2009 22:13:32 +0900
parents 24c6081cea2b
children 5530934319b8
comparison
equal deleted inserted replaced
376:9f7812b79c70 377:4a9d7e24b915
377 $B%8%;%C%H$N%a%?%G!<%?$rFI$`$3$H$N$G$-$k%?%$%`%&%#%s%I%&$,3+$/!%$3$N%A%'%s(B 377 $B%8%;%C%H$N%a%?%G!<%?$rFI$`$3$H$N$G$-$k%?%$%`%&%#%s%I%&$,3+$/!%$3$N%A%'%s(B
378 $B%8%;%C%H$O$^$@1JB3E*$J$b$N$K$J$C$F$*$i$:!$=>$C$F<B:_$9$k$H9M$($k$Y$-$G$O(B 378 $B%8%;%C%H$O$^$@1JB3E*$J$b$N$K$J$C$F$*$i$:!$=>$C$F<B:_$9$k$H9M$($k$Y$-$G$O(B
379 $B$J$$$b$N$G$"$k!%%U%C%/$,<B9T$5$l$F$$$k;~4V$,D9$/$J$l$P$J$k$[$I!$%?%$%`%&%#(B 379 $B$J$$$b$N$G$"$k!%%U%C%/$,<B9T$5$l$F$$$k;~4V$,D9$/$J$l$P$J$k$[$I!$%?%$%`%&%#(B
380 $B%s%I%&$,3+$/;~4V$bD9$/$J$k!%(B 380 $B%s%I%&$,3+$/;~4V$bD9$/$J$k!%(B
381 381
382
383 %\subsection{The problem illustrated} 382 %\subsection{The problem illustrated}
384 \subsection{$BLdBj$N>\:Y(B} 383 \subsection{$BLdBj$N>\:Y(B}
385 384
386 In principle, a good use for the \hook{pretxnchangegroup} hook would 385 %In principle, a good use for the \hook{pretxnchangegroup} hook would
387 be to automatically build and test incoming changes before they are 386 %be to automatically build and test incoming changes before they are
388 accepted into a central repository. This could let you guarantee that 387 %accepted into a central repository. This could let you guarantee that
389 nobody can push changes to this repository that ``break the build''. 388 %nobody can push changes to this repository that ``break the build''.
390 But if a client can pull changes while they're being tested, the 389 %But if a client can pull changes while they're being tested, the
391 usefulness of the test is zero; an unsuspecting someone can pull 390 %usefulness of the test is zero; an unsuspecting someone can pull
392 untested changes, potentially breaking their build. 391 %untested changes, potentially breaking their build.
393 392
394 The safest technological answer to this challenge is to set up such a 393 $B<BMQ$K$*$1$k(B\hook{pretxnchangegroup}$B%U%C%/$NNI$$;HMQK!$H$7$F$O!$E~Ce$7$?(B
395 ``gatekeeper'' repository as \emph{unidirectional}. Let it take 394 $BJQ99$,Cf1{$N%j%]%8%H%j$K<h$j9~$^$l$kA0$K<+F0$G%S%k%I$H%F%9%H$r9T$&$3$H$,(B
396 changes pushed in from the outside, but do not allow anyone to pull 395 $B9M$($i$l$k!%$3$l$K$h$j!$%S%k%I$rK8$2$kJQ99$OC/$b%j%]%8%H%j$K(Bpush$B$G$-$J$$(B
397 changes from it (use the \hook{preoutgoing} hook to lock it down). 396 $B$3$H$,3N<B$K$J$k!%%/%i%$%"%s%H$,%F%9%HCf$KJQ99$r(Bpull$B$9$k$3$H$,$G$-$l$P!$(B
398 Configure a \hook{changegroup} hook so that if a build or test 397 $B$3$N%F%9%H$NM-MQ@-$O%<%m$K$J$C$F$7$^$&!%5?$$$r;}$?$:$KC/$+$,%F%9%H$5$l$F(B
399 succeeds, the hook will push the new changes out to another repository 398 $B$$$J$$JQ99$r(Bpull$B$G$-$k$N$G$"$l$P!$H`$i$N%S%k%I$O<:GT$9$k2DG=@-$,$"$k!%(B
400 that people \emph{can} pull from. 399
401 400 %The safest technological answer to this challenge is to set up such a
402 In practice, putting a centralised bottleneck like this in place is 401 %``gatekeeper'' repository as \emph{unidirectional}. Let it take
403 not often a good idea, and transaction visibility has nothing to do 402 %changes pushed in from the outside, but do not allow anyone to pull
404 with the problem. As the size of a project---and the time it takes to 403 %changes from it (use the \hook{preoutgoing} hook to lock it down).
405 build and test---grows, you rapidly run into a wall with this ``try 404 %Configure a \hook{changegroup} hook so that if a build or test
406 before you buy'' approach, where you have more changesets to test than 405 %succeeds, the hook will push the new changes out to another repository
407 time in which to deal with them. The inevitable result is frustration 406 %that people \emph{can} pull from.
408 on the part of all involved. 407
409 408 $B$3$NLdBj$X$N5;=QE*$K:G$b0BA4$J2sEz$O!$(B``$BLgHV(B''$B%j%]%8%H%j$r(B\emph{$B0lJ}8~(B}$B$K(B
410 An approach that scales better is to get people to build and test 409 $B@_Dj$9$k$3$H$G$"$k!%%j%]%8%H%j$r30It$+$i(Bpush$B$5$l$?JQ99$r<u$1<h$k$,!$C/$b(B
411 before they push, then run automated builds and tests centrally 410 pull$B$G$-$J$$$h$&$K@_Dj$9$k!J(B\hook{preoutgoing}$B%U%C%/$r;H$C$F%j%]%8%H%j$r(B
412 \emph{after} a push, to be sure all is well. The advantage of this 411 $B%m%C%/$9$k!K!%(B\hook{changegroup}$B%U%C%/$r@_Dj$7!$%S%k%I$d%F%9%H$,@.8y$7$?(B
413 approach is that it does not impose a limit on the rate at which the 412 $B$H$-$K8B$C$F!$%U%C%/$,?7$?$JJQ99$r%f!<%6$N(Bpull\empth{$B$G$-$k(B}$BJL$N%j%]%8%H(B
414 repository can accept changes. 413 $B%j$K(Bpush$B$9$k$h$&$K$9$k!%(B
414
415 %In practice, putting a centralised bottleneck like this in place is
416 %not often a good idea, and transaction visibility has nothing to do
417 %with the problem. As the size of a project---and the time it takes to
418 %build and test---grows, you rapidly run into a wall with this ``try
419 %before you buy'' approach, where you have more changesets to test than
420 %time in which to deal with them. The inevitable result is frustration
421 %on the part of all involved.
422
423 $B<B:]>e$O!$$3$N$h$&$K=8Cf$7$?%\%H%k%M%C%/$rCV$/$3$H$ONI$$9M$($H$O8@$($:!$(B
424 $B%H%i%s%6%/%7%g%s$N2D;k@-$OA4$/$J$$!%%W%m%8%'%/%H$N%5%$%:$*$h$S%S%k%I$H%F(B
425 $B%9%H$KMW$9$k;~4V$,A}2C$9$k$K=>$C$F!$$3$N$h$&$J(B``$B;vA0$K;n$9(B''$B<jK!$OJI$KFM(B
426 $B$-Ev$?$k!%%F%9%H$K;H$($k;~4V$G;+$-@Z$l$J$$$[$I$N%A%'%s%8%;%C%H$r;n$5$J$1(B
427 $B$l$P$J$i$J$/$J$k$+$i$G$"$k!%%U%i%9%H%l!<%7%g%s$,Cy$k$N$OHr$1$i$l$J$$$@$m(B
428 $B$&!%(B
429
430 %An approach that scales better is to get people to build and test
431 %before they push, then run automated builds and tests centrally
432 %\emph{after} a push, to be sure all is well. The advantage of this
433 %approach is that it does not impose a limit on the rate at which the
434 %repository can accept changes.
435
436 $B$h$j%9%1!<%k$9$k<jK!$O!$3+H/<T$K(Bpush$BA0$N%S%k%I$H%F%9%H$r$5$;$k$3$H$G$"(B
437 $B$k!%Cf1{$G<+F0$K$h$k%S%k%I$H%F%9%H$r9T$&$N$O!$(Bpush\emph{$B8e(B}$B$K!$A4$F$KLdBj(B
438 $B$,$J$$$3$H$r3NG'$9$k$?$a$K9T$&!%$3$N%"%W%m!<%A$NMxE@$O%j%]%8%H%j$,JQ99$r(B
439 $B<u$1F~$l$k%Z!<%9$K2?$b@)8B$r2]$5$J$$$3$H$G$"$k!%(B
415 440
416 %\section{A short tutorial on using hooks} 441 %\section{A short tutorial on using hooks}
417 \section{$B%U%C%/$N;HMQK!(B} 442 \section{$B%U%C%/$N;HMQK!(B}
418 \label{sec:hook:simple} 443 \label{sec:hook:simple}
419 444