~bzr/ubuntu/lucid/dulwich/bzr-ppa

« back to all changes in this revision

Viewing changes to docs/tutorial/4-remove-file.txt

  • Committer: Jelmer Vernooij
  • Date: 2010-01-03 15:39:27 UTC
  • mfrom: (400.1.17)
  • Revision ID: git-v1:7f39158f9a5d828f6eafb7735ad42ebd1dd24a03
* New upstream release.
* Bump standards version to 3.8.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Removing a file
 
2
===============
 
3
 
 
4
Removing a file just means removing its entry in the tree. The blob won't be
 
5
deleted because Git tries to preserve the history of your repository.
 
6
 
 
7
It's all pythonic::
 
8
 
 
9
    >>> del tree["ham"]
 
10
 
 
11
  >>> c4 = Commit()
 
12
  >>> c4.tree = tree.id
 
13
  >>> c4.parents = [commit.id]
 
14
  >>> c4.author = c4.committer = author
 
15
  >>> c4.commit_time = c4.author_time = int(time())
 
16
  >>> c4.commit_timezone = c4.author_timezone = tz
 
17
  >>> c4.encoding = "UTF-8"
 
18
  >>> c4.message = 'Removing "ham"'
 
19
 
 
20
Here we only have the new tree and the commit to save::
 
21
 
 
22
    >>> object_store.add_object(spam)
 
23
    >>> object_store.add_object(tree)
 
24
    >>> object_store.add_object(c4)
 
25
 
 
26
And of course update the head::
 
27
 
 
28
    >>> repo.refs['refs/heads/master'] = commit.id
 
29
 
 
30
If you don't trust me, ask ``git show``. ;-)