Data Programming Course  Check-in [c44938df78]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:terminata la parte di lezione su fossil
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c44938df78c082c5a11ef30468be3ee6cc87aa72
User & Date: EnricoGiampieri 2017-02-27 23:09:07.373
References
2017-02-27
23:11
amendment a [c44938df78], avevo dimenticato gli html check-in: ea0e3a680c user: EnricoGiampieri tags: trunk
Context
2017-02-27
23:11
amendment a [c44938df78], avevo dimenticato gli html check-in: ea0e3a680c user: EnricoGiampieri tags: trunk
23:09
terminata la parte di lezione su fossil check-in: c44938df78 user: EnricoGiampieri tags: trunk
21:15
aggiunta la versione preliminare del tutorial su fossil check-in: f6ddb73b2e user: EnricoGiampieri tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Lezione 1 - controllo di versione.ipynb.
145
146
147
148
149
150
151



















































152
153
154
155
156
157
158
159


160
161
162
163
164
165
166
   "source": [
    "## Controllo di versione distribuito e Code Source Management"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {



















































    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Introduzione a Fossil\n",
    "\n",
    "si può scaricare dal suo sito web: [Fossil-SCM](https://www.fossil-scm.org/xfer/uv/download.html)"


   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







|
>
>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
   "source": [
    "## Controllo di versione distribuito e Code Source Management"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "Avete mai avuto diverse copie di un file, chiamate doc_v1, doc_v2 e così via?\n",
    "\n",
    "Bene, quello è un controllo di versione manuale.\n",
    "Grazie al computer possiamo fare di meglio."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "Possiamo tenere traccia di tutto quello che succede, tornare indietro ad un momento qualsiasi, vedere le differenze fra due versioni successive ed anche tenere \"universi paralleli\" di versioni alternative.\n",
    "\n",
    "I programmi che permettono di farlo sono i Sistemi di Controllo di Versione."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "Questi sono poi affiancati da sistemi di Management del Codice Sorgente, che oltre a tenere traccia della versione permettono anche di tracciare i bug e la documentazione.\n",
    "\n",
    "**Fossil** è una semplice soluzione integrata che vi fornisce tutto questo in un unico pacchetto."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "È già estremamente utile per lavorare da soli, e permette di usare lo stesso strumento per collaborare, coordinando il lavoro di varie persone che lavorano allo stesso progetto, online ed offline."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Introduzione a Fossil\n",
    "\n",
    "si può scaricare dal suo sito web: [Fossil-SCM](https://www.fossil-scm.org/xfer/uv/download.html).\n",
    "\n",
    "È un programma free ed open source, cross-platform e contenuto in un unico file, quindi è molto facile da spostare in giro."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false,
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
511
512
513
514
515
516
517















518
519
520
521
522
523
524
   },
   "source": [
    "### file list\n",
    "\n",
    "![file list](./immagini/interfaccia_fossil_2.png)"
   ]
  },















  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
   },
   "source": [
    "### file list\n",
    "\n",
    "![file list](./immagini/interfaccia_fossil_2.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "Potete creare file di documentazione stile wiki, sempre contenuti nel repository!\n",
    "\n",
    "potete inoltre usare file del repository per la documentazione, basta usare gli indirizzi relativi all'indirizzo speciale \n",
    "\n",
    "    ./doc/tip/<posizione del file nella directory del repository>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [







|







667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
854
855
856
857
858
859
860
861




862
863
864
865
866
867
868
869
870
871
872
873
874





































































































































































































































































































































































































































































































































































































































875
876
877
878
879
880
881
    "Questo significa che nel mio database esistono nello stesso momento due versioni diverse dello stesso progetto, e posso passare da un all'altra senza problemi.\n",
    "\n",
    "Un grosso vantaggio del modello di DVCS di fossil è che posso usare diverse cartelle per diversi branch, ed avere il tutto sincronizzato!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},




   "source": [
    "### un caso tipico di branching\n",
    "\n",
    "avete appena raggiunto un risultato pubblicabile con le vostre analisi, e volete prepararvi per pubblicarle.\n",
    "\n",
    "Questo significa che non altererete più il codice in modo sostanziale (volete mantenere l'integrità dei risultati), ma magari aggiusterete i grafici ed i report.\n",
    "\n",
    "Allo stesso momento, i vostri collaboratori vi chiedono di fare delle modifiche piuttosto importanti del codice.\n",
    "Come potete fare?\n",
    "\n",
    "Usando due diverse branch siete in grado di dividere il lavoro senza fare confusione, ma mantenendo tutto sempre sotto controllo (e con la possibilità di far passare i risultati da un branch all'altro con **revert**)."
   ]
  },





































































































































































































































































































































































































































































































































































































































  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],







