depot_tools_tutorial.html 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  2. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
  6. <meta name="generator" content="AsciiDoc 8.6.9" />
  7. <title>depot_tools_tutorial(7)</title>
  8. <style type="text/css">
  9. /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
  10. /* Default font. */
  11. body {
  12. font-family: Georgia,serif;
  13. }
  14. /* Title font. */
  15. h1, h2, h3, h4, h5, h6,
  16. div.title, caption.title,
  17. thead, p.table.header,
  18. #toctitle,
  19. #author, #revnumber, #revdate, #revremark,
  20. #footer {
  21. font-family: Arial,Helvetica,sans-serif;
  22. }
  23. body {
  24. margin: 1em 5% 1em 5%;
  25. }
  26. a {
  27. color: blue;
  28. text-decoration: underline;
  29. }
  30. a:visited {
  31. color: fuchsia;
  32. }
  33. em {
  34. font-style: italic;
  35. color: navy;
  36. }
  37. strong {
  38. font-weight: bold;
  39. color: #083194;
  40. }
  41. h1, h2, h3, h4, h5, h6 {
  42. color: #527bbd;
  43. margin-top: 1.2em;
  44. margin-bottom: 0.5em;
  45. line-height: 1.3;
  46. }
  47. h1, h2, h3 {
  48. border-bottom: 2px solid silver;
  49. }
  50. h2 {
  51. padding-top: 0.5em;
  52. }
  53. h3 {
  54. float: left;
  55. }
  56. h3 + * {
  57. clear: left;
  58. }
  59. h5 {
  60. font-size: 1.0em;
  61. }
  62. div.sectionbody {
  63. margin-left: 0;
  64. }
  65. hr {
  66. border: 1px solid silver;
  67. }
  68. p {
  69. margin-top: 0.5em;
  70. margin-bottom: 0.5em;
  71. }
  72. ul, ol, li > p {
  73. margin-top: 0;
  74. }
  75. ul > li { color: #aaa; }
  76. ul > li > * { color: black; }
  77. .monospaced, code, pre {
  78. font-family: "Courier New", Courier, monospace;
  79. font-size: inherit;
  80. color: navy;
  81. padding: 0;
  82. margin: 0;
  83. }
  84. pre {
  85. white-space: pre-wrap;
  86. }
  87. #author {
  88. color: #527bbd;
  89. font-weight: bold;
  90. font-size: 1.1em;
  91. }
  92. #email {
  93. }
  94. #revnumber, #revdate, #revremark {
  95. }
  96. #footer {
  97. font-size: small;
  98. border-top: 2px solid silver;
  99. padding-top: 0.5em;
  100. margin-top: 4.0em;
  101. }
  102. #footer-text {
  103. float: left;
  104. padding-bottom: 0.5em;
  105. }
  106. #footer-badges {
  107. float: right;
  108. padding-bottom: 0.5em;
  109. }
  110. #preamble {
  111. margin-top: 1.5em;
  112. margin-bottom: 1.5em;
  113. }
  114. div.imageblock, div.exampleblock, div.verseblock,
  115. div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
  116. div.admonitionblock {
  117. margin-top: 1.0em;
  118. margin-bottom: 1.5em;
  119. }
  120. div.admonitionblock {
  121. margin-top: 2.0em;
  122. margin-bottom: 2.0em;
  123. margin-right: 10%;
  124. color: #606060;
  125. }
  126. div.content { /* Block element content. */
  127. padding: 0;
  128. }
  129. /* Block element titles. */
  130. div.title, caption.title {
  131. color: #527bbd;
  132. font-weight: bold;
  133. text-align: left;
  134. margin-top: 1.0em;
  135. margin-bottom: 0.5em;
  136. }
  137. div.title + * {
  138. margin-top: 0;
  139. }
  140. td div.title:first-child {
  141. margin-top: 0.0em;
  142. }
  143. div.content div.title:first-child {
  144. margin-top: 0.0em;
  145. }
  146. div.content + div.title {
  147. margin-top: 0.0em;
  148. }
  149. div.sidebarblock > div.content {
  150. background: #ffffee;
  151. border: 1px solid #dddddd;
  152. border-left: 4px solid #f0f0f0;
  153. padding: 0.5em;
  154. }
  155. div.listingblock > div.content {
  156. border: 1px solid #dddddd;
  157. border-left: 5px solid #f0f0f0;
  158. background: #f8f8f8;
  159. padding: 0.5em;
  160. }
  161. div.quoteblock, div.verseblock {
  162. padding-left: 1.0em;
  163. margin-left: 1.0em;
  164. margin-right: 10%;
  165. border-left: 5px solid #f0f0f0;
  166. color: #888;
  167. }
  168. div.quoteblock > div.attribution {
  169. padding-top: 0.5em;
  170. text-align: right;
  171. }
  172. div.verseblock > pre.content {
  173. font-family: inherit;
  174. font-size: inherit;
  175. }
  176. div.verseblock > div.attribution {
  177. padding-top: 0.75em;
  178. text-align: left;
  179. }
  180. /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
  181. div.verseblock + div.attribution {
  182. text-align: left;
  183. }
  184. div.admonitionblock .icon {
  185. vertical-align: top;
  186. font-size: 1.1em;
  187. font-weight: bold;
  188. text-decoration: underline;
  189. color: #527bbd;
  190. padding-right: 0.5em;
  191. }
  192. div.admonitionblock td.content {
  193. padding-left: 0.5em;
  194. border-left: 3px solid #dddddd;
  195. }
  196. div.exampleblock > div.content {
  197. border-left: 3px solid #dddddd;
  198. padding-left: 0.5em;
  199. }
  200. div.imageblock div.content { padding-left: 0; }
  201. span.image img { border-style: none; vertical-align: text-bottom; }
  202. a.image:visited { color: white; }
  203. dl {
  204. margin-top: 0.8em;
  205. margin-bottom: 0.8em;
  206. }
  207. dt {
  208. margin-top: 0.5em;
  209. margin-bottom: 0;
  210. font-style: normal;
  211. color: navy;
  212. }
  213. dd > *:first-child {
  214. margin-top: 0.1em;
  215. }
  216. ul, ol {
  217. list-style-position: outside;
  218. }
  219. ol.arabic {
  220. list-style-type: decimal;
  221. }
  222. ol.loweralpha {
  223. list-style-type: lower-alpha;
  224. }
  225. ol.upperalpha {
  226. list-style-type: upper-alpha;
  227. }
  228. ol.lowerroman {
  229. list-style-type: lower-roman;
  230. }
  231. ol.upperroman {
  232. list-style-type: upper-roman;
  233. }
  234. div.compact ul, div.compact ol,
  235. div.compact p, div.compact p,
  236. div.compact div, div.compact div {
  237. margin-top: 0.1em;
  238. margin-bottom: 0.1em;
  239. }
  240. tfoot {
  241. font-weight: bold;
  242. }
  243. td > div.verse {
  244. white-space: pre;
  245. }
  246. div.hdlist {
  247. margin-top: 0.8em;
  248. margin-bottom: 0.8em;
  249. }
  250. div.hdlist tr {
  251. padding-bottom: 15px;
  252. }
  253. dt.hdlist1.strong, td.hdlist1.strong {
  254. font-weight: bold;
  255. }
  256. td.hdlist1 {
  257. vertical-align: top;
  258. font-style: normal;
  259. padding-right: 0.8em;
  260. color: navy;
  261. }
  262. td.hdlist2 {
  263. vertical-align: top;
  264. }
  265. div.hdlist.compact tr {
  266. margin: 0;
  267. padding-bottom: 0;
  268. }
  269. .comment {
  270. background: yellow;
  271. }
  272. .footnote, .footnoteref {
  273. font-size: 0.8em;
  274. }
  275. span.footnote, span.footnoteref {
  276. vertical-align: super;
  277. }
  278. #footnotes {
  279. margin: 20px 0 20px 0;
  280. padding: 7px 0 0 0;
  281. }
  282. #footnotes div.footnote {
  283. margin: 0 0 5px 0;
  284. }
  285. #footnotes hr {
  286. border: none;
  287. border-top: 1px solid silver;
  288. height: 1px;
  289. text-align: left;
  290. margin-left: 0;
  291. width: 20%;
  292. min-width: 100px;
  293. }
  294. div.colist td {
  295. padding-right: 0.5em;
  296. padding-bottom: 0.3em;
  297. vertical-align: top;
  298. }
  299. div.colist td img {
  300. margin-top: 0.3em;
  301. }
  302. @media print {
  303. #footer-badges { display: none; }
  304. }
  305. #toc {
  306. margin-bottom: 2.5em;
  307. }
  308. #toctitle {
  309. color: #527bbd;
  310. font-size: 1.1em;
  311. font-weight: bold;
  312. margin-top: 1.0em;
  313. margin-bottom: 0.1em;
  314. }
  315. div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
  316. margin-top: 0;
  317. margin-bottom: 0;
  318. }
  319. div.toclevel2 {
  320. margin-left: 2em;
  321. font-size: 0.9em;
  322. }
  323. div.toclevel3 {
  324. margin-left: 4em;
  325. font-size: 0.9em;
  326. }
  327. div.toclevel4 {
  328. margin-left: 6em;
  329. font-size: 0.9em;
  330. }
  331. span.aqua { color: aqua; }
  332. span.black { color: black; }
  333. span.blue { color: blue; }
  334. span.fuchsia { color: fuchsia; }
  335. span.gray { color: gray; }
  336. span.green { color: green; }
  337. span.lime { color: lime; }
  338. span.maroon { color: maroon; }
  339. span.navy { color: navy; }
  340. span.olive { color: olive; }
  341. span.purple { color: purple; }
  342. span.red { color: red; }
  343. span.silver { color: silver; }
  344. span.teal { color: teal; }
  345. span.white { color: white; }
  346. span.yellow { color: yellow; }
  347. span.aqua-background { background: aqua; }
  348. span.black-background { background: black; }
  349. span.blue-background { background: blue; }
  350. span.fuchsia-background { background: fuchsia; }
  351. span.gray-background { background: gray; }
  352. span.green-background { background: green; }
  353. span.lime-background { background: lime; }
  354. span.maroon-background { background: maroon; }
  355. span.navy-background { background: navy; }
  356. span.olive-background { background: olive; }
  357. span.purple-background { background: purple; }
  358. span.red-background { background: red; }
  359. span.silver-background { background: silver; }
  360. span.teal-background { background: teal; }
  361. span.white-background { background: white; }
  362. span.yellow-background { background: yellow; }
  363. span.big { font-size: 2em; }
  364. span.small { font-size: 0.6em; }
  365. span.underline { text-decoration: underline; }
  366. span.overline { text-decoration: overline; }
  367. span.line-through { text-decoration: line-through; }
  368. div.unbreakable { page-break-inside: avoid; }
  369. /*
  370. * xhtml11 specific
  371. *
  372. * */
  373. div.tableblock {
  374. margin-top: 1.0em;
  375. margin-bottom: 1.5em;
  376. }
  377. div.tableblock > table {
  378. border: 3px solid #527bbd;
  379. }
  380. thead, p.table.header {
  381. font-weight: bold;
  382. color: #527bbd;
  383. }
  384. p.table {
  385. margin-top: 0;
  386. }
  387. /* Because the table frame attribute is overriden by CSS in most browsers. */
  388. div.tableblock > table[frame="void"] {
  389. border-style: none;
  390. }
  391. div.tableblock > table[frame="hsides"] {
  392. border-left-style: none;
  393. border-right-style: none;
  394. }
  395. div.tableblock > table[frame="vsides"] {
  396. border-top-style: none;
  397. border-bottom-style: none;
  398. }
  399. /*
  400. * html5 specific
  401. *
  402. * */
  403. table.tableblock {
  404. margin-top: 1.0em;
  405. margin-bottom: 1.5em;
  406. }
  407. thead, p.tableblock.header {
  408. font-weight: bold;
  409. color: #527bbd;
  410. }
  411. p.tableblock {
  412. margin-top: 0;
  413. }
  414. table.tableblock {
  415. border-width: 3px;
  416. border-spacing: 0px;
  417. border-style: solid;
  418. border-color: #527bbd;
  419. border-collapse: collapse;
  420. }
  421. th.tableblock, td.tableblock {
  422. border-width: 1px;
  423. padding: 4px;
  424. border-style: solid;
  425. border-color: #527bbd;
  426. }
  427. table.tableblock.frame-topbot {
  428. border-left-style: hidden;
  429. border-right-style: hidden;
  430. }
  431. table.tableblock.frame-sides {
  432. border-top-style: hidden;
  433. border-bottom-style: hidden;
  434. }
  435. table.tableblock.frame-none {
  436. border-style: hidden;
  437. }
  438. th.tableblock.halign-left, td.tableblock.halign-left {
  439. text-align: left;
  440. }
  441. th.tableblock.halign-center, td.tableblock.halign-center {
  442. text-align: center;
  443. }
  444. th.tableblock.halign-right, td.tableblock.halign-right {
  445. text-align: right;
  446. }
  447. th.tableblock.valign-top, td.tableblock.valign-top {
  448. vertical-align: top;
  449. }
  450. th.tableblock.valign-middle, td.tableblock.valign-middle {
  451. vertical-align: middle;
  452. }
  453. th.tableblock.valign-bottom, td.tableblock.valign-bottom {
  454. vertical-align: bottom;
  455. }
  456. /*
  457. * manpage specific
  458. *
  459. * */
  460. body.manpage h1 {
  461. padding-top: 0.5em;
  462. padding-bottom: 0.5em;
  463. border-top: 2px solid silver;
  464. border-bottom: 2px solid silver;
  465. }
  466. body.manpage h2 {
  467. border-style: none;
  468. }
  469. body.manpage div.sectionbody {
  470. margin-left: 3em;
  471. }
  472. @media print {
  473. body.manpage div#toc { display: none; }
  474. }
  475. div.listingblock > div.content {
  476. background: rgb(28, 28, 28);
  477. }
  478. div.listingblock > div > pre > code {
  479. color: rgb(187, 187, 187);
  480. }
  481. </style>
  482. <script type="text/javascript">
  483. /*<![CDATA[*/
  484. var asciidoc = { // Namespace.
  485. /////////////////////////////////////////////////////////////////////
  486. // Table Of Contents generator
  487. /////////////////////////////////////////////////////////////////////
  488. /* Author: Mihai Bazon, September 2002
  489. * http://students.infoiasi.ro/~mishoo
  490. *
  491. * Table Of Content generator
  492. * Version: 0.4
  493. *
  494. * Feel free to use this script under the terms of the GNU General Public
  495. * License, as long as you do not remove or alter this notice.
  496. */
  497. /* modified by Troy D. Hanson, September 2006. License: GPL */
  498. /* modified by Stuart Rackham, 2006, 2009. License: GPL */
  499. // toclevels = 1..4.
  500. toc: function (toclevels) {
  501. function getText(el) {
  502. var text = "";
  503. for (var i = el.firstChild; i != null; i = i.nextSibling) {
  504. if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
  505. text += i.data;
  506. else if (i.firstChild != null)
  507. text += getText(i);
  508. }
  509. return text;
  510. }
  511. function TocEntry(el, text, toclevel) {
  512. this.element = el;
  513. this.text = text;
  514. this.toclevel = toclevel;
  515. }
  516. function tocEntries(el, toclevels) {
  517. var result = new Array;
  518. var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
  519. // Function that scans the DOM tree for header elements (the DOM2
  520. // nodeIterator API would be a better technique but not supported by all
  521. // browsers).
  522. var iterate = function (el) {
  523. for (var i = el.firstChild; i != null; i = i.nextSibling) {
  524. if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
  525. var mo = re.exec(i.tagName);
  526. if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
  527. result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
  528. }
  529. iterate(i);
  530. }
  531. }
  532. }
  533. iterate(el);
  534. return result;
  535. }
  536. var toc = document.getElementById("toc");
  537. if (!toc) {
  538. return;
  539. }
  540. // Delete existing TOC entries in case we're reloading the TOC.
  541. var tocEntriesToRemove = [];
  542. var i;
  543. for (i = 0; i < toc.childNodes.length; i++) {
  544. var entry = toc.childNodes[i];
  545. if (entry.nodeName.toLowerCase() == 'div'
  546. && entry.getAttribute("class")
  547. && entry.getAttribute("class").match(/^toclevel/))
  548. tocEntriesToRemove.push(entry);
  549. }
  550. for (i = 0; i < tocEntriesToRemove.length; i++) {
  551. toc.removeChild(tocEntriesToRemove[i]);
  552. }
  553. // Rebuild TOC entries.
  554. var entries = tocEntries(document.getElementById("content"), toclevels);
  555. for (var i = 0; i < entries.length; ++i) {
  556. var entry = entries[i];
  557. if (entry.element.id == "")
  558. entry.element.id = "_toc_" + i;
  559. var a = document.createElement("a");
  560. a.href = "#" + entry.element.id;
  561. a.appendChild(document.createTextNode(entry.text));
  562. var div = document.createElement("div");
  563. div.appendChild(a);
  564. div.className = "toclevel" + entry.toclevel;
  565. toc.appendChild(div);
  566. }
  567. if (entries.length == 0)
  568. toc.parentNode.removeChild(toc);
  569. },
  570. /////////////////////////////////////////////////////////////////////
  571. // Footnotes generator
  572. /////////////////////////////////////////////////////////////////////
  573. /* Based on footnote generation code from:
  574. * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
  575. */
  576. footnotes: function () {
  577. // Delete existing footnote entries in case we're reloading the footnodes.
  578. var i;
  579. var noteholder = document.getElementById("footnotes");
  580. if (!noteholder) {
  581. return;
  582. }
  583. var entriesToRemove = [];
  584. for (i = 0; i < noteholder.childNodes.length; i++) {
  585. var entry = noteholder.childNodes[i];
  586. if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
  587. entriesToRemove.push(entry);
  588. }
  589. for (i = 0; i < entriesToRemove.length; i++) {
  590. noteholder.removeChild(entriesToRemove[i]);
  591. }
  592. // Rebuild footnote entries.
  593. var cont = document.getElementById("content");
  594. var spans = cont.getElementsByTagName("span");
  595. var refs = {};
  596. var n = 0;
  597. for (i=0; i<spans.length; i++) {
  598. if (spans[i].className == "footnote") {
  599. n++;
  600. var note = spans[i].getAttribute("data-note");
  601. if (!note) {
  602. // Use [\s\S] in place of . so multi-line matches work.
  603. // Because JavaScript has no s (dotall) regex flag.
  604. note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
  605. spans[i].innerHTML =
  606. "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
  607. "' title='View footnote' class='footnote'>" + n + "</a>]";
  608. spans[i].setAttribute("data-note", note);
  609. }
  610. noteholder.innerHTML +=
  611. "<div class='footnote' id='_footnote_" + n + "'>" +
  612. "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
  613. n + "</a>. " + note + "</div>";
  614. var id =spans[i].getAttribute("id");
  615. if (id != null) refs["#"+id] = n;
  616. }
  617. }
  618. if (n == 0)
  619. noteholder.parentNode.removeChild(noteholder);
  620. else {
  621. // Process footnoterefs.
  622. for (i=0; i<spans.length; i++) {
  623. if (spans[i].className == "footnoteref") {
  624. var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
  625. href = href.match(/#.*/)[0]; // Because IE return full URL.
  626. n = refs[href];
  627. spans[i].innerHTML =
  628. "[<a href='#_footnote_" + n +
  629. "' title='View footnote' class='footnote'>" + n + "</a>]";
  630. }
  631. }
  632. }
  633. },
  634. install: function(toclevels) {
  635. var timerId;
  636. function reinstall() {
  637. asciidoc.footnotes();
  638. if (toclevels) {
  639. asciidoc.toc(toclevels);
  640. }
  641. }
  642. function reinstallAndRemoveTimer() {
  643. clearInterval(timerId);
  644. reinstall();
  645. }
  646. timerId = setInterval(reinstall, 500);
  647. if (document.addEventListener)
  648. document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
  649. else
  650. window.onload = reinstallAndRemoveTimer;
  651. }
  652. }
  653. asciidoc.install();
  654. /*]]>*/
  655. </script>
  656. </head>
  657. <body class="manpage">
  658. <div id="header">
  659. <h1>
  660. depot_tools_tutorial(7) Manual Page
  661. </h1>
  662. <h2>NAME</h2>
  663. <div class="sectionbody">
  664. <p>depot_tools_tutorial -
  665. A tutorial introduction to the Chromium depot_tools git extensions.
  666. </p>
  667. </div>
  668. </div>
  669. <div id="content">
  670. <div class="sect1">
  671. <h2 id="_description">DESCRIPTION</h2>
  672. <div class="sectionbody">
  673. <div class="paragraph"><p>The Chromium <a href="depot_tools.html">depot_tools(7)</a> suite contains many git workflow-enhancing
  674. tools which are designed to work together to enable anyone to wrangle the
  675. Chromium codebase expertly. This tutorial explains how to do development on
  676. Chromium using these tools. This will cover:</p></div>
  677. <div class="ulist"><ul>
  678. <li>
  679. <p>
  680. <a href="#_setting_up">Setting up</a>
  681. </p>
  682. </li>
  683. <li>
  684. <p>
  685. <a href="#_getting_the_code">Getting the code</a>
  686. </p>
  687. </li>
  688. <li>
  689. <p>
  690. <a href="#_tl_dr">TL;DR</a>
  691. </p>
  692. </li>
  693. <li>
  694. <p>
  695. <a href="#_creating_uploading_a_cl">Creating / Uploading a CL</a>
  696. </p>
  697. </li>
  698. <li>
  699. <p>
  700. <a href="#_updating_the_code">Updating the code</a>
  701. </p>
  702. </li>
  703. <li>
  704. <p>
  705. <a href="#_managing_multiple_cls">Managing multiple CLs</a>
  706. </p>
  707. </li>
  708. <li>
  709. <p>
  710. <a href="#_managing_dependent_cls">Managing dependent CLs</a>
  711. </p>
  712. </li>
  713. <li>
  714. <p>
  715. <a href="#_example_walkthrough">Example Walkthrough</a>
  716. </p>
  717. </li>
  718. </ul></div>
  719. <div class="paragraph"><p>Please refer to the manpages (or <code>--help</code> output) for details about any of the
  720. commands mentioned in this tutorial.</p></div>
  721. <div class="admonitionblock">
  722. <table><tr>
  723. <td class="icon">
  724. <div class="title">Note</div>
  725. </td>
  726. <td class="content">If your platform does not support manpages (or you prefer something a bit more
  727. expressive than plain text) you can find all documentation in <em>html</em> form in the
  728. <code>[DEPOT_TOOLS]/man/html</code> folder.</td>
  729. </tr></table>
  730. </div>
  731. <div class="sect2">
  732. <h3 id="_prerequisites">PREREQUISITES</h3>
  733. <div class="paragraph"><p>This tutorial assumes basic familiarity with git terminology and concepts. If you
  734. need to brush up on these, the following are very good resources:</p></div>
  735. <div class="ulist"><ul>
  736. <li>
  737. <p>
  738. <a href="http://think-like-a-git.net/">Think like (a) Git</a> - A lighthearted
  739. overview of git. If you&#8217;re sorta-familiar with git, but not <em>comfortable</em> with
  740. it, then give this a look.
  741. </p>
  742. </li>
  743. <li>
  744. <p>
  745. <a href="http://gitimmersion.com/">Git Immersion Tutorial</a> - An in-depth git
  746. tutorial.
  747. </p>
  748. </li>
  749. <li>
  750. <p>
  751. <a href="http://pcottle.github.io/learnGitBranching">pcottle&#8217;s Visual Git
  752. Branching</a> - An excellent interactive/graphical demo on how git handles
  753. commits, branches, and shows the operations git performs on them.
  754. </p>
  755. </li>
  756. <li>
  757. <p>
  758. <a href="http://git-scm.com/book">Pro Git book</a> - &#8220;The&#8221; book for learning git
  759. from basics to advanced concepts. A bit dry, but very through.
  760. </p>
  761. </li>
  762. </ul></div>
  763. <div class="paragraph"><p>If you&#8217;ve tried these out and are still having some trouble getting started,
  764. there are <em>many</em> other resources online which should help. If you&#8217;re <em>really</em>
  765. <strong><em>really</em></strong> stuck, then chat up one of the Chromium infrastructure team
  766. members for some pointers.</p></div>
  767. <div class="dlist"><dl>
  768. <dt class="hdlist1">
  769. Litmus Test
  770. </dt>
  771. <dd>
  772. <p>
  773. If you know what <code>git add</code>, <code>git status</code>, <code>git commit</code> do and you know
  774. <em>essentially</em> what <code>git rebase</code> does, then you should know enough to follow
  775. along.
  776. </p>
  777. </dd>
  778. </dl></div>
  779. </div>
  780. </div>
  781. </div>
  782. <div class="sect1">
  783. <h2 id="_setting_up">SETTING UP</h2>
  784. <div class="sectionbody">
  785. <div class="sect2">
  786. <h3 id="_get_depot_tools">GET DEPOT TOOLS</h3>
  787. <div class="sect3">
  788. <h4 id="_linux_mac">LINUX / MAC</h4>
  789. <div class="paragraph"><p>Clone the <em>depot_tools</em> repository:</p></div>
  790. <div class="listingblock">
  791. <div class="content">
  792. <pre><code><strong><span class="white">$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git</span></strong></code></pre>
  793. </div></div>
  794. <div class="paragraph"><p>Add <em>depot_tools</em> to the <em>front</em> of your PATH (you will probably want to put this
  795. in your <code>~/.bashrc</code> or <code>~/.zshrc</code>). Assuming you cloned <em>depot_tools</em> to
  796. <code>/path/to/depot_tools</code>:</p></div>
  797. <div class="listingblock">
  798. <div class="content">
  799. <pre><code><strong><span class="white">$ export PATH=/path/to/depot_tools:$PATH</span></strong></code></pre>
  800. </div></div>
  801. </div>
  802. <div class="sect3">
  803. <h4 id="_windows">WINDOWS</h4>
  804. <div class="paragraph"><p>Download the <em>depot_tools</em>
  805. <a href="https://storage.googleapis.com/chrome-infra/depot_tools.zip">bundle</a> and
  806. extract it somewhere.</p></div>
  807. <div class="admonitionblock">
  808. <table><tr>
  809. <td class="icon">
  810. <div class="title">Warning</div>
  811. </td>
  812. <td class="content"><strong>DO NOT</strong> use drag-n-drop or copy-n-paste extract from Explorer, this will not
  813. extract the hidden &#8220;.git&#8221; folder which is necessary for <em>depot_tools</em> to
  814. autoupdate itself. You can use &#8220;Extract all&#8230;&#8221; from the context menu though.</td>
  815. </tr></table>
  816. </div>
  817. <div class="paragraph"><p>Add <em>depot_tools</em> to the <em>front</em> of your PATH (must be ahead of any installs of
  818. Python). Assuming you unzipped the bundle to <code>C:\workspace\depot_tools</code>:</p></div>
  819. <div class="dlist"><dl>
  820. <dt class="hdlist1">
  821. With Administrator access:
  822. </dt>
  823. <dd>
  824. <p>
  825. <strong>Control Panel &#8594; System and Security &#8594; System &#8594; Advanced system settings</strong>
  826. </p>
  827. <div class="paragraph"><p>Modify the PATH system variable to include <code>C:\workspace\depot_tools</code>.</p></div>
  828. </dd>
  829. <dt class="hdlist1">
  830. Without Administrator access:
  831. </dt>
  832. <dd>
  833. <p>
  834. <strong>Control Panel &#8594; User Accounts &#8594; User Accounts &#8594; Change my environment variables</strong>
  835. </p>
  836. <div class="paragraph"><p>Add a PATH user variable: <code>C:\workspace\depot_tools;%PATH%</code>.</p></div>
  837. </dd>
  838. </dl></div>
  839. <div class="paragraph"><p>From a <code>cmd.exe</code> shell, run the command <code>gclient</code> (without arguments). On first
  840. run, gclient will install all the Windows-specific bits needed to work with the
  841. code, including msysgit and python.</p></div>
  842. <div class="admonitionblock">
  843. <table><tr>
  844. <td class="icon">
  845. <div class="title">Note</div>
  846. </td>
  847. <td class="content">
  848. <div class="ulist"><ul>
  849. <li>
  850. <p>
  851. If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it
  852. may appear to run properly, but msysgit, python, and other tools may not get
  853. installed correctly.
  854. </p>
  855. </li>
  856. <li>
  857. <p>
  858. If you see strange errors with the file system on the first run of gclient,
  859. you may want to <a href="http://tortoisesvn.tigris.org/faq.html#cantmove2">disable
  860. Windows Indexing</a>.
  861. </p>
  862. </li>
  863. <li>
  864. <p>
  865. After running gclient open a command prompt and type <code>where python</code> and confirm that
  866. the depot_tools python.bat comes ahead of any copies of python.exe. Failing to ensure
  867. this can lead to overbuilding when using gn - see
  868. <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=611087">crbug.com/611087</a>.
  869. </p>
  870. </li>
  871. </ul></div>
  872. </td>
  873. </tr></table>
  874. </div>
  875. </div>
  876. </div>
  877. <div class="sect2">
  878. <h3 id="_bootstrapping_configuration">BOOTSTRAPPING CONFIGURATION</h3>
  879. <div class="paragraph"><p>If you have never used git before, you’ll need to set some global git
  880. configurations; substitute your name and email address in the following
  881. commands:</p></div>
  882. <div class="listingblock">
  883. <div class="content">
  884. <pre><code><strong><span class="white">$ git config --global user.name "John Doe"</span></strong>
  885. <strong><span class="white">$ git config --global user.email "jdoe@email.com"</span></strong>
  886. <strong><span class="white">$ git config --global core.autocrlf false</span></strong>
  887. <strong><span class="white">$ git config --global core.filemode false</span></strong>
  888. <strong><span class="white">$</span></strong> # and for fun!
  889. <strong><span class="white">$ git config --global color.ui true</span></strong></code></pre>
  890. </div></div>
  891. </div>
  892. </div>
  893. </div>
  894. <div class="sect1">
  895. <h2 id="_tl_dr">TL;DR</h2>
  896. <div class="sectionbody">
  897. <div class="listingblock">
  898. <div class="content">
  899. <pre><code><strong><span class="white">$</span></strong> # get the code
  900. <strong><span class="white">$</span></strong> # In an empty directory:
  901. <strong><span class="white">$ fetch {chromium,...}</span></strong>
  902. <strong><span class="white">$</span></strong> # Update third_party repos and run pre-compile hooks
  903. <strong><span class="white">$ gclient sync</span></strong>
  904. <strong><span class="white">$</span></strong> # Make a new change and upload it for review
  905. <strong><span class="white">$ git new-branch &lt;branch_name&gt;</span></strong>
  906. <strong><span class="white">$</span></strong> # repeat: [edit, git add, git commit]
  907. <strong><span class="white">$ git cl upload</span></strong>
  908. <strong><span class="white">$</span></strong> # After change is reviewed, commit with the CQ
  909. <strong><span class="white">$ git cl set_commit</span></strong>
  910. <strong><span class="white">$</span></strong> # Note that the committed hash which lands will /not/ match the
  911. <strong><span class="white">$</span></strong> # commit hashes of your local branch.</code></pre>
  912. </div></div>
  913. </div>
  914. </div>
  915. <div class="sect1">
  916. <h2 id="_getting_the_code">GETTING THE CODE</h2>
  917. <div class="sectionbody">
  918. <div class="paragraph"><p>Pick an empty directory and run one of the following:</p></div>
  919. <div class="listingblock">
  920. <div class="content">
  921. <pre><code><strong><span class="white">$ fetch chromium</span></strong> # Basic checkout for desktop Chromium
  922. <strong><span class="white">$ fetch android</span></strong> # Chromium checkout for Android platform
  923. <strong><span class="white">$ fetch ios</span></strong> # Chromium checkout for iOS platform</code></pre>
  924. </div></div>
  925. <div class="paragraph"><p>When the <code>fetch</code> tool completes you should have the following in your working
  926. directory:</p></div>
  927. <div class="listingblock">
  928. <div class="content">
  929. <pre><code><strong><span class="white">.gclient</span></strong> # A configuration file for you source checkout
  930. <strong><span class="white">src/</span></strong> # Top-level Chromium source checkout.</code></pre>
  931. </div></div>
  932. <div class="paragraph"><p>If you are on linux and fetching the code for the first time, then you&#8217;ll need
  933. to run:</p></div>
  934. <div class="listingblock">
  935. <div class="content">
  936. <pre><code><strong><span class="white">$ cd src &amp;&amp; ./build/install-build-deps.sh</span></strong></code></pre>
  937. </div></div>
  938. <div class="paragraph"><p>And finally:</p></div>
  939. <div class="listingblock">
  940. <div class="content">
  941. <pre><code><strong><span class="white">$ gclient sync</span></strong></code></pre>
  942. </div></div>
  943. <div class="paragraph"><p>This will pull all dependencies of the Chromium src checkout. You will need
  944. to run this any time you update the main src checkout, including when you
  945. switch branches.</p></div>
  946. </div>
  947. </div>
  948. <div class="sect1">
  949. <h2 id="_creating_uploading_a_cl">CREATING / UPLOADING A CL</h2>
  950. <div class="sectionbody">
  951. <div class="admonitionblock">
  952. <table><tr>
  953. <td class="icon">
  954. <div class="title">Note</div>
  955. </td>
  956. <td class="content">The remainder of the tutorial assumes that your current working directory
  957. is the <code>src/</code> folder mentioned in <a href="#_getting_the_code">Getting the code</a>.</td>
  958. </tr></table>
  959. </div>
  960. <div class="paragraph"><p>Each CL corresponds exactly with a single branch in git. Any time you want to
  961. begin a new CL:</p></div>
  962. <div class="listingblock">
  963. <div class="content">
  964. <pre><code><strong><span class="white">$ git new-branch &lt;branch_name&gt;</span></strong></code></pre>
  965. </div></div>
  966. <div class="paragraph"><p>This will create and checkout a new branch named <code>branch_name</code> which will track
  967. the default upstream branch (<code>origin/master</code>). See
  968. <a href="git-new-branch.html">git-new-branch(1)</a> for more features.</p></div>
  969. <div class="paragraph"><p>Commit as many changes as you like to this branch. When you want to upload it
  970. for review, run:</p></div>
  971. <div class="listingblock">
  972. <div class="content">
  973. <pre><code><strong><span class="white">$ git cl upload</span></strong></code></pre>
  974. </div></div>
  975. <div class="paragraph"><p>This will take the diff of your branch against its upstream branch (in that
  976. case origin/master), and will post it to the
  977. <a href="https://chromium-review.googlesource.com">Chromium code review site</a>.</p></div>
  978. </div>
  979. </div>
  980. <div class="sect1">
  981. <h2 id="_updating_the_code">UPDATING THE CODE</h2>
  982. <div class="sectionbody">
  983. <div class="paragraph"><p>Inevitably, you&#8217;ll want to pull in changes from the main Chromium repo. This is
  984. pretty easy with <em>depot_tools</em>:</p></div>
  985. <div class="listingblock">
  986. <div class="content">
  987. <pre><code><strong><span class="white">$ git rebase-update</span></strong></code></pre>
  988. </div></div>
  989. <div class="paragraph"><p>This command will update all of your CLs to contain the latest code from their
  990. upstreams. It will also automatically clean up CLs which have been committed and
  991. a couple other nice things. See <a href="git-rebase-update.html">git-rebase-update(1)</a> for the full
  992. scoop.</p></div>
  993. <div class="paragraph"><p>One thing to look out for are <em>merge conflicts</em>. These happen for exactly the
  994. same as they do with SVN, but the experience is a little more controllable with
  995. git. <code>git rebase-update</code> will try to rebase all your branches for you, but if it
  996. encounters a merge conflict in one, it will halt and leave you in a rebase
  997. conflict state (see <a href="git-rebase.html">git-rebase(1)</a>). Resolving <code>git rebase</code> merge
  998. conflicts is beyond the scope of this tutorial, but there are many good sources
  999. online (see the <a href="#_prerequisites">Prerequisites</a> for some).</p></div>
  1000. <div class="paragraph"><p>Sometimes you&#8217;re pretty certain that you&#8217;ve committed a certain branch, but <code>git
  1001. rebase-update</code> isn&#8217;t able to tell that for sure. This is usually because your
  1002. branch doesn&#8217;t rebase cleanly. You could just delete the branch with <code>git branch
  1003. -D &lt;branch&gt;</code>, but you&#8217;d like to double check the diff of your branch against its
  1004. upstream before deleting it. If this is the case you can abort the rebase
  1005. started by <code>git rebase-update</code>, and then run <a href="git-squash-branch.html">git-squash-branch(1)</a> to
  1006. flatten your branch into a single commit. When you run <code>git rebase-update</code>
  1007. again, you&#8217;ll get a (hopefully) much smaller / saner diff. If it turns out you
  1008. were wrong about your branch being fully committed, you can use
  1009. <a href="git-reflog.html">git-reflog(1)</a> to reset your branch back to where it was before. If the
  1010. diff looks inconsequential, you can use <code>git rebase --skip</code> to ignore it, and
  1011. then <code>git rebase-update</code> will clean it up for you.</p></div>
  1012. <div class="paragraph"><p>Once you&#8217;re done resolving all of the merge conflict, just run <code>git
  1013. rebase-update</code>, and it will pick up where it left off. Once the command has
  1014. finished updating all of your branches, it will return you back to the branch
  1015. you started on.</p></div>
  1016. <div class="admonitionblock">
  1017. <table><tr>
  1018. <td class="icon">
  1019. <div class="title">Note</div>
  1020. </td>
  1021. <td class="content">
  1022. <div class="ulist"><ul>
  1023. <li>
  1024. <p>
  1025. Running <code>git rebase-update</code> will update all your branches, but it will not
  1026. automatically run <code>gclient sync</code> to update your dependencies.
  1027. </p>
  1028. </li>
  1029. <li>
  1030. <p>
  1031. Use caution when running <code>git reset</code> on branches managed by <code>depot_tools</code>.
  1032. These tools track the set of "commits contained in the branch" from a branch&#8217;s "merge point"
  1033. to the current branch value. See <code>git help mark-merge-base</code> for more discussion of the merge base.
  1034. </p>
  1035. </li>
  1036. </ul></div>
  1037. </tr></table>
  1038. </div>
  1039. </div>
  1040. </div>
  1041. <div class="sect1">
  1042. <h2 id="_managing_multiple_cls">MANAGING MULTIPLE CLS</h2>
  1043. <div class="sectionbody">
  1044. <div class="paragraph"><p>Sometimes you want to work on more than one CL at once (say, you have a CL
  1045. posted for review and want to work on something else). For each CL that you
  1046. want to work on, just use <code>git new-branch &lt;branch_name&gt;</code>.</p></div>
  1047. <div class="paragraph"><p>Once you start to have more than one CL at a time, it can be easy to lose your
  1048. bearings. Fortunately, <em>depot_tools</em> has two tools to help you out:</p></div>
  1049. <div class="listingblock">
  1050. <div class="content">
  1051. <pre><code><strong><span class="white">$ git map</span></strong>
  1052. <span class="white blue-background">*</span>&#8203;<strong><span class="blue-background red"> 7dcfe47 </span></strong> <span class="green">(</span>&#8203;<strong><span class="aqua">frozen_changes</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-12</span> ~ FREEZE.unindexed
  1053. * <strong><span class="red">4b0c180</span></strong> <span class="yellow">2014-03-12</span> ~ modfile
  1054. * <strong><span class="red">59a7cca</span></strong> <span class="yellow">2014-03-12</span> ~ a deleted file
  1055. * <strong><span class="red">6bec695</span></strong> <span class="green">(</span>&#8203;<span class="red">origin/master</span>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ Add neat feature <strong><span class="white">&lt;(frozen_changes)</span></strong>
  1056. * <strong><span class="red">d15a38a</span></strong> <span class="yellow">2014-03-11</span> ~ Epic README update
  1057. * <strong><span class="red">d559894</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">master</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ Important upstream change
  1058. <span class="red">|</span> * <strong><span class="red">9c311fd</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">cool_feature</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ Respond to CL comments
  1059. <span class="red">|</span> <span class="green">|</span> * <strong><span class="red">2a1eeb2</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">subfeature</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ integrate with CoolService
  1060. <span class="red">|</span> <span class="green">|</span> * <strong><span class="red">d777af6</span></strong> <span class="yellow">2014-03-11</span> ~ slick commenting action
  1061. <span class="red">|</span> <span class="green">|/</span>
  1062. <span class="red">|</span> * <strong><span class="red">265803a</span></strong> <span class="yellow">2014-03-11</span> ~ another improvement <strong><span class="white">&lt;(subfeature)</span></strong>
  1063. <span class="red">|</span> * <strong><span class="red">6d831ac</span></strong> <span class="green">(</span>&#8203;<strong><span class="fuchsia">spleen_tag</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ Refactor spleen
  1064. <span class="red">|</span> * <strong><span class="red">82e74ab</span></strong> <span class="yellow">2014-03-11</span> ~ Add widget
  1065. <span class="red">|/</span>
  1066. * <strong><span class="red">d08c5b3</span></strong> <span class="green">(</span>&#8203;<strong><span class="lime">bogus_noparent</span></strong>&#8203;<span class="green">)</span> <span class="yellow">2014-03-11</span> ~ Wonderful beginnings <strong><span class="white">&lt;(cool_feature)</span></strong></code></pre>
  1067. </div></div>
  1068. <div class="paragraph"><p>Note that this example repo is in dire need of a <a href="git-rebase-update.html">git-rebase-update(1)</a>!</p></div>
  1069. <div class="listingblock">
  1070. <div class="content">
  1071. <pre><code><strong><span class="white">$ git map-branches</span></strong>
  1072. <span class="red">origin/master</span>
  1073. <span class="green">cool_feature</span>
  1074. <span class="green">subfeature</span>
  1075. <span class="aqua">frozen_changes *</span>
  1076. <span class="green">master</span></code></pre>
  1077. </div></div>
  1078. <div class="dlist"><dl>
  1079. <dt class="hdlist1">
  1080. <a href="git-map.html">git-map(1)</a>
  1081. </dt>
  1082. <dd>
  1083. <p>
  1084. This tool shows you the history of all of your branches in a pseudo-graphical
  1085. format. In particular, it will show you which commits all of your branches
  1086. are on, which commit you currently have checked out, and more. Check out the
  1087. doc for the full details.
  1088. </p>
  1089. </dd>
  1090. <dt class="hdlist1">
  1091. <a href="git-map-branches.html">git-map-branches(1)</a>
  1092. </dt>
  1093. <dd>
  1094. <p>
  1095. This tool just shows you which branches you have in your repo, and their
  1096. upstream relationship to each other (as well as which branch you have checked
  1097. out at the moment).
  1098. </p>
  1099. </dd>
  1100. </dl></div>
  1101. <div class="paragraph"><p>Additionally, sometimes you need to switch between branches, but you&#8217;ve got work
  1102. in progress. You could use <a href="git-stash.html">git-stash(1)</a>, but that can be tricky to
  1103. manage because you need to remember which branches you stashed what changes on.
  1104. Helpfully <em>depot_tools</em> includes two tools which can greatly assist in case:</p></div>
  1105. <div class="paragraph"><p><a href="git-freeze.html">git-freeze(1)</a> allows you to put the current branch in 'suspended
  1106. animation' by committing your changes to a specially-named commit on the top of
  1107. your current branch. When you come back to your branch later, you can just run
  1108. <a href="git-thaw.html">git-thaw(1)</a> to get your work-in-progress changes back to what they were.</p></div>
  1109. <div class="paragraph"><p>Another useful tool is <a href="git-rename-branch.html">git-rename-branch(1)</a>. Unlike <code>git branch -m &lt;old&gt;
  1110. &lt;new&gt;</code>, this tool will correctly preserve the upstream relationships of your
  1111. branch compared to its downstreams.</p></div>
  1112. <div class="paragraph"><p>Finally, take a look at <a href="git-upstream-diff.html">git-upstream-diff(1)</a>. This will show you the
  1113. combined diff for all the commits on your branch against the upstream tracking
  1114. branch. This is <em>exactly</em> what <code>git cl upload</code> will push up to code review.
  1115. Additionally, consider trying the <code>--wordwise</code> argument to get a colorized
  1116. per-word diff (instead of a per-line diff).</p></div>
  1117. </div>
  1118. </div>
  1119. <div class="sect1">
  1120. <h2 id="_managing_dependent_cls">MANAGING DEPENDENT CLS</h2>
  1121. <div class="sectionbody">
  1122. <div class="paragraph"><p>Now that you know how to manage <em>independent</em> CLs, we&#8217;ll see how to manage
  1123. <em>dependent</em> CLs. Dependent CLs are useful when your second (or third or fourth
  1124. or &#8230;) CL depends on the changes in one of your other CLs (such as: CL 2 won&#8217;t
  1125. compile without CL 1, but you want to submit them as two separate reviews).</p></div>
  1126. <div class="paragraph"><p>Like all of the other CLs we&#8217;ve created, we use <a href="git-new-branch.html">git-new-branch(1)</a>, but
  1127. this time with an extra argument. First, <code>git checkout</code> the branch
  1128. you want to base the new one on (i.e. CL 1), and then run:</p></div>
  1129. <div class="listingblock">
  1130. <div class="content">
  1131. <pre><code><strong><span class="white">$ git new-branch --upstream_current &lt;branch_name&gt;</span></strong></code></pre>
  1132. </div></div>
  1133. <div class="paragraph"><p>This will make a new branch which tracks the <em>current</em> branch as its upstream
  1134. (as opposed to <em>origin/master</em>). All changes you commit to this branch will be
  1135. in addition to the previous branch, but when you <code>git cl upload</code>, you will only
  1136. upload the diff for the dependent (child) branch. You may have as many branches
  1137. nested in this fashion as you like.</p></div>
  1138. <div class="paragraph"><p><a href="git-map.html">git-map(1)</a> and <a href="git-map-branches.html">git-map-branches(1)</a> are particularly helpful when
  1139. you have dependent branches. In addition, there are two helper commands which
  1140. let you traverse your working copy up and down this tree of branches:
  1141. <a href="git-nav-upstream.html">git-nav-upstream(1)</a> and <a href="git-nav-downstream.html">git-nav-downstream(1)</a>.</p></div>
  1142. <div class="paragraph"><p>Sometimes when dealing with dependent CLs, it turns out that you accidentally
  1143. based a branch on the wrong upstream, but since then you&#8217;ve committed changes to
  1144. it, or even based <em>another</em> branch off of that one. Or you discover that you
  1145. have two independent CLs that would actually be much better off as dependent
  1146. CLs. In instances like these, you can check out the offending branch and use
  1147. <a href="git-reparent-branch.html">git-reparent-branch(1)</a> to move it to track a different parent. Note that
  1148. this can also be used to move a branch from tracking <code>origin/master</code> to <code>lkgr</code>
  1149. or vice versa.</p></div>
  1150. </div>
  1151. </div>
  1152. <div class="sect1">
  1153. <h2 id="_example_walkthrough">EXAMPLE WALKTHROUGH</h2>
  1154. <div class="sectionbody">
  1155. <div class="paragraph"><p>This section will demo what a typical workflow looks like when writing,
  1156. updating, and committing multiple CLs.</p></div>
  1157. <div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ fetch chromium</span>
  1158. ... truncated output ...
  1159. <span style="font-weight: bold; color: #ffffff">$ cd src</span>
  1160. </code></pre></div></div><p><div class="paragraph"> (only on linux)</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ ./build/install-build-deps.sh</span>
  1161. ... truncated output ...
  1162. </code></pre></div></div><p><div class="paragraph"> Pull in all dependencies for HEAD</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ gclient sync</span>
  1163. ... truncated output ...
  1164. </code></pre></div></div><p><div class="paragraph"> Let's fix something!</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git new-branch fix_typo</span>
  1165. <span style="font-weight: bold; color: #ffffff">$ echo -e '/Banana\ns/Banana/Kuun\nwq' | ed build/whitespace_file.txt</span>
  1166. 1503
  1167. It was a Domo-Banana.
  1168. It was a Domo-Kuun.
  1169. 1501
  1170. <span style="font-weight: bold; color: #ffffff">$ git commit -am 'Fix terrible typo.'</span>
  1171. [fix_typo 615ffa7] Fix terrible typo.
  1172. 1 file changed, 1 insertion(+), 1 deletion(-)
  1173. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1174. * <span style="font-weight: bold; color: #e42e16">615ffa7 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; fix_typo</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1175. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1176. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1177. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1178. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1179. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1180. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1181. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1182. <span style="font-weight: bold; color: #ffffff">$ git status</span>
  1183. On branch fix_typo
  1184. Your branch is ahead of 'origin/master' by 1 commit.
  1185. (use "git push" to publish your local commits)
  1186. nothing to commit, working tree clean
  1187. <span style="font-weight: bold; color: #ffffff">$ git cl upload -r domo@chromium.org --send-mail</span>
  1188. ... truncated output ...
  1189. </code></pre></div></div><p><div class="paragraph"> While we wait for feedback, let's do something else.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git new-branch chap2</span>
  1190. <span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
  1191. <span style="color: #e42e16"></span><span style="font-weight: bold; color: #e42e16">origin/master
  1192. </span><span style="font-weight: bold; color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> chap2 *
  1193. </span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> fix_typo
  1194. </span><span style="font-weight: bold; color: #ffffff">$ cat &gt;&gt; build/whitespace_file.txt &lt;&lt;EOF</span>
  1195. "You recall what happened on Mulholland drive?" The ceiling fan rotated slowly
  1196. overhead, barely disturbing the thick cigarette smoke. No doubt was left about
  1197. when the fan was last cleaned.
  1198. EOF
  1199. <span style="font-weight: bold; color: #ffffff">$ git status</span>
  1200. On branch chap2
  1201. Your branch is up to date with 'origin/master'.
  1202. Changes not staged for commit:
  1203. (use "git add &lt;file&gt;..." to update what will be committed)
  1204. (use "git restore &lt;file&gt;..." to discard changes in working directory)
  1205. <span style="color: #e42e16">modified: build/whitespace_file.txt</span>
  1206. no changes added to commit (use "git add" and/or "git commit -a")
  1207. </code></pre></div></div><p><div class="paragraph"> Someone on the code review pointed out that our typo-fix has a typo :( We're still working on 'chap2' but we really want to land 'fix_typo', so let's switch over and fix it.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git freeze</span>
  1208. <span style="font-weight: bold; color: #ffffff">$ git checkout fix_typo</span>
  1209. Switched to branch 'fix_typo'
  1210. Your branch is ahead of 'origin/master' by 1 commit.
  1211. (use "git push" to publish your local commits)
  1212. <span style="font-weight: bold; color: #ffffff">$ echo -e '/Kuun\ns/Kuun/Kun\nwq' | ed build/whitespace_file.txt</span>
  1213. 1501
  1214. It was a Domo-Kuun.
  1215. It was a Domo-Kun.
  1216. 1500
  1217. <span style="font-weight: bold; color: #ffffff">$ git upstream-diff --wordwise</span>
  1218. <span style="font-weight: bold">diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt</span>
  1219. <span style="font-weight: bold">index 3eba355..57cdcee 100644</span>
  1220. <span style="font-weight: bold">--- a/build/whitespace_file.txt</span>
  1221. <span style="font-weight: bold">+++ b/build/whitespace_file.txt</span>
  1222. <span style="color: #33d6e5">@@ -17,7 +17,7 @@</span> swept up the streets (for it is in London that our scene lies), rattling along
  1223. the housetops, and fiercely agitating the scanty flame of the lamps that
  1224. struggled against the elements. A hooded figure emerged.
  1225. It was a Domo-<span style="color: #e42e16">Banana</span><span style="color: #19c518">Kun</span>.
  1226. "What took you so long?", inquired his wife.
  1227. <span style="font-weight: bold; color: #ffffff">$ git commit -am 'Fix typo for good!'</span>
  1228. [fix_typo 2c0ad9c] Fix typo for good!
  1229. 1 file changed, 1 insertion(+), 1 deletion(-)
  1230. <span style="font-weight: bold; color: #ffffff">$ git cl upload</span>
  1231. ... truncated output ...
  1232. </code></pre></div></div><p><div class="paragraph"> Since we got lgtm, let the CQ land it.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git cl set_commit</span>
  1233. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1234. * <span style="font-weight: bold; color: #e42e16">0e2e52e </span><span style="color: #19c518"> (</span><span style="color: #19c518"></span><span style="font-weight: bold; color: #19c518">chap2</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ FREEZE.unindexed
  1235. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">2c0ad9c </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; fix_typo</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix typo for good!
  1236. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">615ffa7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1237. <span style="color: #e42e16">|</span><span style="color: #e42e16">/</span>
  1238. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap2, fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1239. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1240. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1241. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1242. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1243. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1244. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1245. </code></pre></div></div><p><div class="paragraph"> Switch back to where we were using the nav* commands (for fun... git checkout would work here too)</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
  1246. <span style="color: #e42e16"></span><span style="color: #e42e16">origin/master
  1247. </span><span style="color: #19c518"></span><span style="color: #19c518"> chap2
  1248. </span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> fix_typo *
  1249. </span><span style="font-weight: bold; color: #ffffff">$ git nav-upstream</span>
  1250. Note: switching to 'origin/master'.
  1251. You are in 'detached HEAD' state. You can look around, make experimental
  1252. changes and commit them, and you can discard any commits you make in this
  1253. state without impacting any branches by switching back to a branch.
  1254. If you want to create a new branch to retain commits you create, you may
  1255. do so (now or later) by using -c with the switch command. Example:
  1256. git switch -c &lt;new-branch-name&gt;
  1257. Or undo this operation with:
  1258. git switch -
  1259. Turn off this advice by setting config variable advice.detachedHead to false
  1260. HEAD is now at beec6f4 Make ReflectorImpl use mailboxes
  1261. <span style="font-weight: bold; color: #ffffff">$ git nav-downstream</span>
  1262. Previous HEAD position was beec6f4 Make ReflectorImpl use mailboxes
  1263. Switched to branch 'chap2'
  1264. Your branch is ahead of 'origin/master' by 1 commit.
  1265. (use "git push" to publish your local commits)
  1266. Please select a downstream branch
  1267. 0. chap2
  1268. 1. fix_typo
  1269. Selection (0-1)[0]: 0
  1270. <span style="font-weight: bold; color: #ffffff">$ git map-branches</span>
  1271. <span style="color: #e42e16"></span><span style="color: #e42e16">origin/master
  1272. </span><span style="color: #33d6e5"></span><span style="font-weight: bold; color: #33d6e5"> chap2 *
  1273. </span><span style="font-weight: bold; color: #19c518"></span><span style="color: #19c518"> fix_typo
  1274. </code></pre></div></div><p><div class="paragraph"> Now we can pick up on chapter2 where we left off.</p></div><div class="listingblock"><div class="content"><pre><code></span><span style="font-weight: bold; color: #ffffff">$ git thaw</span>
  1275. <span style="font-weight: bold; color: #ffffff">$ git diff</span>
  1276. <span style="font-weight: bold">diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt</span>
  1277. <span style="font-weight: bold">index 3eba355..9d08d9d 100644</span>
  1278. <span style="font-weight: bold">--- a/build/whitespace_file.txt</span>
  1279. <span style="font-weight: bold">+++ b/build/whitespace_file.txt</span>
  1280. <span style="color: #33d6e5">@@ -34,3 +34,7 @@</span> with his fork, watching the runny jelly spread and pool across his plate,
  1281. like the blood of a dying fawn. \"It reminds me of that time --\" he started, as
  1282. his wife cut in quickly: \"-- please. I can't bear to hear it.\". A flury of
  1283. images coming from the past flowed through his mind.
  1284. <span style="color: #19c518">+</span>
  1285. <span style="color: #19c518">+</span><span style="color: #19c518">"You recall what happened on Mulholland drive?" The ceiling fan rotated slowly</span>
  1286. <span style="color: #19c518">+</span><span style="color: #19c518">overhead, barely disturbing the thick cigarette smoke. No doubt was left about</span>
  1287. <span style="color: #19c518">+</span><span style="color: #19c518">when the fan was last cleaned.</span>
  1288. <span style="font-weight: bold; color: #ffffff">$ cat &gt;&gt; build/whitespace_file.txt &lt;&lt;EOF</span>
  1289. There was an poignant pause.
  1290. EOF
  1291. <span style="font-weight: bold; color: #ffffff">$ git diff</span>
  1292. <span style="font-weight: bold">diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt</span>
  1293. <span style="font-weight: bold">index 3eba355..e3a55de 100644</span>
  1294. <span style="font-weight: bold">--- a/build/whitespace_file.txt</span>
  1295. <span style="font-weight: bold">+++ b/build/whitespace_file.txt</span>
  1296. <span style="color: #33d6e5">@@ -34,3 +34,9 @@</span> with his fork, watching the runny jelly spread and pool across his plate,
  1297. like the blood of a dying fawn. \"It reminds me of that time --\" he started, as
  1298. his wife cut in quickly: \"-- please. I can't bear to hear it.\". A flury of
  1299. images coming from the past flowed through his mind.
  1300. <span style="color: #19c518">+</span>
  1301. <span style="color: #19c518">+</span><span style="color: #19c518">"You recall what happened on Mulholland drive?" The ceiling fan rotated slowly</span>
  1302. <span style="color: #19c518">+</span><span style="color: #19c518">overhead, barely disturbing the thick cigarette smoke. No doubt was left about</span>
  1303. <span style="color: #19c518">+</span><span style="color: #19c518">when the fan was last cleaned.</span>
  1304. <span style="color: #19c518">+</span>
  1305. <span style="color: #19c518">+</span><span style="color: #19c518">There was an poignant pause.</span>
  1306. <span style="font-weight: bold; color: #ffffff">$ git commit -am 'Finish chapter 2'</span>
  1307. [chap2 ceef712] Finish chapter 2
  1308. 1 file changed, 6 insertions(+)
  1309. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1310. * <span style="font-weight: bold; color: #e42e16">ceef712 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; chap2</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Finish chapter 2
  1311. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">2c0ad9c </span><span style="color: #19c518"> (</span><span style="color: #19c518"></span><span style="font-weight: bold; color: #19c518">fix_typo</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix typo for good!
  1312. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">615ffa7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1313. <span style="color: #e42e16">|</span><span style="color: #e42e16">/</span>
  1314. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap2, fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1315. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1316. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1317. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1318. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1319. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1320. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1321. <span style="font-weight: bold; color: #ffffff">$ git cl upload -r domo@chromium.org --send-mail</span>
  1322. ... truncated output ...
  1323. </code></pre></div></div><p><div class="paragraph"> We poke a committer until they lgtm :)</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git cl set_commit</span>
  1324. </code></pre></div></div><p><div class="paragraph"> While that runs through the CQ, let's get started on chapter 3. Since we know that chapter 3 depends on chapter 2, we'll track the current chapter2 branch.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git new-branch --upstream_current chap3</span>
  1325. <span style="font-weight: bold; color: #ffffff">$ cat &gt;&gt; build/whitespace_file.txt &lt;&lt;EOF</span>
  1326. CHAPTER 3:
  1327. Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he
  1328. began feeling sick.
  1329. EOF
  1330. <span style="font-weight: bold; color: #ffffff">$ git commit -am 'beginning of chapter 3'</span>
  1331. [chap3 7d4238a] beginning of chapter 3
  1332. 1 file changed, 4 insertions(+)
  1333. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1334. * <span style="font-weight: bold; color: #e42e16">7d4238a </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; chap3</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ beginning of chapter 3
  1335. * <span style="font-weight: bold; color: #e42e16">ceef712 </span><span style="color: #19c518"> (</span><span style="color: #19c518"></span><span style="font-weight: bold; color: #19c518">chap2</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Finish chapter 2<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap3)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1336. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">2c0ad9c </span><span style="color: #19c518"> (</span><span style="color: #19c518"></span><span style="font-weight: bold; color: #19c518">fix_typo</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Fix typo for good!
  1337. <span style="color: #e42e16">|</span> * <span style="font-weight: bold; color: #e42e16">615ffa7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1338. <span style="color: #e42e16">|</span><span style="color: #e42e16">/</span>
  1339. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap2, fix_typo)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1340. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1341. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1342. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1343. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1344. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1345. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1346. </code></pre></div></div><p><div class="paragraph"> We haven't updated the code in a while, so let's do that now.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git rebase-update</span>
  1347. Fetching origin
  1348. From https://upstream
  1349. beec6f4..59cdb73 master -&gt; origin/master
  1350. Rebasing: chap2
  1351. Rebasing: fix_typo
  1352. Failed! Attempting to squash fix_typo ... Success!
  1353. Rebasing: chap3
  1354. Reparented chap3 to track origin/master (was tracking chap2)
  1355. Deleted branch fix_typo (was 5d26fec).
  1356. Deleted branch chap2 (was 5d26fec).
  1357. </code></pre></div></div><p><div class="paragraph"> Well look at that. The CQ landed our typo and chapter2 branches already and git rebase-update cleaned them up for us.</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ gclient sync</span>
  1358. ... truncated output ...
  1359. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1360. * <span style="font-weight: bold; color: #e42e16">93fe917 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; chap3</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ beginning of chapter 3
  1361. * <span style="font-weight: bold; color: #e42e16">5d26fec </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Finish chapter 2<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap3)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1362. * <span style="font-weight: bold; color: #e42e16">df7fefb </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Revert 255617, due to it not tracking use of the link doctor page properly.
  1363. * <span style="font-weight: bold; color: #e42e16">4b39cda </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1364. * <span style="font-weight: bold; color: #e42e16">248c5b6 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Temporarily CHECK(trial) in ChromeRenderProcessObserver::OnSetFieldTrialGroup.
  1365. * <span style="font-weight: bold; color: #e42e16">8171df8 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Remove AMD family check for the flapper crypto accelerator.
  1366. * <span style="font-weight: bold; color: #e42e16">d6a30d2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Change the Pica load benchmark to listen for the polymer-ready event
  1367. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes
  1368. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1369. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1370. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1371. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1372. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1373. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1374. </code></pre></div></div><p><div class="paragraph"> Someone on IRC mentions that they actually landed a chapter 3 already! We should pull their changes before continuing. Brace for a code conflict!</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git rebase-update</span>
  1375. Fetching origin
  1376. From https://upstream
  1377. 5d26fec..59cdb73 master -&gt; origin/master
  1378. Rebasing: chap2
  1379. ... lots of output, it's a conflict alright :(...
  1380. <span style="font-weight: bold; color: #ffffff">$ git diff</span>
  1381. <span style="font-weight: bold">diff --cc build/whitespace_file.txt</span>
  1382. <span style="font-weight: bold">index 1293282,f903ea2..0000000</span>
  1383. <span style="font-weight: bold">--- a/build/whitespace_file.txt</span>
  1384. <span style="font-weight: bold">+++ b/build/whitespace_file.txt</span>
  1385. <span style="color: #33d6e5">@@@ -42,4 -42,5 +42,9 @@@</span> when the fan was last cleaned
  1386. There was an poignant pause.
  1387. CHAPTER 3:
  1388. <span style="color: #19c518">++&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD</span>
  1389. <span style="color: #19c518"> +Hilariousness! This chapter is awesome!</span>
  1390. <span style="color: #19c518">++=======</span>
  1391. <span style="color: #19c518">+ Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he</span>
  1392. <span style="color: #19c518">+ began feeling sick.</span>
  1393. <span style="color: #19c518">++&gt;&gt;&gt;&gt;&gt;&gt;&gt; beginning of chapter 3</span>
  1394. </code></pre></div></div><p><div class="paragraph"> Oh, well, that's not too bad. In fact... that's a terrible chapter 3!</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ $EDITOR build/whitespace_file.txt</span>
  1395. ... /me deletes bad chapter 3 ...
  1396. <span style="font-weight: bold; color: #ffffff">$ git add build/whitespace_file.txt</span>
  1397. <span style="font-weight: bold; color: #ffffff">$ git diff --cached</span>
  1398. <span style="font-weight: bold">diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt</span>
  1399. <span style="font-weight: bold">index 1293282..f903ea2 100644</span>
  1400. <span style="font-weight: bold">--- a/build/whitespace_file.txt</span>
  1401. <span style="font-weight: bold">+++ b/build/whitespace_file.txt</span>
  1402. <span style="color: #33d6e5">@@ -42,4 +42,5 @@</span> when the fan was last cleaned.
  1403. There was an poignant pause.
  1404. CHAPTER 3:
  1405. <span style="color: #e42e16">-Hilariousness! This chapter is awesome!</span>
  1406. <span style="color: #19c518">+</span><span style="color: #19c518">Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he</span>
  1407. <span style="color: #19c518">+</span><span style="color: #19c518">began feeling sick.</span>
  1408. </code></pre></div></div><p><div class="paragraph"> Much better</p></div><div class="listingblock"><div class="content"><pre><code><span style="font-weight: bold; color: #ffffff">$ git rebase --continue</span>
  1409. Applying: beginning of chapter 3
  1410. <span style="font-weight: bold; color: #ffffff">$ git rebase-update</span>
  1411. Fetching origin
  1412. chap3 up-to-date
  1413. <span style="font-weight: bold; color: #ffffff">$ gclient sync</span>
  1414. ... truncated output ...
  1415. <span style="font-weight: bold; color: #ffffff">$ git map</span>
  1416. * <span style="font-weight: bold; color: #e42e16">1cb4f5b </span><span style="color: #19c518"> (</span><span style="color: #e42e16">HEAD -&gt; chap3</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ beginning of chapter 3
  1417. * <span style="font-weight: bold; color: #e42e16">59cdb73 </span><span style="color: #19c518"> (</span><span style="color: #e42e16">origin/master</span><span style="color: #19c518">, </span><span style="color: #e42e16">origin/HEAD</span><span style="color: #19c518">) </span><span style="color: #e7e71c">2014-04-10</span> ~ Refactor data interchange format.<span style="font-weight: bold"></span><span style="font-weight: bold; color: #ffffff"> &lt;(chap3)</span><span style="font-weight: bold"></span><span style="font-weight: bold"></span>
  1418. * <span style="font-weight: bold; color: #e42e16">34676a3 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Ensure FS is exited for all not-in-same-page navigations.
  1419. * <span style="font-weight: bold; color: #e42e16">7d4784e </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Add best chapter2 ever!
  1420. * <span style="font-weight: bold; color: #e42e16">5d26fec </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Finish chapter 2
  1421. * <span style="font-weight: bold; color: #e42e16">df7fefb </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Revert 255617, due to it not tracking use of the link doctor page properly.
  1422. * <span style="font-weight: bold; color: #e42e16">4b39cda </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Fix terrible typo.
  1423. * <span style="font-weight: bold; color: #e42e16">248c5b6 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Temporarily CHECK(trial) in ChromeRenderProcessObserver::OnSetFieldTrialGroup.
  1424. * <span style="font-weight: bold; color: #e42e16">8171df8 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Remove AMD family check for the flapper crypto accelerator.
  1425. * <span style="font-weight: bold; color: #e42e16">d6a30d2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Change the Pica load benchmark to listen for the polymer-ready event
  1426. * <span style="font-weight: bold; color: #e42e16">beec6f4 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Make ReflectorImpl use mailboxes
  1427. * <span style="font-weight: bold; color: #e42e16">41290e0 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ don't use glibc-specific execinfo.h on uclibc builds
  1428. * <span style="font-weight: bold; color: #e42e16">a76fde7 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ [fsp] Add requestUnmount() method together with the request manager.
  1429. * <span style="font-weight: bold; color: #e42e16">9de7a71 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ linux_aura: Use system configuration for middle clicking the titlebar.
  1430. * <span style="font-weight: bold; color: #e42e16">073b0c2 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ContentView-&gt;ContentViewCore in ContentViewRenderView
  1431. * <span style="font-weight: bold; color: #e42e16">2250f53 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ ozone: evdev: Filter devices by path
  1432. * <span style="font-weight: bold; color: #e42e16">33a7a74 </span><span style="color: #19c518"></span> <span style="color: #e7e71c">2014-04-10</span> ~ Always output seccomp error messages to stderr
  1433. <span style="font-weight: bold; color: #ffffff">$ git cl upload</span>
  1434. ... truncated output ...
  1435. </code></pre></div></div><p><div class="paragraph"></p></div>
  1436. <div class="paragraph"><p>So there you have the basic flow. Note that you don&#8217;t <em>have</em> to do chromium
  1437. development using these tools. Any git workflow is compatible, as long as
  1438. <code>git cl upload</code> is able to upload good patches.</p></div>
  1439. </div>
  1440. </div>
  1441. <div class="sect1">
  1442. <h2 id="_conclusion">CONCLUSION</h2>
  1443. <div class="sectionbody">
  1444. <div class="paragraph"><p>Hopefully that gives you a good starting overview on Chromium development using
  1445. <em>depot_tools</em>. If you have questions which weren&#8217;t answered by this tutorial or
  1446. the man pages for the tools (see the index of all tools here:
  1447. <a href="depot_tools.html">depot_tools(7)</a>), please feel free to ask.</p></div>
  1448. </div>
  1449. </div>
  1450. <div class="sect1">
  1451. <h2 id="_glossary">GLOSSARY</h2>
  1452. <div class="sectionbody">
  1453. <div class="dlist"><dl>
  1454. <dt class="hdlist1">
  1455. CL
  1456. </dt>
  1457. <dd>
  1458. <p>
  1459. A <em>change-list</em>. This is a diff which you would like to commit to the
  1460. codebase.
  1461. </p>
  1462. </dd>
  1463. <dt class="hdlist1">
  1464. DEPS
  1465. </dt>
  1466. <dd>
  1467. <p>
  1468. A file in the chromium checkout which <code>gclient sync</code> uses to determine what
  1469. dependencies to pull in. This file also contains <em>hooks</em>.
  1470. </p>
  1471. </dd>
  1472. <dt class="hdlist1">
  1473. LKGR
  1474. </dt>
  1475. <dd>
  1476. <p>
  1477. Last Known Good Revision. This is a <a href="git-tag.html">git-tag(1)</a> which tracks the last
  1478. version of <code>origin/master</code> which has passed the full set of testing on the
  1479. <a href="http://build.chromium.org">main Chromium waterfall</a>.
  1480. </p>
  1481. </dd>
  1482. </dl></div>
  1483. </div>
  1484. </div>
  1485. <div class="sect1">
  1486. <h2 id="_chromium_depot_tools">CHROMIUM DEPOT_TOOLS</h2>
  1487. <div class="sectionbody">
  1488. <div class="paragraph"><p>Part of the chromium <a href="depot_tools.html">depot_tools(7)</a> suite. These tools are meant to
  1489. assist with the development of chromium and related projects. Download the tools
  1490. by checking out the <a href="https://chromium.googlesource.com/chromium/tools/depot_tools.git">git repository</a>.</p></div>
  1491. </div>
  1492. </div>
  1493. </div>
  1494. <div id="footnotes"><hr /></div>
  1495. <div id="footer">
  1496. <div id="footer-text">
  1497. Last updated 2020-08-10 17:51:13 CEST
  1498. </div>
  1499. </div>
  1500. </body>
  1501. </html>