Repository navigation
Expand file tree
/
Copy pathreference.html
More file actions
2893 lines (2620 loc) · 149 KB
/
Copy pathreference.html
File metadata and controls
2893 lines (2620 loc) · 149 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
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
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>API Reference — GitPython v0.2.0 Beta documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '#',
VERSION: '0.2.0 Beta',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="GitPython v0.2.0 Beta documentation" href="index.html" />
<link rel="next" title="Roadmap" href="roadmap.html" />
<link rel="prev" title="GitPython Tutorial" href="tutorial.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
<a href="roadmap.html" title="Roadmap"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="tutorial.html" title="GitPython Tutorial"
accesskey="P">previous</a> |</li>
<li><a href="index.html">GitPython v0.2.0 Beta documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="api-reference">
<span id="api-reference-toplevel"></span><h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-git.actor">
<h2>Actor<a class="headerlink" href="#module-git.actor" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.actor.Actor">
<em class="property">class </em><tt class="descclassname">git.actor.</tt><tt class="descname">Actor</tt><big>(</big><em>name</em>, <em>email</em><big>)</big><a class="headerlink" href="#git.actor.Actor" title="Permalink to this definition">¶</a></dt>
<dd>Actors hold information about a person acting on the repository. They
can be committers and authors or anything with a name and an email as
mentioned in the git log entries.</dd></dl>
</div>
<div class="section" id="module-git.objects.base">
<h2>Objects.Base<a class="headerlink" href="#module-git.objects.base" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.objects.base.IndexObject">
<em class="property">class </em><tt class="descclassname">git.objects.base.</tt><tt class="descname">IndexObject</tt><big>(</big><em>repo</em>, <em>sha</em>, <em>mode=None</em>, <em>path=None</em><big>)</big><a class="headerlink" href="#git.objects.base.IndexObject" title="Permalink to this definition">¶</a></dt>
<dd><p>Base for all objects that can be part of the index file , namely Tree, Blob and
SubModule objects</p>
<dl class="attribute">
<dt id="git.objects.base.IndexObject.abspath">
<tt class="descname">abspath</tt><a class="headerlink" href="#git.objects.base.IndexObject.abspath" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd><p class="first">Absolute path to this index object in the file system ( as opposed to the
.path field which is a path relative to the git repository ).</p>
<p class="last">The returned path will be native to the system and contains ‘’ on windows.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.base.IndexObject.mode">
<tt class="descname">mode</tt><a class="headerlink" href="#git.objects.base.IndexObject.mode" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.base.IndexObject.name">
<tt class="descname">name</tt><a class="headerlink" href="#git.objects.base.IndexObject.name" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>Name portion of the path, effectively being the basename</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.base.IndexObject.path">
<tt class="descname">path</tt><a class="headerlink" href="#git.objects.base.IndexObject.path" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="git.objects.base.Object">
<em class="property">class </em><tt class="descclassname">git.objects.base.</tt><tt class="descname">Object</tt><big>(</big><em>repo</em>, <em>id</em><big>)</big><a class="headerlink" href="#git.objects.base.Object" title="Permalink to this definition">¶</a></dt>
<dd><p>Implements an Object which may be Blobs, Trees, Commits and Tags</p>
<p>This Object also serves as a constructor for instances of the correct type:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">inst</span> <span class="o">=</span> <span class="n">Object</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">repo</span><span class="p">,</span><span class="nb">id</span><span class="p">)</span>
<span class="n">inst</span><span class="o">.</span><span class="n">sha</span> <span class="c"># objects sha in hex</span>
<span class="n">inst</span><span class="o">.</span><span class="n">size</span> <span class="c"># objects uncompressed data size</span>
<span class="n">inst</span><span class="o">.</span><span class="n">data</span> <span class="c"># byte string containing the whole data of the object</span>
</pre></div>
</div>
<dl class="attribute">
<dt id="git.objects.base.Object.data">
<tt class="descname">data</tt><a class="headerlink" href="#git.objects.base.Object.data" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.base.Object.data_stream">
<tt class="descname">data_stream</tt><a class="headerlink" href="#git.objects.base.Object.data_stream" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns </dt>
<dd>File Object compatible stream to the uncompressed raw data of the object</dd>
</dl>
</dd></dl>
<dl class="classmethod">
<dt id="git.objects.base.Object.new">
<em class="property">classmethod </em><tt class="descname">new</tt><big>(</big><em>repo</em>, <em>id</em><big>)</big><a class="headerlink" href="#git.objects.base.Object.new" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Return</dt>
<dd>New Object instance of a type appropriate to the object type behind
id. The id of the newly created object will be a hexsha even though
the input id may have been a Reference or Rev-Spec</dd>
<dt>Note</dt>
<dd>This cannot be a __new__ method as it would always call __init__
with the input id which is not necessarily a hexsha.</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.base.Object.repo">
<tt class="descname">repo</tt><a class="headerlink" href="#git.objects.base.Object.repo" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.base.Object.sha">
<tt class="descname">sha</tt><a class="headerlink" href="#git.objects.base.Object.sha" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.base.Object.size">
<tt class="descname">size</tt><a class="headerlink" href="#git.objects.base.Object.size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="git.objects.base.Object.stream_data">
<tt class="descname">stream_data</tt><big>(</big><em>ostream</em><big>)</big><a class="headerlink" href="#git.objects.base.Object.stream_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Writes our data directly to the given output stream</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">ostream</span></tt></dt>
<dd>File object compatible stream object.</dd>
<dt>Returns</dt>
<dd>self</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-git.objects.blob">
<h2>Objects.Blob<a class="headerlink" href="#module-git.objects.blob" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.objects.blob.Blob">
<em class="property">class </em><tt class="descclassname">git.objects.blob.</tt><tt class="descname">Blob</tt><big>(</big><em>repo</em>, <em>sha</em>, <em>mode=None</em>, <em>path=None</em><big>)</big><a class="headerlink" href="#git.objects.blob.Blob" title="Permalink to this definition">¶</a></dt>
<dd><p>A Blob encapsulates a git blob object</p>
<dl class="attribute">
<dt id="git.objects.blob.Blob.mime_type">
<tt class="descname">mime_type</tt><a class="headerlink" href="#git.objects.blob.Blob.mime_type" title="Permalink to this definition">¶</a></dt>
<dd><p>The mime type of this file (based on the filename)</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>str</dd>
<dt>NOTE</dt>
<dd>Defaults to ‘text/plain’ in case the actual file type is unknown.</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-git.objects.commit">
<h2>Objects.Commit<a class="headerlink" href="#module-git.objects.commit" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.objects.commit.Commit">
<em class="property">class </em><tt class="descclassname">git.objects.commit.</tt><tt class="descname">Commit</tt><big>(</big><em>repo</em>, <em>sha</em>, <em>tree=None</em>, <em>author=None</em>, <em>authored_date=None</em>, <em>author_tz_offset=None</em>, <em>committer=None</em>, <em>committed_date=None</em>, <em>committer_tz_offset=None</em>, <em>message=None</em>, <em>parents=None</em><big>)</big><a class="headerlink" href="#git.objects.commit.Commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Wraps a git Commit object.</p>
<p>This class will act lazily on some of its attributes and will query the
value on demand only if it involves calling the git binary.</p>
<dl class="attribute">
<dt id="git.objects.commit.Commit.author">
<tt class="descname">author</tt><a class="headerlink" href="#git.objects.commit.Commit.author" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.author_tz_offset">
<tt class="descname">author_tz_offset</tt><a class="headerlink" href="#git.objects.commit.Commit.author_tz_offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.authored_date">
<tt class="descname">authored_date</tt><a class="headerlink" href="#git.objects.commit.Commit.authored_date" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.committed_date">
<tt class="descname">committed_date</tt><a class="headerlink" href="#git.objects.commit.Commit.committed_date" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.committer">
<tt class="descname">committer</tt><a class="headerlink" href="#git.objects.commit.Commit.committer" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.committer_tz_offset">
<tt class="descname">committer_tz_offset</tt><a class="headerlink" href="#git.objects.commit.Commit.committer_tz_offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="git.objects.commit.Commit.count">
<tt class="descname">count</tt><big>(</big><em>paths=''</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#git.objects.commit.Commit.count" title="Permalink to this definition">¶</a></dt>
<dd><p>Count the number of commits reachable from this commit</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">paths</span></tt></dt>
<dd>is an optinal path or a list of paths restricting the return value
to commits actually containing the paths</dd>
<dt><tt class="docutils literal"><span class="pre">kwargs</span></tt></dt>
<dd>Additional options to be passed to git-rev-list. They must not alter
the ouput style of the command, or parsing will yield incorrect results</dd>
<dt>Returns</dt>
<dd>int</dd>
</dl>
</dd></dl>
<dl class="classmethod">
<dt id="git.objects.commit.Commit.create_from_tree">
<em class="property">classmethod </em><tt class="descname">create_from_tree</tt><big>(</big><em>repo</em>, <em>tree</em>, <em>message</em>, <em>parent_commits=None</em>, <em>head=False</em><big>)</big><a class="headerlink" href="#git.objects.commit.Commit.create_from_tree" title="Permalink to this definition">¶</a></dt>
<dd><p>Commit the given tree, creating a commit object.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">repo</span></tt></dt>
<dd>is the Repo</dd>
<dt><tt class="docutils literal"><span class="pre">tree</span></tt></dt>
<dd>Sha of a tree or a tree object to become the tree of the new commit</dd>
<dt><tt class="docutils literal"><span class="pre">message</span></tt></dt>
<dd>Commit message. It may be an empty string if no message is provided.
It will be converted to a string in any case.</dd>
<dt><tt class="docutils literal"><span class="pre">parent_commits</span></tt></dt>
<dd>Optional Commit objects to use as parents for the new commit.
If empty list, the commit will have no parents at all and become
a root commit.
If None , the current head commit will be the parent of the
new commit object</dd>
<dt><tt class="docutils literal"><span class="pre">head</span></tt></dt>
<dd>If True, the HEAD will be advanced to the new commit automatically.
Else the HEAD will remain pointing on the previous commit. This could
lead to undesired results when diffing files.</dd>
<dt>Returns</dt>
<dd>Commit object representing the new commit</dd>
<dt>Note:</dt>
<dd>Additional information about hte committer and Author are taken from the
environment or from the git configuration, see git-commit-tree for
more information</dd>
</dl>
</dd></dl>
<dl class="classmethod">
<dt id="git.objects.commit.Commit.iter_items">
<em class="property">classmethod </em><tt class="descname">iter_items</tt><big>(</big><em>repo</em>, <em>rev</em>, <em>paths=''</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#git.objects.commit.Commit.iter_items" title="Permalink to this definition">¶</a></dt>
<dd><p>Find all commits matching the given criteria.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">repo</span></tt></dt>
<dd>is the Repo</dd>
<dt><tt class="docutils literal"><span class="pre">rev</span></tt></dt>
<dd>revision specifier, see git-rev-parse for viable options</dd>
<dt><tt class="docutils literal"><span class="pre">paths</span></tt></dt>
<dd>is an optinal path or list of paths, if set only Commits that include the path
or paths will be considered</dd>
<dt><tt class="docutils literal"><span class="pre">kwargs</span></tt></dt>
<dd>optional keyword arguments to git rev-list where
<tt class="docutils literal"><span class="pre">max_count</span></tt> is the maximum number of commits to fetch
<tt class="docutils literal"><span class="pre">skip</span></tt> is the number of commits to skip
<tt class="docutils literal"><span class="pre">since</span></tt> all commits since i.e. ‘1970-01-01’</dd>
<dt>Returns</dt>
<dd>iterator yielding Commit items</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.objects.commit.Commit.iter_parents">
<tt class="descname">iter_parents</tt><big>(</big><em>paths=''</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#git.objects.commit.Commit.iter_parents" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterate _all_ parents of this commit.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">paths</span></tt></dt>
<dd>Optional path or list of paths limiting the Commits to those that
contain at least one of the paths</dd>
<dt><tt class="docutils literal"><span class="pre">kwargs</span></tt></dt>
<dd>All arguments allowed by git-rev-list</dd>
<dt>Return:</dt>
<dd>Iterator yielding Commit objects which are parents of self</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.message">
<tt class="descname">message</tt><a class="headerlink" href="#git.objects.commit.Commit.message" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.name_rev">
<tt class="descname">name_rev</tt><a class="headerlink" href="#git.objects.commit.Commit.name_rev" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>String describing the commits hex sha based on the closest Reference.
Mostly useful for UI purposes</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.parents">
<tt class="descname">parents</tt><a class="headerlink" href="#git.objects.commit.Commit.parents" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.stats">
<tt class="descname">stats</tt><a class="headerlink" href="#git.objects.commit.Commit.stats" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a git stat from changes between this commit and its first parent
or from all changes done if this is the very first commit.</p>
<dl class="docutils">
<dt>Return</dt>
<dd>git.Stats</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.summary">
<tt class="descname">summary</tt><a class="headerlink" href="#git.objects.commit.Commit.summary" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>First line of the commit message.</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.commit.Commit.tree">
<tt class="descname">tree</tt><a class="headerlink" href="#git.objects.commit.Commit.tree" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-git.objects.tag">
<h2>Objects.Tag<a class="headerlink" href="#module-git.objects.tag" title="Permalink to this headline">¶</a></h2>
<p>Module containing all object based types.</p>
<dl class="class">
<dt id="git.objects.tag.TagObject">
<em class="property">class </em><tt class="descclassname">git.objects.tag.</tt><tt class="descname">TagObject</tt><big>(</big><em>repo</em>, <em>sha</em>, <em>object=None</em>, <em>tag=None</em>, <em>tagger=None</em>, <em>tagged_date=None</em>, <em>tagger_tz_offset=None</em>, <em>message=None</em><big>)</big><a class="headerlink" href="#git.objects.tag.TagObject" title="Permalink to this definition">¶</a></dt>
<dd><p>Non-Lightweight tag carrying additional information about an object we are pointing
to.</p>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.message">
<tt class="descname">message</tt><a class="headerlink" href="#git.objects.tag.TagObject.message" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.object">
<tt class="descname">object</tt><a class="headerlink" href="#git.objects.tag.TagObject.object" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.tag">
<tt class="descname">tag</tt><a class="headerlink" href="#git.objects.tag.TagObject.tag" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.tagged_date">
<tt class="descname">tagged_date</tt><a class="headerlink" href="#git.objects.tag.TagObject.tagged_date" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.tagger">
<tt class="descname">tagger</tt><a class="headerlink" href="#git.objects.tag.TagObject.tagger" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.objects.tag.TagObject.tagger_tz_offset">
<tt class="descname">tagger_tz_offset</tt><a class="headerlink" href="#git.objects.tag.TagObject.tagger_tz_offset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-git.objects.tree">
<h2>Objects.Tree<a class="headerlink" href="#module-git.objects.tree" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.objects.tree.Tree">
<em class="property">class </em><tt class="descclassname">git.objects.tree.</tt><tt class="descname">Tree</tt><big>(</big><em>repo</em>, <em>sha</em>, <em>mode=0</em>, <em>path=None</em><big>)</big><a class="headerlink" href="#git.objects.tree.Tree" title="Permalink to this definition">¶</a></dt>
<dd><p>Tress represent a ordered list of Blobs and other Trees. Hence it can be
accessed like a list.</p>
<p>Tree’s will cache their contents after first retrieval to improve efficiency.</p>
<p><tt class="docutils literal"><span class="pre">Tree</span> <span class="pre">as</span> <span class="pre">a</span> <span class="pre">list</span></tt>:</p>
<div class="highlight-python"><pre>Access a specific blob using the
tree['filename'] notation.
You may as well access by index
blob = tree[0]</pre>
</div>
<dl class="attribute">
<dt id="git.objects.tree.Tree.blobs">
<tt class="descname">blobs</tt><a class="headerlink" href="#git.objects.tree.Tree.blobs" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>list(Blob, ...) list of blobs directly below this tree</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.objects.tree.Tree.traverse">
<tt class="descname">traverse</tt><big>(</big><em>predicate=<function <lambda> at 0x1e0b050></em>, <em>prune=<function <lambda> at 0x1e0b0c8></em>, <em>depth=-1</em>, <em>branch_first=True</em>, <em>visit_once=False</em>, <em>ignore_self=1</em><big>)</big><a class="headerlink" href="#git.objects.tree.Tree.traverse" title="Permalink to this definition">¶</a></dt>
<dd><p>For documentation, see utils.Traversable.traverse</p>
<p>Trees are set to visist_once = False to gain more performance in the traversal</p>
</dd></dl>
<dl class="attribute">
<dt id="git.objects.tree.Tree.trees">
<tt class="descname">trees</tt><a class="headerlink" href="#git.objects.tree.Tree.trees" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>list(Tree, ...) list of trees directly below this tree</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="git.objects.tree.sha_to_hex">
<tt class="descclassname">git.objects.tree.</tt><tt class="descname">sha_to_hex</tt><big>(</big><em>sha</em><big>)</big><a class="headerlink" href="#git.objects.tree.sha_to_hex" title="Permalink to this definition">¶</a></dt>
<dd>Takes a string and returns the hex of the sha within</dd></dl>
</div>
<div class="section" id="module-git.objects.utils">
<h2>Objects.Utils<a class="headerlink" href="#module-git.objects.utils" title="Permalink to this headline">¶</a></h2>
<p>Module for general utility functions</p>
<dl class="class">
<dt id="git.objects.utils.ProcessStreamAdapter">
<em class="property">class </em><tt class="descclassname">git.objects.utils.</tt><tt class="descname">ProcessStreamAdapter</tt><big>(</big><em>process</em>, <em>stream_name</em><big>)</big><a class="headerlink" href="#git.objects.utils.ProcessStreamAdapter" title="Permalink to this definition">¶</a></dt>
<dd><p>Class wireing all calls to the contained Process instance.</p>
<p>Use this type to hide the underlying process to provide access only to a specified
stream. The process is usually wrapped into an AutoInterrupt class to kill
it if the instance goes out of scope.</p>
</dd></dl>
<dl class="class">
<dt id="git.objects.utils.Traversable">
<em class="property">class </em><tt class="descclassname">git.objects.utils.</tt><tt class="descname">Traversable</tt><a class="headerlink" href="#git.objects.utils.Traversable" title="Permalink to this definition">¶</a></dt>
<dd><p>Simple interface to perforam depth-first or breadth-first traversals
into one direction.
Subclasses only need to implement one function.
Instances of the Subclass must be hashable</p>
<dl class="method">
<dt id="git.objects.utils.Traversable.traverse">
<tt class="descname">traverse</tt><big>(</big><em>predicate=<function <lambda> at 0x1df9de8></em>, <em>prune=<function <lambda> at 0x1df9e60></em>, <em>depth=-1</em>, <em>branch_first=True</em>, <em>visit_once=True</em>, <em>ignore_self=1</em>, <em>as_edge=False</em><big>)</big><a class="headerlink" href="#git.objects.utils.Traversable.traverse" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">Returns</span></tt></dt>
<dd>iterator yieling of items found when traversing self</dd>
<dt><tt class="docutils literal"><span class="pre">predicate</span></tt></dt>
<dd>f(i,d) returns False if item i at depth d should not be included in the result</dd>
<dt><tt class="docutils literal"><span class="pre">prune</span></tt></dt>
<dd>f(i,d) return True if the search should stop at item i at depth d.
Item i will not be returned.</dd>
<dt><tt class="docutils literal"><span class="pre">depth</span></tt></dt>
<dd>define at which level the iteration should not go deeper
if -1, there is no limit
if 0, you would effectively only get self, the root of the iteration
i.e. if 1, you would only get the first level of predessessors/successors</dd>
<dt><tt class="docutils literal"><span class="pre">branch_first</span></tt></dt>
<dd>if True, items will be returned branch first, otherwise depth first</dd>
<dt><tt class="docutils literal"><span class="pre">visit_once</span></tt></dt>
<dd>if True, items will only be returned once, although they might be encountered
several times. Loops are prevented that way.</dd>
<dt><tt class="docutils literal"><span class="pre">ignore_self</span></tt></dt>
<dd>if True, self will be ignored and automatically pruned from
the result. Otherwise it will be the first item to be returned.
If as_edge is True, the source of the first edge is None</dd>
<dt><tt class="docutils literal"><span class="pre">as_edge</span></tt></dt>
<dd>if True, return a pair of items, first being the source, second the
destinatination, i.e. tuple(src, dest) with the edge spanning from
source to destination</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="git.objects.utils.get_object_type_by_name">
<tt class="descclassname">git.objects.utils.</tt><tt class="descname">get_object_type_by_name</tt><big>(</big><em>object_type_name</em><big>)</big><a class="headerlink" href="#git.objects.utils.get_object_type_by_name" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>type suitable to handle the given object type name.
Use the type to create new instances.</dd>
<dt><tt class="docutils literal"><span class="pre">object_type_name</span></tt></dt>
<dd>Member of TYPES</dd>
<dt>Raises</dt>
<dd>ValueError: In case object_type_name is unknown</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="git.objects.utils.parse_actor_and_date">
<tt class="descclassname">git.objects.utils.</tt><tt class="descname">parse_actor_and_date</tt><big>(</big><em>line</em><big>)</big><a class="headerlink" href="#git.objects.utils.parse_actor_and_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse out the actor (author or committer) info from a line like:</p>
<div class="highlight-python"><pre>author Tom Preston-Werner <tom@mojombo.com> 1191999972 -0700</pre>
</div>
<dl class="docutils">
<dt>Returns</dt>
<dd>[Actor, int_seconds_since_epoch, int_timezone_offset]</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-git.cmd">
<h2>GitCmd<a class="headerlink" href="#module-git.cmd" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.cmd.Git">
<em class="property">class </em><tt class="descclassname">git.cmd.</tt><tt class="descname">Git</tt><big>(</big><em>working_dir=None</em><big>)</big><a class="headerlink" href="#git.cmd.Git" title="Permalink to this definition">¶</a></dt>
<dd><p>The Git class manages communication with the Git binary.</p>
<p>It provides a convenient interface to calling the Git binary, such as in:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">g</span> <span class="o">=</span> <span class="n">Git</span><span class="p">(</span> <span class="n">git_dir</span> <span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">init</span><span class="p">()</span> <span class="c"># calls 'git init' program</span>
<span class="n">rval</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">ls_files</span><span class="p">()</span> <span class="c"># calls 'git ls-files' program</span>
</pre></div>
</div>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">Debugging</span></tt></dt>
<dd>Set the GIT_PYTHON_TRACE environment variable print each invocation
of the command to stdout.
Set its value to ‘full’ to see details about the returned values.</dd>
</dl>
<dl class="class">
<dt id="git.cmd.Git.AutoInterrupt">
<em class="property">class </em><tt class="descname">AutoInterrupt</tt><big>(</big><em>proc</em>, <em>args</em><big>)</big><a class="headerlink" href="#git.cmd.Git.AutoInterrupt" title="Permalink to this definition">¶</a></dt>
<dd><p>Kill/Interrupt the stored process instance once this instance goes out of scope. It is
used to prevent processes piling up in case iterators stop reading.
Besides all attributes are wired through to the contained process object.</p>
<p>The wait method was overridden to perform automatic status code checking
and possibly raise.</p>
<dl class="attribute">
<dt id="git.cmd.Git.AutoInterrupt.args">
<tt class="descname">args</tt><a class="headerlink" href="#git.cmd.Git.AutoInterrupt.args" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.cmd.Git.AutoInterrupt.proc">
<tt class="descname">proc</tt><a class="headerlink" href="#git.cmd.Git.AutoInterrupt.proc" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="git.cmd.Git.AutoInterrupt.wait">
<tt class="descname">wait</tt><big>(</big><big>)</big><a class="headerlink" href="#git.cmd.Git.AutoInterrupt.wait" title="Permalink to this definition">¶</a></dt>
<dd><p>Wait for the process and return its status code.</p>
<dl class="docutils">
<dt>Raise</dt>
<dd>GitCommandError if the return status is not 0</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="attribute">
<dt id="git.cmd.Git.cat_file_all">
<tt class="descclassname">Git.</tt><tt class="descname">cat_file_all</tt><a class="headerlink" href="#git.cmd.Git.cat_file_all" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.cmd.Git.cat_file_header">
<tt class="descclassname">Git.</tt><tt class="descname">cat_file_header</tt><a class="headerlink" href="#git.cmd.Git.cat_file_header" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="git.cmd.Git.clear_cache">
<tt class="descclassname">Git.</tt><tt class="descname">clear_cache</tt><big>(</big><big>)</big><a class="headerlink" href="#git.cmd.Git.clear_cache" title="Permalink to this definition">¶</a></dt>
<dd><p>Clear all kinds of internal caches to release resources.</p>
<p>Currently persistent commands will be interrupted.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>self</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.cmd.Git.execute">
<tt class="descclassname">Git.</tt><tt class="descname">execute</tt><big>(</big><em>command</em>, <em>istream=None</em>, <em>with_keep_cwd=False</em>, <em>with_extended_output=False</em>, <em>with_exceptions=True</em>, <em>as_process=False</em>, <em>output_stream=None</em><big>)</big><a class="headerlink" href="#git.cmd.Git.execute" title="Permalink to this definition">¶</a></dt>
<dd><p>Handles executing the command on the shell and consumes and returns
the returned information (stdout)</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">command</span></tt></dt>
<dd>The command argument list to execute.
It should be a string, or a sequence of program arguments. The
program to execute is the first item in the args sequence or string.</dd>
<dt><tt class="docutils literal"><span class="pre">istream</span></tt></dt>
<dd>Standard input filehandle passed to subprocess.Popen.</dd>
<dt><tt class="docutils literal"><span class="pre">with_keep_cwd</span></tt></dt>
<dd>Whether to use the current working directory from os.getcwd().
The cmd otherwise uses its own working_dir that it has been initialized
with if possible.</dd>
<dt><tt class="docutils literal"><span class="pre">with_extended_output</span></tt></dt>
<dd>Whether to return a (status, stdout, stderr) tuple.</dd>
<dt><tt class="docutils literal"><span class="pre">with_exceptions</span></tt></dt>
<dd>Whether to raise an exception when git returns a non-zero status.</dd>
<dt><tt class="docutils literal"><span class="pre">as_process</span></tt></dt>
<dd>Whether to return the created process instance directly from which
streams can be read on demand. This will render with_extended_output and
with_exceptions ineffective - the caller will have
to deal with the details himself.
It is important to note that the process will be placed into an AutoInterrupt
wrapper that will interrupt the process once it goes out of scope. If you
use the command in iterators, you should pass the whole process instance
instead of a single stream.</dd>
<dt><tt class="docutils literal"><span class="pre">output_stream</span></tt></dt>
<dd>If set to a file-like object, data produced by the git command will be
output to the given stream directly.
This feature only has any effect if as_process is False. Processes will
always be created with a pipe due to issues with subprocess.
This merely is a workaround as data will be copied from the
output pipe to the given output stream directly.</dd>
</dl>
<p>Returns:</p>
<div class="highlight-python"><pre>str(output) # extended_output = False (Default)
tuple(int(status), str(stdout), str(stderr)) # extended_output = True
if ouput_stream is True, the stdout value will be your output stream:
output_stream # extended_output = False
tuple(int(status), output_stream, str(stderr))# extended_output = True</pre>
</div>
<dl class="docutils">
<dt>Raise</dt>
<dd>GitCommandError</dd>
<dt>NOTE</dt>
<dd>If you add additional keyword arguments to the signature of this method,
you must update the execute_kwargs tuple housed in this module.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.cmd.Git.get_object_data">
<tt class="descclassname">Git.</tt><tt class="descname">get_object_data</tt><big>(</big><em>ref</em><big>)</big><a class="headerlink" href="#git.cmd.Git.get_object_data" title="Permalink to this definition">¶</a></dt>
<dd><p>As get_object_header, but returns object data as well</p>
<dl class="docutils">
<dt>Return:</dt>
<dd>(hexsha, type_string, size_as_int,data_string)</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.cmd.Git.get_object_header">
<tt class="descclassname">Git.</tt><tt class="descname">get_object_header</tt><big>(</big><em>ref</em><big>)</big><a class="headerlink" href="#git.cmd.Git.get_object_header" title="Permalink to this definition">¶</a></dt>
<dd><p>Use this method to quickly examine the type and size of the object behind
the given ref.</p>
<dl class="docutils">
<dt>NOTE</dt>
<dd>The method will only suffer from the costs of command invocation
once and reuses the command in subsequent calls.</dd>
<dt>Return:</dt>
<dd>(hexsha, type_string, size_as_int)</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="git.cmd.Git.transform_kwargs">
<tt class="descclassname">Git.</tt><tt class="descname">transform_kwargs</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#git.cmd.Git.transform_kwargs" title="Permalink to this definition">¶</a></dt>
<dd>Transforms Python style kwargs into git command line options.</dd></dl>
<dl class="attribute">
<dt id="git.cmd.Git.working_dir">
<tt class="descclassname">Git.</tt><tt class="descname">working_dir</tt><a class="headerlink" href="#git.cmd.Git.working_dir" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>Git directory we are working on</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="git.cmd.dashify">
<tt class="descclassname">git.cmd.</tt><tt class="descname">dashify</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#git.cmd.dashify" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-git.config">
<h2>Config<a class="headerlink" href="#module-git.config" title="Permalink to this headline">¶</a></h2>
<p>Module containing module parser implementation able to properly read and write
configuration files</p>
<dl class="attribute">
<dt id="git.config.GitConfigParser">
<tt class="descclassname">git.config.</tt><tt class="descname">GitConfigParser</tt><a class="headerlink" href="#git.config.GitConfigParser" title="Permalink to this definition">¶</a></dt>
<dd>alias of <tt class="xref docutils literal"><span class="pre">write</span></tt></dd></dl>
</div>
<div class="section" id="module-git.diff">
<h2>Diff<a class="headerlink" href="#module-git.diff" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="git.diff.Diff">
<em class="property">class </em><tt class="descclassname">git.diff.</tt><tt class="descname">Diff</tt><big>(</big><em>repo</em>, <em>a_path</em>, <em>b_path</em>, <em>a_blob_id</em>, <em>b_blob_id</em>, <em>a_mode</em>, <em>b_mode</em>, <em>new_file</em>, <em>deleted_file</em>, <em>rename_from</em>, <em>rename_to</em>, <em>diff</em><big>)</big><a class="headerlink" href="#git.diff.Diff" title="Permalink to this definition">¶</a></dt>
<dd><p>A Diff contains diff information between two Trees.</p>
<p>It contains two sides a and b of the diff, members are prefixed with
“a” and “b” respectively to inidcate that.</p>
<p>Diffs keep information about the changed blob objects, the file mode, renames,
deletions and new files.</p>
<p>There are a few cases where None has to be expected as member variable value:</p>
<p><tt class="docutils literal"><span class="pre">New</span> <span class="pre">File</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">a_mode</span> <span class="ow">is</span> <span class="bp">None</span>
<span class="n">a_blob</span> <span class="ow">is</span> <span class="bp">None</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Deleted</span> <span class="pre">File</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">b_mode</span> <span class="ow">is</span> <span class="bp">None</span>
<span class="n">b_blob</span> <span class="ow">is</span> <span class="bp">None</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">Working</span> <span class="pre">Tree</span> <span class="pre">Blobs</span></tt></p>
<blockquote>
When comparing to working trees, the working tree blob will have a null hexsha
as a corresponding object does not yet exist. The mode will be null as well.
But the path will be available though.
If it is listed in a diff the working tree version of the file must
be different to the version in the index or tree, and hence has been modified.</blockquote>
<dl class="attribute">
<dt id="git.diff.Diff.a_blob">
<tt class="descname">a_blob</tt><a class="headerlink" href="#git.diff.Diff.a_blob" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.a_mode">
<tt class="descname">a_mode</tt><a class="headerlink" href="#git.diff.Diff.a_mode" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.b_blob">
<tt class="descname">b_blob</tt><a class="headerlink" href="#git.diff.Diff.b_blob" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.b_mode">
<tt class="descname">b_mode</tt><a class="headerlink" href="#git.diff.Diff.b_mode" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.deleted_file">
<tt class="descname">deleted_file</tt><a class="headerlink" href="#git.diff.Diff.deleted_file" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.diff">
<tt class="descname">diff</tt><a class="headerlink" href="#git.diff.Diff.diff" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.new_file">
<tt class="descname">new_file</tt><a class="headerlink" href="#git.diff.Diff.new_file" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.rename_from">
<tt class="descname">rename_from</tt><a class="headerlink" href="#git.diff.Diff.rename_from" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.rename_to">
<tt class="descname">rename_to</tt><a class="headerlink" href="#git.diff.Diff.rename_to" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.diff.Diff.renamed">
<tt class="descname">renamed</tt><a class="headerlink" href="#git.diff.Diff.renamed" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns:</dt>
<dd>True if the blob of our diff has been renamed</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="git.diff.DiffIndex">
<em class="property">class </em><tt class="descclassname">git.diff.</tt><tt class="descname">DiffIndex</tt><a class="headerlink" href="#git.diff.DiffIndex" title="Permalink to this definition">¶</a></dt>
<dd><p>Implements an Index for diffs, allowing a list of Diffs to be queried by
the diff properties.</p>
<p>The class improves the diff handling convenience</p>
<dl class="method">
<dt id="git.diff.DiffIndex.iter_change_type">
<tt class="descname">iter_change_type</tt><big>(</big><em>change_type</em><big>)</big><a class="headerlink" href="#git.diff.DiffIndex.iter_change_type" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Return</dt>
<dd>iterator yieling Diff instances that match the given change_type</dd>
<dt><tt class="docutils literal"><span class="pre">change_type</span></tt></dt>
<dd><p class="first">Member of DiffIndex.change_type, namely</p>
<p>‘A’ for added paths</p>
<p>‘D’ for deleted paths</p>
<p>‘R’ for renamed paths</p>
<p class="last">‘M’ for paths with modified data</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="git.diff.Diffable">
<em class="property">class </em><tt class="descclassname">git.diff.</tt><tt class="descname">Diffable</tt><a class="headerlink" href="#git.diff.Diffable" title="Permalink to this definition">¶</a></dt>
<dd><p>Common interface for all object that can be diffed against another object of compatible type.</p>
<dl class="docutils">
<dt>NOTE: </dt>
<dd>Subclasses require a repo member as it is the case for Object instances, for practical
reasons we do not derive from Object.</dd>
</dl>
<dl class="class">
<dt id="git.diff.Diffable.Index">
<em class="property">class </em><tt class="descname">Index</tt><a class="headerlink" href="#git.diff.Diffable.Index" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="git.diff.Diffable.diff">
<tt class="descclassname">Diffable.</tt><tt class="descname">diff</tt><big>(</big><em>other=<class 'git.diff.Index'></em>, <em>paths=None</em>, <em>create_patch=False</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#git.diff.Diffable.diff" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates diffs between two items being trees, trees and index or an
index and the working tree.</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">other</span></tt></dt>
<dd>Is the item to compare us with.
If None, we will be compared to the working tree.
If Treeish, it will be compared against the respective tree
If Index ( type ), it will be compared against the index.
It defaults to Index to assure the method will not by-default fail
on bare repositories.</dd>
<dt><tt class="docutils literal"><span class="pre">paths</span></tt></dt>
<dd>is a list of paths or a single path to limit the diff to.
It will only include at least one of the givne path or paths.</dd>
<dt><tt class="docutils literal"><span class="pre">create_patch</span></tt></dt>
<dd>If True, the returned Diff contains a detailed patch that if applied
makes the self to other. Patches are somwhat costly as blobs have to be read
and diffed.</dd>
<dt><tt class="docutils literal"><span class="pre">kwargs</span></tt></dt>
<dd>Additional arguments passed to git-diff, such as
R=True to swap both sides of the diff.</dd>
<dt>Returns</dt>
<dd>git.DiffIndex</dd>
<dt>Note</dt>
<dd><p class="first">Rename detection will only work if create_patch is True.</p>
<p class="last">On a bare repository, ‘other’ needs to be provided as Index or as
as Tree/Commit, or a git command error will occour</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-git.errors">
<h2>Errors<a class="headerlink" href="#module-git.errors" title="Permalink to this headline">¶</a></h2>
<p>Module containing all exceptions thrown througout the git package,</p>
<dl class="exception">
<dt id="git.errors.GitCommandError">
<em class="property">exception </em><tt class="descclassname">git.errors.</tt><tt class="descname">GitCommandError</tt><big>(</big><em>command</em>, <em>status</em>, <em>stderr=None</em><big>)</big><a class="headerlink" href="#git.errors.GitCommandError" title="Permalink to this definition">¶</a></dt>
<dd>Thrown if execution of the git command fails with non-zero status code.</dd></dl>
<dl class="exception">
<dt id="git.errors.InvalidGitRepositoryError">
<em class="property">exception </em><tt class="descclassname">git.errors.</tt><tt class="descname">InvalidGitRepositoryError</tt><a class="headerlink" href="#git.errors.InvalidGitRepositoryError" title="Permalink to this definition">¶</a></dt>
<dd>Thrown if the given repository appears to have an invalid format.</dd></dl>
<dl class="exception">
<dt id="git.errors.NoSuchPathError">
<em class="property">exception </em><tt class="descclassname">git.errors.</tt><tt class="descname">NoSuchPathError</tt><a class="headerlink" href="#git.errors.NoSuchPathError" title="Permalink to this definition">¶</a></dt>
<dd>Thrown if a path could not be access by the system.</dd></dl>
</div>
<div class="section" id="module-git.index">
<h2>Index<a class="headerlink" href="#module-git.index" title="Permalink to this headline">¶</a></h2>
<p>Module containing Index implementation, allowing to perform all kinds of index
manipulations such as querying and merging.</p>
<dl class="class">
<dt id="git.index.BaseIndexEntry">
<em class="property">class </em><tt class="descclassname">git.index.</tt><tt class="descname">BaseIndexEntry</tt><a class="headerlink" href="#git.index.BaseIndexEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>Small Brother of an index entry which can be created to describe changes
done to the index in which case plenty of additional information is not requried.</p>
<p>As the first 4 data members match exactly to the IndexEntry type, methods
expecting a BaseIndexEntry can also handle full IndexEntries even if they
use numeric indices for performance reasons.</p>
<dl class="classmethod">
<dt id="git.index.BaseIndexEntry.from_blob">
<em class="property">classmethod </em><tt class="descname">from_blob</tt><big>(</big><em>blob</em>, <em>stage=0</em><big>)</big><a class="headerlink" href="#git.index.BaseIndexEntry.from_blob" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>Fully equipped BaseIndexEntry at the given stage</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.index.BaseIndexEntry.mode">
<tt class="descname">mode</tt><a class="headerlink" href="#git.index.BaseIndexEntry.mode" title="Permalink to this definition">¶</a></dt>
<dd>File Mode, compatible to stat module constants</dd></dl>
<dl class="attribute">
<dt id="git.index.BaseIndexEntry.path">
<tt class="descname">path</tt><a class="headerlink" href="#git.index.BaseIndexEntry.path" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="git.index.BaseIndexEntry.sha">
<tt class="descname">sha</tt><a class="headerlink" href="#git.index.BaseIndexEntry.sha" title="Permalink to this definition">¶</a></dt>
<dd>hex sha of the blob</dd></dl>
<dl class="attribute">
<dt id="git.index.BaseIndexEntry.stage">
<tt class="descname">stage</tt><a class="headerlink" href="#git.index.BaseIndexEntry.stage" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Stage of the entry, either:</dt>
<dd>0 = default stage
1 = stage before a merge or common ancestor entry in case of a 3 way merge
2 = stage of entries from the ‘left’ side of the merge
3 = stage of entries from the right side of the merge</dd>
<dt>Note:</dt>
<dd>For more information, see <a class="reference external" href="http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html">http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html</a></dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="git.index.BlobFilter">
<em class="property">class </em><tt class="descclassname">git.index.</tt><tt class="descname">BlobFilter</tt><big>(</big><em>paths</em><big>)</big><a class="headerlink" href="#git.index.BlobFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Predicate to be used by iter_blobs allowing to filter only return blobs which
match the given list of directories or files.</p>
<p>The given paths are given relative to the repository.</p>
<dl class="attribute">
<dt id="git.index.BlobFilter.paths">
<tt class="descname">paths</tt><a class="headerlink" href="#git.index.BlobFilter.paths" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="exception">
<dt id="git.index.CheckoutError">
<em class="property">exception </em><tt class="descclassname">git.index.</tt><tt class="descname">CheckoutError</tt><big>(</big><em>message</em>, <em>failed_files</em>, <em>valid_files</em>, <em>failed_reasons</em><big>)</big><a class="headerlink" href="#git.index.CheckoutError" title="Permalink to this definition">¶</a></dt>
<dd><p>Thrown if a file could not be checked out from the index as it contained
changes.</p>
<p>The .failed_files attribute contains a list of relative paths that failed
to be checked out as they contained changes that did not exist in the index.</p>
<p>The .failed_reasons attribute contains a string informing about the actual
cause of the issue.</p>
<p>The .valid_files attribute contains a list of relative paths to files that
were checked out successfully and hence match the version stored in the
index</p>
</dd></dl>
<dl class="class">
<dt id="git.index.IndexEntry">
<em class="property">class </em><tt class="descclassname">git.index.</tt><tt class="descname">IndexEntry</tt><a class="headerlink" href="#git.index.IndexEntry" title="Permalink to this definition">¶</a></dt>
<dd><p>Allows convenient access to IndexEntry data without completely unpacking it.</p>
<p>Attributes usully accessed often are cached in the tuple whereas others are
unpacked on demand.</p>
<p>See the properties for a mapping between names and tuple indices.</p>
<dl class="attribute">
<dt id="git.index.IndexEntry.ctime">
<tt class="descname">ctime</tt><a class="headerlink" href="#git.index.IndexEntry.ctime" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
file’s creation time</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="git.index.IndexEntry.dev">
<tt class="descname">dev</tt><a class="headerlink" href="#git.index.IndexEntry.dev" title="Permalink to this definition">¶</a></dt>
<dd>Device ID</dd></dl>
<dl class="classmethod">
<dt id="git.index.IndexEntry.from_base">
<em class="property">classmethod </em><tt class="descname">from_base</tt><big>(</big><em>base</em><big>)</big><a class="headerlink" href="#git.index.IndexEntry.from_base" title="Permalink to this definition">¶</a></dt>
<dd><dl class="docutils">
<dt>Returns</dt>
<dd>Minimal entry as created from the given BaseIndexEntry instance.
Missing values will be set to null-like values</dd>
<dt><tt class="docutils literal"><span class="pre">base</span></tt></dt>
<dd>Instance of type BaseIndexEntry</dd>
</dl>
</dd></dl>