|
>
>
>
>













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
    "Questo significa che nel mio database esistono nello stesso momento due versioni diverse dello stesso progetto, e posso passare da un all'altra senza problemi.\n",
    "\n",
    "Un grosso vantaggio del modello di DVCS di fossil è che posso usare diverse cartelle per diversi branch, ed avere il tutto sincronizzato!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### un caso tipico di branching\n",
    "\n",
    "avete appena raggiunto un risultato pubblicabile con le vostre analisi, e volete prepararvi per pubblicarle.\n",
    "\n",
    "Questo significa che non altererete più il codice in modo sostanziale (volete mantenere l'integrità dei risultati), ma magari aggiusterete i grafici ed i report.\n",
    "\n",
    "Allo stesso momento, i vostri collaboratori vi chiedono di fare delle modifiche piuttosto importanti del codice.\n",
    "Come potete fare?\n",
    "\n",
    "Usando due diverse branch siete in grado di dividere il lavoro senza fare confusione, ma mantenendo tutto sempre sotto controllo (e con la possibilità di far passare i risultati da un branch all'altro con **revert**)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Usage: fossil checkout ?VERSION | --latest? ?OPTIONS?\r\n",
      "   or: fossil co ?VERSION | --latest? ?OPTIONS?\r\n",
      "\r\n",
      "Check out a version specified on the command-line.  This command\r\n",
      "will abort if there are edited files in the current checkout unless\r\n",
      "the --force option appears on the command-line.  The --keep option\r\n",
      "leaves files on disk unchanged, except the manifest and manifest.uuid\r\n",
      "files.\r\n",
      "\r\n",
      "The --latest flag can be used in place of VERSION to checkout the\r\n",
      "latest version in the repository.\r\n",
      "\r\n",
      "Options:\r\n",
      "   --force           Ignore edited files in the current checkout\r\n",
      "   --keep            Only update the manifest and manifest.uuid files\r\n",
      "   --force-missing   Force checkout even if content is missing\r\n",
      "\r\n",
      "See also: update\r\n"
     ]
    }
   ],
   "source": [
    "!fossil help checkout"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "per comodità faremo il cambio di branch nella stessa directory, ma in generale creeremmo una seconda directory, apriremmo il repository e faremmo il checkout della versione che ci interessa.\n",
    "\n",
    "In questo caso, ritorniamo allo stato iniziale del repository."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {
    "collapsed": true,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "!fossil checkout e17a3d4a58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "collapsed": true,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "ls"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "il repository è vuoto come l'abbiamo lasciato due commit fa."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Writing test.txt\n"
     ]
    }
   ],
   "source": [
    "%%writefile test.txt\n",
    "this is an alternative history"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ADDED  test.txt\r\n"
     ]
    }
   ],
   "source": [
    "!fossil add test.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "would fork.  \"update\" first or use --allow-fork.\r\n"
     ]
    }
   ],
   "source": [
    "!fossil commit -m \"nuova storia\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "New_Version: 5d56786fcd0396b860365fe6ea6f01c8186818cb\n",
      "**** warning: a fork has occurred *****\n"
     ]
    }
   ],
   "source": [
    "!fossil commit --allow-fork -m \"nuova storia\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### la nuova timeline\n",
    "\n",
    "![timeline with branch](./immagini/interfaccia_fossil_7.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### aggiusto le proprietà del nuovo branch\n",
    "\n",
    "![timeline with branch](./immagini/interfaccia_fossil_8.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### ecco come appare la mia timeline ora\n",
    "\n",
    "![timeline with branch](./immagini/interfaccia_fossil_9.png)\n",
    "\n",
    "notate che viene registrato anche il cambiamento di nome del branch!"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "Un'altra operazione molto comune è rinominare o eliminare un file.\n",
    "\n",
    "Un comportamento curioso di fossil è che registra il cambiamento ma non lo attua: dovete esplicitamente rinominare il file dalla linea di comando"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RENAME test.txt test2.txt\r\n"
     ]
    }
   ],
   "source": [
    "!fossil mv test.txt test2.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "test.txt\r\n"
     ]
    }
   ],
   "source": [
    "!ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {
    "collapsed": true,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [],
   "source": [
    "!mv test.txt test2.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "repository:   /home/enrico/lavoro/fossilexample/working_directory/../mytestrepo.fossil\n",
      "local-root:   /home/enrico/lavoro/fossilexample/working_directory/\n",
      "config-db:    /home/enrico/.fossil\n",
      "checkout:     5d56786fcd0396b860365fe6ea6f01c8186818cb 2017-02-27 21:23:41 UTC\n",
      "parent:       e17a3d4a58fef68da694289aa32334d82bde5234 2017-02-27 20:27:38 UTC\n",
      "tags:         experiment\n",
      "comment:      nuova storia (user: enrico)\n",
      "RENAMED    test2.txt\n"
     ]
    }
   ],
   "source": [
    "!fossil status"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "New_Version: 5728ff85e15a79f162bb955aa4a0638967aebe0c\r\n"
     ]
    }
   ],
   "source": [
    "!fossil commit -m \"cambiato il nome del file\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {
    "collapsed": true,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "!rm test2.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "DELETED test2.txt\r\n"
     ]
    }
   ],
   "source": [
    "!fossil rm test2.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Writing test3.txt\n"
     ]
    }
   ],
   "source": [
    "%%writefile test3.txt\n",
    "crazy experiments!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ADDED  test3.txt\r\n"
     ]
    }
   ],
   "source": [
    "!fossil add test3.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "New_Version: 47cc19ae1f35b62a524f2b5ddc4e45d96d6b2bc7\r\n"
     ]
    }
   ],
   "source": [
    "!fossil commit -m \"ultimo commit del branch sperimentale\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "Ora, visto che ci piace renderci la vita complicata, vogliamo unire i due branch.\n",
    "\n",
    "Questo può servire quando stiamo facendo delle modifiche sperimentali ad una parte della nostra analisi e non vogliamo includerlo fintanto che non siamo sicuri che stia funzionando correttamente.\n",
    "\n",
    "Per fare questo dobbiamo usare il comando **merge**, ma prima dobbiamo metterci nella linea principale che vogliamo mantenere (visto che l'altra poi sparirà) con un checkout.\n",
    "\n",
    "Questo risulta molto più facile se avete due cartelle separate.\n",
    "Se state usando la stessa, controllate due volte prima di fare il checkout!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "test.txt\r\n"
     ]
    }
   ],
   "source": [
    "!fossil checkout 488479276d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ADDED test3.txt\r\n",
      "REMINDER: this was a dry run - no files were actually changed.\r\n"
     ]
    }
   ],
   "source": [
    "!fossil merge 47cc19ae1f --dry-run"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ADDED test3.txt\r\n",
      " \"fossil undo\" is available to undo changes to the working checkout.\r\n"
     ]
    }
   ],
   "source": [
    "!fossil merge 47cc19ae1f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "repository:   /home/enrico/lavoro/fossilexample/working_directory/../mytestrepo.fossil\n",
      "local-root:   /home/enrico/lavoro/fossilexample/working_directory/\n",
      "config-db:    /home/enrico/.fossil\n",
      "checkout:     488479276df60e9fd055d5dbe07ee6c37b30beb3 2017-02-27 20:56:16 UTC\n",
      "parent:       1856bb82f3515646637061c6e062c117fc646192 2017-02-27 20:42:51 UTC\n",
      "tags:         trunk\n",
      "comment:      riportato l'ordine nel repository! (user: enrico)\n",
      "ADDED_BY_MERGE test3.txt\n",
      "MERGED_WITH 47cc19ae1f35b62a524f2b5ddc4e45d96d6b2bc7\n"
     ]
    }
   ],
   "source": [
    "!fossil status"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "metadata": {
    "collapsed": false,
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "New_Version: cb5317076a540e3c4799ff184d509de665d47ddb\r\n"
     ]
    }
   ],
   "source": [
    "!fossil commit -m \"le due storie sono finalmente unite!\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "### la versione post-sperimentazione\n",
    "\n",
    "![timeline with branch](./immagini/interfaccia_fossil_10.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "source": [
    "### full disclosure\n",
    "\n",
    "Il file che abbiamo modificato all'inizio, test.txt, dava problemi per il merge perchè creato indipendentemente nei due branch. L'unica soluzione che ho trovato è stata gestire il merge a mano, in pratica creare un nuovo file da zero ed eventualmente riempirlo con il contenuto del vecchio."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
Added immagini/interfaccia_fossil_10.png.

cannot compute difference between binary files

Added immagini/interfaccia_fossil_7.png.

cannot compute difference between binary files

Added immagini/interfaccia_fossil_8.png.

cannot compute difference between binary files

Added immagini/interfaccia_fossil_9.png.

cannot compute difference between binary files