| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -933,7 +933,14 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar | |||
| 933 | 933 | If one of files or directories do not exist in the index | |
| 934 | 934 | ( as opposed to the original git command who ignores them ). | |
| 935 | 935 | Raise GitCommandError if error lines could not be parsed - this truly is | |
| 936 | - an exceptional state""" | ||
| 936 | + an exceptional state | ||
| 937 | + | ||
| 938 | + .. note:: The checkout is limited to checking out the files in the | ||
| 939 | + index. Files which are not in the index anymore and exist in | ||
| 940 | + the working tree will not be deleted. This behaviour is fundamentally | ||
| 941 | + different to *head.checkout*, i.e. if you want git-checkout like behaviour, | ||
| 942 | + use head.checkout instead of index.checkout. | ||
| 943 | + """ | ||
| 937 | 944 | args = ["--index"] | |
| 938 | 945 | if force: | |
| 939 | 946 | args.append("--force") | |
@@ -1055,7 +1062,7 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa | |||
| 1055 | 1062 | If False, the working tree will not be touched | |
| 1056 | 1063 | Please note that changes to the working copy will be discarded without | |
| 1057 | 1064 | warning ! | |
| 1058 | - | ||
| 1065 | + | ||
| 1059 | 1066 | :param head: | |
| 1060 | 1067 | If True, the head will be set to the given commit. This is False by default, | |
| 1061 | 1068 | but if True, this method behaves like HEAD.reset. | |
@@ -1067,6 +1074,11 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa | |||
| 1067 | 1074 | ||
| 1068 | 1075 | :param kwargs: | |
| 1069 | 1076 | Additional keyword arguments passed to git-reset | |
| 1077 | + | ||
| 1078 | + .. note:: IndexFile.reset, as opposed to HEAD.reset, will not delete anyfiles | ||
| 1079 | + in order to maintain a consistent working tree. Instead, it will just | ||
| 1080 | + checkout the files according to their state in the index. | ||
| 1081 | + If you want git-reset like behaviour, use *HEAD.reset* instead. | ||
| 1070 | 1082 | ||
| 1071 | 1083 | :return: self """ | |
| 1072 | 1084 | # what we actually want to do is to merge the tree into our existing | |
@@ -1098,7 +1110,7 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa | |||
| 1098 | 1110 | # END handle working tree | |
| 1099 | 1111 | ||
| 1100 | 1112 | if head: | |
| 1101 | - self.repo.head.commit = self.repo.commit(commit) | ||
| 1113 | + self.repo.head.set_commit(self.repo.commit(commit), logmsg="%s: Updating HEAD" % commit) | ||
| 1102 | 1114 | # END handle head change | |
| 1103 | 1115 | ||
| 1104 | 1116 | return self | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -356,7 +356,7 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False): | |||
| 356 | 356 | # Happens on first commit | |
| 357 | 357 | import git.refs | |
| 358 | 358 | master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit, logmsg="commit (initial): %s" % message) | |
| 359 | - repo.head.reference = master | ||
| 359 | + repo.head.set_reference(master, logmsg='commit: Switching to %s' % master) | ||
| 360 | 360 | # END handle empty repositories | |
| 361 | 361 | # END advance head handling | |
| 362 | 362 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -344,7 +344,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False): | |||
| 344 | 344 | # END initial checkout + branch creation | |
| 345 | 345 | ||
| 346 | 346 | # make sure HEAD is not detached | |
| 347 | - mrepo.head.ref = local_branch | ||
| 347 | + mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch) | ||
| 348 | 348 | mrepo.head.ref.set_tracking_branch(remote_branch) | |
| 349 | 349 | except IndexError: | |
| 350 | 350 | print >> sys.stderr, "Warning: Failed to checkout tracking branch %s" % self.branch_path | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -568,7 +568,7 @@ def test_rev_parse(self): | |||
| 568 | 568 | assert rev_parse('@{1}') != head.commit | |
| 569 | 569 | ||
| 570 | 570 | # position doesn't exist | |
| 571 | - self.failUnlessRaises(BadObject, rev_parse, '@{10000}') | ||
| 571 | + self.failUnlessRaises(IndexError, rev_parse, '@{10000}') | ||
| 572 | 572 | ||
| 573 | 573 | # currently, nothing more is supported | |
| 574 | 574 | self.failUnlessRaises(NotImplementedError, rev_parse, "@{1 week ago}") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments