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
|
# vim: set fileencoding=utf-8 :
"""
Test L{gbp.git.GitRepository}
This testcase creates several repositores:
- A repository at L{repo_dir} called I{repo}
- A bare repository at L{bare_dir} called I{bare}
- A clone of I{repo} below L{clone_dir} called I{clone}
- A mirror of I{repo} below L{mirror_clone_dir} called I{mirror}
"""
import os
repo_dir = os.path.abspath(
os.path.join(os.path.curdir, 'gbp_%s_test_repo' % __name__))
bare_dir = os.path.abspath(
os.path.join(os.path.curdir, 'gbp_%s_test_bare' % __name__))
clone_dir = os.path.abspath(
os.path.join(os.path.curdir, 'gbp_%s_test_clone' % __name__))
mirror_clone_dir = os.path.abspath(
os.path.join(os.path.curdir, 'gbp_%s_test_mirror_clone' % __name__))
def test_create():
"""
Create a repository
Methods tested:
- L{gbp.git.GitRepository.create}
Properties tested:
- L{gbp.git.GitRepository.path}
- L{gbp.git.GitRepository.git_dir}
>>> import os, gbp.git
>>> repo = gbp.git.GitRepository.create(repo_dir)
>>> repo.path == repo_dir
True
>>> repo.git_dir == os.path.join(repo_dir, '.git')
True
>>> type(repo) == gbp.git.GitRepository
True
"""
def test_empty():
"""
Empty repos have no branch
Methods tested:
- L{gbp.git.GitRepository.get_branch}
- L{gbp.git.GitRepository.is_empty}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.get_branch()
>>> repo.branch
>>> repo.is_empty()
True
"""
def test_add_files():
"""
Add some dummy data
Methods tested:
- L{gbp.git.GitRepository.add_files}
- L{gbp.git.GitRepository.commit_all}
- L{gbp.git.GitRepository.is_clean}
Properties tested:
- L{gbp.git.GitRepository.head}
>>> import gbp.git, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> shutil.copy(os.path.join(repo.path, ".git/HEAD"), \
os.path.join(repo.path, "testfile"))
>>> repo.is_clean()[0]
False
>>> repo.is_clean(ignore_untracked=True)[0]
True
>>> repo.add_files(repo.path, force=True)
>>> repo.commit_all(msg="foo")
>>> repo.is_clean()[0]
True
>>> h = repo.head
>>> len(h)
40
"""
def test_branch_master():
"""
First branch is called I{master}
Methods tested:
- L{gbp.git.GitRepository.get_branch}
>>> import gbp.git, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.get_branch()
'master'
>>> repo.branch
'master'
"""
def test_create_branch():
"""
Create a branch name I{foo}
Methods tested:
- L{gbp.git.GitRepository.create_branch}
- L{gbp.git.GitRepository.branch_contains}
>>> import gbp.git, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.create_branch("foo")
>>> repo.branch_contains("foo", 'HEAD')
True
>>> repo.branch_contains("doesnotexist", 'HEAD', remote=True)
False
"""
def test_delete_branch():
"""
Create a branch named I{foo2} and delete it
Methods tested:
- L{gbp.git.GitRepository.create_branch}
- L{gbp.git.GitRepository.delete_branch}
>>> import gbp.git, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.create_branch("bar")
>>> repo.delete_branch("bar")
>>> repo.delete_branch("master")
Traceback (most recent call last):
...
GitRepositoryError: Can't delete the branch you're on
"""
def test_set_branch():
"""
Switch to branch named I{foo}
Methods tested:
- L{gbp.git.GitRepository.set_branch}
- L{gbp.git.GitRepository.get_branch}
- L{gbp.git.GitRepository.branch}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.set_branch("foo")
>>> repo.get_branch() == "foo"
True
>>> repo.branch == "foo"
True
"""
def test_rename_branch():
"""
Create branch named I{baz}, rename it to I{bax} and finally delete it
Methods tested:
- L{gbp.git.GitRepository.create_branch}
- L{gbp.git.GitRepository.rename_branch}
- L{gbp.git.GitRepository.delete_branch}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.create_branch("baz")
>>> repo.rename_branch("baz", "bax")
>>> repo.delete_branch("bax")
"""
def test_set_upstream_branch():
"""
Set upstream branch master -> origin/master
>>> import os, shutil
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> os.makedirs(os.path.join(repo.git_dir, 'refs/remotes/origin'))
>>> shutil.copy(os.path.join(repo.git_dir, 'refs/heads/master'), \
os.path.join(repo.git_dir, 'refs/remotes/origin/'))
>>> repo.set_upstream_branch('master', 'origin/master')
>>> repo.get_upstream_branch('master')
'origin/master'
>>> repo.set_upstream_branch('bla', 'origin/master')
Traceback (most recent call last):
GitRepositoryError: Branch bla doesn't exist!
>>> repo.set_upstream_branch('foo', 'origin/bla')
Traceback (most recent call last):
GitRepositoryError: Branch origin/bla doesn't exist!
"""
def test_get_upstream_branch():
"""
Get info about upstream branches set in test_set_upstream_branch
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.get_upstream_branch('master')
'origin/master'
>>> repo.get_upstream_branch('foo')
''
>>> repo.get_upstream_branch('bla')
Traceback (most recent call last):
GitRepositoryError: Branch bla doesn't exist!
"""
def test_tag():
"""
Create a tag named I{tag} and check it's existance
Methods tested:
- L{gbp.git.GitRepository.create_tag}
- L{gbp.git.GitRepository.verify_tag}
- L{gbp.git.GitRepository.has_tag}
- L{gbp.git.GitRepository.get_tags}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.create_tag("tag")
>>> repo.has_tag("tag")
True
>>> repo.has_tag("unknown")
False
>>> repo.create_tag("tag2", msg="foo")
>>> repo.has_tag("tag2")
True
>>> repo.verify_tag("tag2")
False
>>> repo.get_tags()
['tag', 'tag2']
>>> repo.tags
['tag', 'tag2']
"""
def test_find_tag():
"""
Find tags
Methods tested:
- L{gbp.git.GitRepository.find_tag}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.find_tag('HEAD')
'tag2'
>>> repo.find_tag('HEAD', pattern='foo*')
Traceback (most recent call last):
...
GitRepositoryError: Can't find tag for HEAD. Git error: fatal: No names found, cannot describe anything.
"""
def test_move_tag():
"""
Move a tag
Methods tested:
- L{gbp.git.GitRepository.move_tag}
- L{gbp.git.GitRepository.has_tag}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.move_tag("tag", "moved")
>>> repo.has_tag("tag")
False
>>> repo.has_tag("moved")
True
"""
def test_delete_tag():
"""
Delete tags
Methods tested:
- L{gbp.git.GitRepository.delete_tag}
- L{gbp.git.GitRepository.has_tag}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.has_tag("moved")
True
>>> repo.delete_tag("moved")
>>> repo.has_tag("moved")
False
"""
def test_get_obj_type():
"""
Find commit SHA1 related to tags
Methods tested:
- L{gbp.git.GitRepository.create_tag}
- L{gbp.git.GitRepository.get_obj_type}
- L{gbp.git.GitRepository.delete_tag}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.create_tag("tag3", "tag msg")
>>> repo.get_obj_type("tag3")
'tag'
>>> repo.get_obj_type("HEAD")
'commit'
>>> repo.get_obj_type("HEAD:testfile")
'blob'
>>> repo.delete_tag("tag3")
"""
def test_list_files():
"""
List files in the index
Methods tested:
- L{gbp.git.GitRepository.list_files}
- L{gbp.git.GitRepository.add_files}
- L{gbp.git.GitRepository.commit_staged}
- L{gbp.git.GitRepository.commit_files}
- L{gbp.git.GitRepository.force_head}
>>> import gbp.git, os, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> src = os.path.join(repo.path, ".git/HEAD")
>>> dst = os.path.join(repo.path, "testfile")
>>> repo.list_files()
['testfile']
>>> repo.list_files(['modified'])
[]
>>> repo.list_files(['modified', 'deleted'])
[]
>>> repo.list_files(['modified', 'deleted', 'cached'])
['testfile']
>>> shutil.copy(src, dst)
>>> repo.list_files(['modified'])
['testfile']
>>> repo.add_files(dst)
>>> repo.commit_staged(msg="foo")
>>> repo.list_files(['modified'])
[]
>>> repo.list_files(['foo'])
Traceback (most recent call last):
...
GitRepositoryError: Unknown type 'foo'
>>> repo.force_head('HEAD^', hard=True)
>>> repo.list_files(['modified'])
[]
>>> shutil.copy(src, dst)
>>> repo.list_files(['modified'])
['testfile']
>>> repo.commit_files(dst, msg="foo")
>>> repo.list_files(['modified'])
[]
"""
def test_get_commits():
"""
Test listing commits
Methods tested:
- L{gbp.git.GitRepository.get_commits}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> commits = repo.get_commits()
>>> type(commits) == list and len(commits) == 2
True
>>> len(repo.get_commits(num=1)) == 1
True
>>> repo.get_commits(paths=['foo', 'bar'])
[]
>>> repo.get_commits(paths=['testfile']) == commits
True
"""
def test_get_commit_info():
"""
Test inspecting commits
Methods tested:
- L{gbp.git.GitRepository.get_commit_info}
>>> import gbp.git
>>> from datetime import datetime
>>> repo = gbp.git.GitRepository(repo_dir)
>>> info = repo.get_commit_info('HEAD')
>>> info['id']
'HEAD'
>>> info['body']
''
>>> info['subject']
'foo'
>>> '@' in info['author'].email
True
>>> '@' in info['committer'].email
True
>>> now = datetime.now()
>>> (now - datetime.fromtimestamp(int(info['author'].date.split()[0]))).seconds < 10
True
>>> (now - datetime.fromtimestamp(int(info['committer'].date.split()[0]))).seconds < 10
True
>>> info['files']
defaultdict(<type 'list'>, {'M': ['testfile']})
"""
def test_mirror_clone():
"""
Mirror a repository
Methods tested:
- L{gbp.git.GitRepository.clone}
- L{gbp.git.GitRepository.is_empty}
- L{gbp.git.GitRepository.set_branch}
- L{gbp.git.GitRepository.has_branch}
- L{gbp.git.GitRepository.branch}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.set_branch('master')
>>> mirror = gbp.git.GitRepository.clone(mirror_clone_dir, repo.path, mirror=True)
>>> mirror.is_empty()
False
>>> mirror.branch
'master'
>>> mirror.has_branch('foo')
True
>>> mirror.has_branch('bar')
False
>>> mirror.set_branch('foo')
>>> mirror.branch
'foo'
>>> mirror.force_head('foo^')
"""
def test_clone():
"""
Clone a repository
Methods tested:
- L{gbp.git.GitRepository.clone}
- L{gbp.git.GitRepository.is_empty}
- L{gbp.git.GitRepository.set_branch}
- L{gbp.git.GitRepository.branch}
- L{gbp.git.GitRepository.get_merge_branch}
- L{gbp.git.GitRepository.get_remote_branches}
- L{gbp.git.GitRepository.get_local_branches}
- L{gbp.git.GitRepository.get_remote_repos}
- L{gbp.git.GitRepository.has_remote_repo}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.set_branch('master')
>>> clone = gbp.git.GitRepository.clone(clone_dir, repo.path)
>>> clone.is_empty()
False
>>> clone.branch
'master'
>>> clone.get_remote_branches()
['origin/HEAD', 'origin/foo', 'origin/master']
>>> clone.get_local_branches()
['master']
>>> clone.get_merge_branch('master')
'origin/master'
>>> clone.create_branch('foo', 'origin/foo')
>>> clone.get_merge_branch('foo')
'origin/foo'
>>> clone.create_branch('bar')
>>> clone.get_merge_branch('bar') # None if no merge branch exists
>>> clone.get_local_branches()
['bar', 'foo', 'master']
>>> clone.get_remote_repos()
['origin']
>>> clone.has_remote_repo('origin')
True
>>> clone.has_branch('origin/master', remote=True)
True
>>> clone.has_remote_repo('godiug')
False
"""
def test_merge():
"""
Merge a branch
Methods tested:
- L{gbp.git.GitRepository.merge}
- L{gbp.git.GitRepository.set_branch}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.set_branch('master')
>>> repo.merge('foo')
"""
def test_pull():
"""
Pull from a remote repository
Methods tested:
- L{gbp.git.GitRepository.set_branch}
- L{gbp.git.GitRepository.pull}
>>> import gbp.git, os
>>> d = os.path.join(clone_dir, 'gbp_%s_test_repo' % __name__)
>>> clone = gbp.git.GitRepository(d)
>>> clone.set_branch('master')
>>> clone.pull()
"""
def test_fetch():
"""
Fetch from a remote repository
Methods tested:
- L{gbp.git.GitRepository.fetch}
- L{gbp.git.GitRepository.push}
- L{gbp.git.GitRepository.push_tag}
- L{gbp.git.GitRepository.add_remote_repo}
- L{gbp.git.GitRepository.remove_remote_repo}
>>> import gbp.git, os
>>> d = os.path.join(clone_dir, 'gbp_%s_test_repo' % __name__)
>>> clone = gbp.git.GitRepository(d)
>>> clone.fetch()
>>> clone.push()
>>> clone.push('origin')
>>> clone.push('origin', 'master')
>>> clone.create_tag('tag3')
>>> clone.push_tag('origin', 'tag3')
>>> clone.add_remote_repo('foo', repo_dir)
>>> clone.fetch('foo')
>>> clone.fetch('foo', tags=True)
>>> clone.remove_remote_repo('foo')
"""
def test_create_bare():
"""
Create a bare repository
Methods tested:
- L{gbp.git.GitRepository.create}
- L{gbp.git.GitRepository.is_empty}
>>> import gbp.git
>>> bare = gbp.git.GitRepository.create(bare_dir, bare=True, description="msg")
>>> bare.path == bare_dir
True
>>> bare.git_dir == bare_dir
True
>>> type(bare) == gbp.git.GitRepository
True
>>> bare.is_empty()
True
>>> bare.is_clean()
(True, '')
"""
def test_nonexistant():
"""
Check that accessing a non existant repository fails.
Methods tested:
- L{gbp.git.GitRepository.__init__}
>>> import gbp.git
>>> bare = gbp.git.GitRepository("/does/not/exist")
Traceback (most recent call last):
...
GitRepositoryError: No Git repository at '/does/not/exist' (or any parent dir)
"""
def test_create_noperm():
"""
Check that creating a repository at a path that isn't writeable fails
Methods tested:
- L{gbp.git.GitRepository.create}
>>> import gbp.git
>>> gbp.git.GitRepository.create("/does/not/exist")
Traceback (most recent call last):
...
GitRepositoryError: Cannot create Git repository at '/does/not/exist': Permission denied
"""
def test_checkout():
"""
Checkout treeishs
Methods tested:
- L{gbp.git.GitRepository.checkout}
- L{gbp.git.GitRepository.get_branch}
- L{gbp.git.GitRepository.set_branch}
- L{gbp.git.GitRepository.rev_parse}
Properties tested:
- L{gbp.git.GitRepository.branch}
- L{gbp.git.GitRepository.tags}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.checkout('master')
>>> repo.branch
'master'
>>> repo.rev_parse('doesnotexist')
Traceback (most recent call last):
...
GitRepositoryError: revision 'doesnotexist' not found
>>> sha1 = repo.rev_parse('master', short=10)
>>> len(sha1)
10
>>> sha1 = repo.rev_parse('master')
>>> len(sha1)
40
>>> repo.checkout(sha1)
>>> repo.branch
>>> repo.get_branch()
Traceback (most recent call last):
...
GitRepositoryError: Currently not on a branch
>>> tag = repo.tags[0]
>>> repo.checkout(tag)
>>> repo.branch
"""
def test_gc():
"""
Test garbace collection
Methods tested:
- L{gbp.git.GitRepository.collect_garbage}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.collect_garbage()
"""
def test_grep():
"""
Test grepping through commit messages
Methods tested:
- L{gbp.git.GitRepository.grep_log}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.set_branch('master')
>>> len(repo.grep_log('foo')) == 2
True
>>> len(repo.grep_log('foo', 'master')) == 2
True
>>> repo.grep_log('blafasel')
[]
>>> repo.grep_log('foo', 'doesnotexist')
Traceback (most recent call last):
...
GitRepositoryError: Error grepping log for foo
"""
def test_is_ff():
"""
Test if branch is fast forwardable
Methods tested:
- L{gbp.git.GitRepository.is_fast_forward}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.is_fast_forward('master', 'foo')
(True, True)
>>> repo.create_branch('ff', 'HEAD^')
>>> repo.is_fast_forward('ff', 'master')
(True, False)
>>> repo.is_fast_forward('master', 'ff')
(False, True)
"""
def test_update_ref():
"""
Test updating a reference
Methods tested:
- L{gbp.git.GitRepository.update_ref}
>>> import gbp.git, os
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.update_ref('new_ref', 'master', msg='update')
>>> os.path.exists(os.path.join(repo.git_dir, 'new_ref'))
True
"""
def test_make_tree():
"""
Test git-mk-tree
Methods tested:
- L{gbp.git.GitRepository.write_file}
- L{gbp.git.GitRepository.list_tree}
- L{gbp.git.GitRepository.make_tree}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> sha1 = repo.write_file('testfile')
>>> sha1
'19af7398c894bc5e86e17259317e4db519e9241f'
>>> head = repo.list_tree('HEAD')
>>> head
[['100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', 'testfile']]
>>> head.append(['100644', 'blob', '19af7398c894bc5e86e17259317e4db519e9241f', 'testfile2'])
>>> repo.make_tree(head)
'745951810c9e22fcc6de9b23f05efd6ab5512123'
"""
def test_update_submodules():
"""
Updating submodules if we don't have any is a noop
Methods tested:
- L{gbp.git.GitRepository.has_submodules}
- L{gbp.git.GitRepository.update_submodules}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> repo.has_submodules()
False
>>> repo.update_submodules()
"""
def test_get_merge_base():
"""
Find the common ancestor of two objects
Methods tested:
- L{gbp.git.GitRepository.get_merge_base}
>>> import gbp.git
>>> repo = gbp.git.GitRepository(repo_dir)
>>> sha1 = repo.get_merge_base('master', 'foo')
>>> len(sha1)
40
>>> repo.get_merge_base('master', 'doesnotexist')
Traceback (most recent call last):
...
GitRepositoryError: Failed to get common ancestor: fatal: Not a valid object name doesnotexist
"""
def test_status():
r"""
Methods tested:
- L{gbp.git.GitRepository.status}
>>> import gbp.git, os, shutil
>>> repo = gbp.git.GitRepository(repo_dir)
>>> fname = os.path.join(repo.path, "test_status")
>>> shutil.copy(os.path.join(repo.path, ".git/HEAD"), fname)
>>> repo.status().items()
[('??', ['test_status'])]
>>> repo.status(['bla*']).items()
[]
>>> repo.status(['te*']).items()
[('??', ['test_status'])]
>>> repo.add_files(repo.path, force=True)
>>> repo.commit_all(msg='added %s' % fname)
>>> _ = repo._git_inout('mv', [fname, fname + 'new'])
>>> repo.status().items()
[('R ', ['test_status\x00test_statusnew'])]
"""
def test_teardown():
"""
Perform the teardown
>>> import shutil, os
>>> os.getenv("GBP_TESTS_NOCLEAN") or shutil.rmtree(repo_dir)
>>> os.getenv("GBP_TESTS_NOCLEAN") or shutil.rmtree(bare_dir)
>>> os.getenv("GBP_TESTS_NOCLEAN") or shutil.rmtree(mirror_clone_dir)
>>> os.getenv("GBP_TESTS_NOCLEAN") or shutil.rmtree(clone_dir)
"""
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
|