* What's cooking in git.git (Mar 2009, #05; Tue, 17)
From: Junio C Hamano @ 2009-03-18 5:30 UTC (permalink / raw)
To: git
Here are the topics that have been cooking. Commits prefixed with '-' are
only in 'pu' while commits prefixed with '+' are in 'next'. The ones
marked with '.' do not appear in any of the branches, but I am still
holding onto them.
The topics list the commits in reverse chronological order. The topics
meant to be merged to the maintenance series have "maint-" in their names.
----------------------------------------------------------------
[New Topics]
* dm/maint-docco (Mon Mar 16 23:16:17 2009 -0700) 4 commits
+ Documentation: minor grammatical fixes in git-branch.txt.
+ Documentation: minor grammatical fixes in git-blame.txt.
+ Documentation: reword the "Description" section of git-bisect.txt.
+ Documentation: minor grammatical fixes in git-archive.txt.
* mg/test-installed (Mon Mar 16 18:03:12 2009 +0100) 2 commits
+ test-lib.sh: Allow running the test suite against installed git
+ test-lib.sh: Test for presence of git-init in the right path.
----------------------------------------------------------------
[Graduated to "master"]
* kb/checkout-optim (Tue Mar 17 19:20:29 2009 +0100) 20 commits
+ Revert "lstat_cache(): print a warning if doing ping-pong between
cache types"
+ checkout bugfix: use stat.mtime instead of stat.ctime in two
places
+ Makefile: Set compiler switch for USE_NSEC
+ Create USE_ST_TIMESPEC and turn it on for Darwin
+ Not all systems use st_[cm]tim field for ns resolution file
timestamp
+ Record ns-timestamps if possible, but do not use it without
USE_NSEC
+ write_index(): update index_state->timestamp after flushing to
disk
+ verify_uptodate(): add ce_uptodate(ce) test
+ make USE_NSEC work as expected
+ fix compile error when USE_NSEC is defined
+ check_updates(): effective removal of cache entries marked
CE_REMOVE
+ lstat_cache(): print a warning if doing ping-pong between cache
types
+ show_patch_diff(): remove a call to fstat()
+ write_entry(): use fstat() instead of lstat() when file is open
+ write_entry(): cleanup of some duplicated code
+ create_directories(): remove some memcpy() and strchr() calls
+ unlink_entry(): introduce schedule_dir_for_removal()
+ lstat_cache(): swap func(length, string) into func(string, length)
+ lstat_cache(): generalise longest_match_lstat_cache()
+ lstat_cache(): small cleanup and optimisation
* tr/maint-1.6.0-send-email-irt (Wed Mar 11 23:40:13 2009 +0100) 2 commits
+ send-email: test --no-thread --in-reply-to combination
+ send-email: respect in-reply-to regardless of threading
* js/remote-improvements (Sun Mar 8 00:10:33 2009 -0800) 23 commits
+ builtin-remote.c: no "commented out" code, please
+ builtin-remote: new show output style for push refspecs
+ builtin-remote: new show output style
+ remote: make guess_remote_head() use exact HEAD lookup if it is
available
+ builtin-remote: add set-head subcommand
+ builtin-remote: teach show to display remote HEAD
+ builtin-remote: fix two inconsistencies in the output of "show
<remote>"
+ builtin-remote: make get_remote_ref_states() always populate
states.tracked
+ builtin-remote: rename variables and eliminate redundant function
call
+ builtin-remote: remove unused code in get_ref_states
+ builtin-remote: refactor duplicated cleanup code
+ string-list: new for_each_string_list() function
+ remote: make match_refs() not short-circuit
+ remote: make match_refs() copy src ref before assigning to
peer_ref
+ remote: let guess_remote_head() optionally return all matches
+ remote: make copy_ref() perform a deep copy
+ remote: simplify guess_remote_head()
+ move locate_head() to remote.c
+ move duplicated ref_newer() to remote.c
+ move duplicated get_local_heads() to remote.c
+ refactor find_ref_by_name() to accept const list
+ add basic http clone/fetch tests
+ test scripts: refactor start_httpd helper
* rs/color-grep (Mon Mar 16 13:20:04 2009 +1100) 7 commits
+ grep: prefer builtin over external one when coloring results
+ grep: cast printf %.*s "precision" argument explicitly to int
+ grep: add support for coloring with external greps
+ grep: color patterns in output
+ grep: add pmatch and eflags arguments to match_one_pattern()
+ grep: remove grep_opt argument from match_expr_eval()
+ grep: micro-optimize hit collection for AND nodes
* js/rsync-local (Mon Mar 9 19:44:55 2009 +0100) 1 commit
+ rsync transport: allow local paths, and fix tests
* js/sideband-stderr (Tue Mar 10 22:58:09 2009 +0100) 2 commits
+ winansi: support ESC [ K (erase in line)
+ recv_sideband: Bands #2 and #3 always go to stderr
* db/maint-missing-origin (Mon Mar 16 00:35:09 2009 -0700) 2 commits
+ Remove total confusion from git-fetch and git-push
+ Give error when no remote is configured
* jc/maint-1.6.0-read-tree-overlay (Thu Mar 12 00:02:12 2009 -0700) 1 commit
+ read-tree A B C: do not create a bogus index and do not segfault
With new test.
----------------------------------------------------------------
[Will merge to 'master' soon]
* fc/parseopt-config (Tue Mar 17 10:46:37 2009 +0100) 10 commits
+ config: test for --replace-all with one argument and fix
documentation.
+ config: set help text for --bool-or-int
+ git config: don't allow --get-color* and variable type
+ git config: don't allow extra arguments for -e or -l.
+ git config: don't allow multiple variable types
+ git config: don't allow multiple config file locations
+ git config: reorganize to use parseopt
+ git config: reorganize get_color*
+ git config: trivial rename in preparation for parseopt
+ git_config(): not having a per-repo config file is not an error
* js/rebase-i-opt (Tue Mar 3 10:55:31 2009 +0100) 1 commit
+ rebase -i: avoid 'git reset' when possible
* mh/cvsimport-tests (Mon Feb 23 06:08:14 2009 +0100) 5 commits
+ Add a test of "git cvsimport"'s handling of tags and branches
+ Add some tests of git-cvsimport's handling of vendor branches
+ Test contents of entire cvsimported "master" tree contents
+ Use CVS's -f option if available (ignore user's ~/.cvsrc file)
+ Start a library for cvsimport-related tests
* hv/cvsimport-tests (Mon Mar 2 18:59:36 2009 +0100) 1 commit
+ cvsimport: add test illustrating a bug in cvsps
* jc/clone-branch-rebase (Tue Mar 10 01:20:42 2009 -0700) 2 commits
+ Improve "git branch --tracking" output
+ Make git-clone respect branch.autosetuprebase
This is a rewrite of a patch from Pat Notz.
* xx/db-refspec-vs-js-remote (Sun Mar 8 00:12:33 2009 -0800) 1 commit
+ Adjust js/remote-improvements and db/refspec-wildcard-in-the-
middle
* db/refspec-wildcard-in-the-middle (Sat Mar 7 01:11:39 2009 -0500) 5 commits
+ Support '*' in the middle of a refspec
+ Keep '*' in pattern refspecs
+ Use the matching function to generate the match results
+ Use a single function to match names against patterns
+ Make clone parse the default refspec with the normal code
* bw/autoconf (Thu Mar 12 15:20:12 2009 -0400) 7 commits
+ configure: rework pthread handling to allow for user defined flags
+ configure: make iconv tests aware of user arguments
+ configure: asciidoc version test cleanup
+ configure: wrap some library tests with GIT_STASH_FLAGS
+ configure: add macros to stash FLAG variables
+ configure: reorganize flow of argument checks
+ configure: ensure settings from user are also usable in the script
----------------------------------------------------------------
[Stalled and may need help and prodding to go forward]
* ps/blame (Thu Mar 12 21:30:03 2009 +1100) 1 commit
- blame.c: start libifying the blame infrastructure
A few minor point remains in this initial one.
* jc/log-tz (Tue Mar 3 00:45:37 2009 -0800) 1 commit
- Allow --date=local --date=other-format to work as expected
The one I posted had a few corner-case bugs that was caught with the test
suite; this one has them fixed. People did not like the UI so it is kept
out of 'next'
* lh/submodule-tree-traversal (Sun Jan 25 01:52:06 2009 +0100) 1 commit
- archive.c: add support for --submodules[=(all|checkedout)]
Discussion stalled on the submodule selection criteria.
Probably I should discard it and wait for a reroll if needed.
* jc/merge-convert (Mon Jan 26 16:45:01 2009 -0800) 1 commit
- git-merge-file: allow converting the results for the work tree
This is a feature waiting for a user.
We did not give scripted Porcelains a way to say "this temporary file I am
using for merging is for this path, so use the core.autocrlf and attributes
rules for that final path". Instead, merge-file simply wrote out the
data in the canonical repository representation.
rerere has the same issue, but it is a lot worse. It reads the three
files (preimage, postimage and thisimage) from the work tree in the work
tree representation, merges them without converting them to the canonical
representation first but inserts the conflict markers with the canonical
representation and writes the resulting mess out. It needs to be fixed to
read with convert_to_git(), merge them while they are still in the
canonical representation and possibly add conflict markers, and then write
the results out after convert_to_working_tree(). It also needs to write
in binary mode as well.
* db/foreign-scm (Sun Jan 11 15:12:10 2009 -0500) 3 commits
- Support fetching from foreign VCSes
- Add specification of git-vcs helpers
- Add "vcs" config option in remotes
Daniel seems to have a plan for going forward with this series.
* cc/replace (Mon Feb 2 06:13:06 2009 +0100) 11 commits
- builtin-replace: use "usage_msg_opt" to give better error messages
- parse-options: add new function "usage_msg_opt"
- builtin-replace: teach "git replace" to actually replace
- Add new "git replace" command
- environment: add global variable to disable replacement
- mktag: call "check_sha1_signature" with the replacement sha1
- replace_object: add a test case
- object: call "check_sha1_signature" with the replacement sha1
- sha1_file: add a "read_sha1_file_repl" function
- replace_object: add mechanism to replace objects found in
"refs/replace/"
- refs: add a "for_each_replace_ref" function
I know, I really have to drop everything else and re-read these, but I
haven't managed to.
* js/notes (Wed Feb 18 11:17:27 2009 -0800) 14 commits
- tests: fix "export var=val"
- notes: refuse to edit notes outside refs/notes/
- t3301: use test_must_fail instead of !
- t3301: fix confusing quoting in test for valid notes ref
- notes: use GIT_EDITOR and core.editor over VISUAL/EDITOR
- notes: only clean up message file when editing
- handle empty notes gracefully
- git notes show: test empty notes
- git-notes: fix printing of multi-line notes
- notes: fix core.notesRef documentation
- Add an expensive test for git-notes
- Speed up git notes lookup
- Add a script to edit/inspect notes
- Introduce commit notes
----------------------------------------------------------------
[Actively cooking]
* jc/attributes-checkout (Fri Mar 13 21:24:08 2009 -0700) 1 commit
- Read attributes from the index that is being checked out
* fg/push-default (Mon Mar 16 16:42:52 2009 +0100) 2 commits
- Display warning for default git push with no push.default config
+ New config push.default to decide default behavior for push
Replaced the old series with the first step to allow a smooth transition.
Some might argue that this should not give any warning but just give users
this new configuration to play with first, and after we know we are going
to switch default some day, start the warning.
* mg/http-auth (Thu Mar 12 22:34:43 2009 -0700) 4 commits
+ http.c: CURLOPT_NETRC_OPTIONAL is not available in ancient
versions of cURL
+ http authentication via prompts
+ http_init(): Fix config file parsing
+ http.c: style cleanups
This does only the fetch side but without any additional configuration
variables that looked like band-aid. Support for push side seems to be in
the works somewhere.
* db/push-cleanup (Sun Mar 8 21:06:07 2009 -0400) 2 commits
+ Move push matching and reporting logic into transport.c
+ Use a common function to get the pretty name of refs
* kb/tracking-count-no-merges (Wed Mar 4 18:47:39 2009 +0100) 1 commit
+ stat_tracking_info(): only count real commits
This gives the merge commits zero weight when talking about how many
commits you have ahead (or behind) of the branch you are tracking. Even
though I agree that they should carry much less weight than the "real"
commits, because your repeated merge from the other branch does not really
add any real value to the end result, giving them absolute zero weight
somehow feels wrong. At least it shows that your have been _active_ on the
branch. But I do not feel very strongly about it.
* mv/parseopt-ls-files (Sat Mar 7 20:27:22 2009 -0500) 4 commits
+ ls-files: fix broken --no-empty-directory
+ t3000: use test_cmp instead of diff
+ parse-opt: migrate builtin-ls-files.
+ Turn the flags in struct dir_struct into a single variable
The tip one was a subject for further discussion, but nothing is queued
yet.
----------------------------------------------------------------
[On Hold]
* jc/deny-delete-current-1.7.0 (Mon Feb 9 00:19:46 2009 -0800) 1 commit
- receive-pack: default receive.denyDeleteCurrent to refuse
* jc/refuse-push-to-current-1.7.0 (Wed Feb 11 02:28:03 2009 -0800) 1 commit
- Refuse updating the current branch in a non-bare repository via
push
These are for 1.7.0, but the messages when they trigger together may need
to be rethought.
^ permalink raw reply
* Re: Suggested Workflow Question
From: Martin Langhoff @ 2009-03-18 4:41 UTC (permalink / raw)
To: Marcel M. Cary; +Cc: Roger Garvin, git@vger.kernel.org
In-Reply-To: <49C04DFC.10201@earth.care2.com>
On Wed, Mar 18, 2009 at 2:27 PM, Marcel M. Cary <marcel@earth.care2.com> wrote:
> * emailing patches when direct connections are not possible
> * test and dev branches for each customer
We've done a ton of that. Even better than emailing is that you can
have a repo on a usb stick/disk.
- At the office, update it from the 'office' repository.
- At the client site, pull updates from the usb stick, and push any
code developed at teh client side to the stick
- Back at the office, push to the office repo
cheers,
m
--
martin.langhoff@gmail.com
martin@laptop.org -- School Server Architect
- ask interesting questions
- don't get distracted with shiny stuff - working code first
- http://wiki.laptop.org/go/User:Martinlanghoff
^ permalink raw reply
* reflog hash show wrong when delete a entry
From: Frank Li @ 2009-03-18 4:36 UTC (permalink / raw)
To: git
git reflog show master
ac3f132 master@{0}: commit: Stash list using reflog dialog.
a24e038 master@{1}: commit: Reflog dialog basic work
cf4e18d master@{2}: commit: Parser Reflog output
d58c869 master@{3}: commit: RefLogDlg: Show ref list at dropdownlist
d3dcc9b master@{4}: commit: Add Submodule Add and reflog Dialog
7a60d02 master@{5}: commit: Add Submodule Command
a6a192b master@{6}: a6a192baa48ce58105ca254aff66bda135b376f6: updating HEAD
git reflog delete master@{2}
ac3f132 master@{0}: commit: Stash list using reflog dialog.
a24e038 master@{1}: commit: Reflog dialog basic work
*cf4e18d* master@{2}: commit: RefLogDlg: Show ref list at dropdownlist
d3dcc9b master@{3}: commit: Add Submodule Add and reflog Dialog
7a60d02 master@{4}: commit: Add Submodule Command
a6a192b master@{5}: a6a192baa48ce58105ca254aff66bda135b376f6: updating HEAD
d699182 master@{6}: am: Boost as submodule
1ca1d68 master@{7}: am: Removed boost to add it as submodule
I think now master@{2} should be d58c869, master@{3} before delete.
^ permalink raw reply
* Re: [PATCH] contrib/difftool: use a separate config namespace for difftool commands
From: David Aguilar @ 2009-03-18 4:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: markus.heidelberg, Jay Soffian, git
In-Reply-To: <7veiwvpvhp.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
> Markus Heidelberg <markus.heidelberg@web.de> writes:
>
> > Jay Soffian <jaysoffian@gmail.com> wrote:
> > >
> > > Aside, (for Junio I guess...), what's the reason this command is in
> > > contrib, and by what criteria might it graduate to being installed
> > > with the rest of the git commands?
> > >
> > > j.
> >
> > I'd like to see it as a general git tool, too.
> > Maybe it can even share some common functionality with git-mergetool.
>
> The code was copied and pasted very heavily, and I think (IIRC) the author
> was a bit too ashamed to have it outside contrib/ before it is properly
> refactored or something like that. Which I happen to agree with, by the
> way.
I'll work on some patches to get the ball rolling on this.
Here's what I see as the steps I would take:
1. move difftool into the root, update Makefile, etc.
2. factor out the similarities between merge/difftool and
put them in maybe git-tool-lib.sh?
Suggestions/places to look for examples are highly appreciated.
I know we have git-sh-setup but this isn't nearly as generic.
3. adjust merge/difftool to use the common functions
I remember someone mentioning that mergetool should use
hard tabs instead of mixing tabs+spaces so a patch
to fix that up would make sense in there somewhere as well
assuming that's in line with the list's sensibilities.
--
David
^ permalink raw reply
* Re: Suggested Workflow Question
From: Marcel M. Cary @ 2009-03-18 3:54 UTC (permalink / raw)
To: Roger Garvin; +Cc: git@vger.kernel.org
In-Reply-To: <49C04DFC.10201@earth.care2.com>
Marcel Cary wrote:
> Roger Garvin wrote:
>> So we have a copy of the source on our office server, and another copy at each
>> customer site.
>> (Some customers also have separate development, and testing versions on their
>> servers as well.)
> There was an interesting discussion about maintaining per-client code on
> different branches recently, but I can't find it.
Here's the broader thread:
http://thread.gmane.org/gmane.comp.version-control.git/113278
This is an abridged summary:
http://article.gmane.org/gmane.comp.version-control.git/110697
And this a nice explanation referenced by the summary:
http://gitster.livejournal.com/26540.html
Marcel
^ permalink raw reply
* [PATCH 2/4] Documentation: reworded the "Description" section of git-bisect.txt.
From: David J. Mellor @ 2009-03-18 3:32 UTC (permalink / raw)
To: gitster; +Cc: git
In-Reply-To: <20090317182137.A0CE317A4B@sandstone.whistlingcat.com>
Reworded this section to make it less chatty. Also made minor grammatical
fixes.
Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
---
I corrected "good/bad" occurrences in the text as discussed elsewhere in this
thread. I also removed an incorrect use of an infinitive in the previous
version of this patch at line 244:
to determine --> determine
I also clarified the discussion of the use of "git bisect log" in relation to
"git bisect replay".
Documentation/git-bisect.txt | 161 +++++++++++++++++++++---------------------
1 files changed, 81 insertions(+), 80 deletions(-)
diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index e65c1ca..1a4a527 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -3,7 +3,7 @@ git-bisect(1)
NAME
----
-git-bisect - Find the change that introduced a bug by binary search
+git-bisect - Find by binary search the change that introduced a bug
SYNOPSIS
@@ -39,7 +39,8 @@ help" or "git bisect -h" to get a long usage description.
Basic bisect commands: start, bad, good
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The way you use it is:
+Using the Linux kernel tree as an example, basic use of the bisect
+command is as follows:
------------------------------------------------
$ git bisect start
@@ -48,61 +49,62 @@ $ git bisect good v2.6.13-rc2 # v2.6.13-rc2 was the last version
# tested that was good
------------------------------------------------
-When you give at least one bad and one good versions, it will bisect
-the revision tree and say something like:
+When you have specified at least one bad and one good version, the
+command bisects the revision tree and outputs something similar to:
------------------------------------------------
Bisecting: 675 revisions left to test after this
------------------------------------------------
-and check out the state in the middle. Now, compile that kernel, and
-boot it. Now, let's say that this booted kernel works fine, then just
-do
+and then checks out the state in the middle. You would now compile
+that kernel and boot it. If the booted kernel works correctly, you
+would then issue the following command:
------------------------------------------------
$ git bisect good # this one is good
------------------------------------------------
-which will now say
+which would then output something similar to:
------------------------------------------------
Bisecting: 337 revisions left to test after this
------------------------------------------------
and you continue along, compiling that one, testing it, and depending
-on whether it is good or bad, you say "git bisect good" or "git bisect
-bad", and ask for the next bisection.
+on whether it is good or bad issuing the command "git bisect good"
+or "git bisect bad" to ask for the next bisection.
-Until you have no more left, and you'll have been left with the first
-bad kernel rev in "refs/bisect/bad".
+Eventually there will be no more revisions left to bisect, and you
+will have been left with the first bad kernel revision in "refs/bisect/bad".
Bisect reset
~~~~~~~~~~~~
-Oh, and then after you want to reset to the original head, do a
+To return to the original head after a bisect session, you issue the
+command:
------------------------------------------------
$ git bisect reset
------------------------------------------------
-to get back to the original branch, instead of being on the bisection
-commit ("git bisect start" will do that for you too, actually: it will
-reset the bisection state).
+This resets the tree to the original branch instead of being on the
+bisection commit ("git bisect start" will also do that, as it resets
+the bisection state).
Bisect visualize
~~~~~~~~~~~~~~~~
-During the bisection process, you can say
+During the bisection process, you issue the command:
------------
$ git bisect visualize
------------
-to see the currently remaining suspects in 'gitk'. `visualize` is a bit
-too long to type and `view` is provided as a synonym.
+to see the currently remaining suspects in 'gitk'. `view` may also
+be used as a synonym for `visualize`.
-If 'DISPLAY' environment variable is not set, 'git log' is used
-instead. You can even give command line options such as `-p` and
+If the 'DISPLAY' environment variable is not set, 'git log' is used
+instead. You can also give command line options such as `-p` and
`--stat`.
------------
@@ -112,57 +114,57 @@ $ git bisect view --stat
Bisect log and bisect replay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The good/bad input is logged, and
+After having marked revisions as good or bad, then:
------------
$ git bisect log
------------
-shows what you have done so far. You can truncate its output somewhere
-and save it in a file, and run
+shows what you have done so far. If you discover that you made a mistake
+in specifying the status of a revision, you can save the output of this
+command to a file, edit it to remove the incorrect entries, and then issue
+the following commands to return to a corrected state:
------------
+$ git bisect reset
$ git bisect replay that-file
------------
-if you find later you made a mistake telling good/bad about a
-revision.
-
-Avoiding to test a commit
+Avoiding testing a commit
~~~~~~~~~~~~~~~~~~~~~~~~~
-If in a middle of bisect session, you know what the bisect suggested
-to try next is not a good one to test (e.g. the change the commit
+If in the middle of a bisect session, you know that the next suggested
+revision is not a good one to test (e.g. the change the commit
introduces is known not to work in your environment and you know it
does not have anything to do with the bug you are chasing), you may
-want to find a near-by commit and try that instead.
+want to find a nearby commit and try that instead.
-It goes something like this:
+For example:
------------
-$ git bisect good/bad # previous round was good/bad.
+$ git bisect good/bad # previous round was good or bad.
Bisecting: 337 revisions left to test after this
$ git bisect visualize # oops, that is uninteresting.
-$ git reset --hard HEAD~3 # try 3 revs before what
+$ git reset --hard HEAD~3 # try 3 revisions before what
# was suggested
------------
-Then compile and test the one you chose to try. After that, tell
-bisect what the result was as usual.
+Then compile and test the chosen revision. Afterwards the revision
+is marked as good or bad in the usual manner.
Bisect skip
~~~~~~~~~~~~
-Instead of choosing by yourself a nearby commit, you may just want git
-to do it for you using:
+Instead of choosing by yourself a nearby commit, you can ask git
+to do it for you by issuing the command:
------------
$ git bisect skip # Current version cannot be tested
------------
But computing the commit to test may be slower afterwards and git may
-eventually not be able to tell the first bad among a bad and one or
-more "skip"ped commits.
+eventually not be able to tell the first bad commit among a bad commit
+and one or more skipped commits.
You can even skip a range of commits, instead of just one commit,
using the "'<commit1>'..'<commit2>'" notation. For example:
@@ -174,30 +176,29 @@ $ git bisect skip v2.5..v2.6
would mean that no commit between `v2.5` excluded and `v2.6` included
can be tested.
-Note that if you want to also skip the first commit of a range you can
-use something like:
+Note that if you also want to skip the first commit of the range you
+would issue the command:
------------
$ git bisect skip v2.5 v2.5..v2.6
------------
-and the commit pointed to by `v2.5` will be skipped too.
+and the commit pointed to by `v2.5` would also be skipped.
Cutting down bisection by giving more parameters to bisect start
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can further cut down the number of trials if you know what part of
-the tree is involved in the problem you are tracking down, by giving
-paths parameters when you say `bisect start`, like this:
+You can further cut down the number of trials, if you know what part of
+the tree is involved in the problem you are tracking down, by specifying
+path parameters when issuing the `bisect start` command, like this:
------------
$ git bisect start -- arch/i386 include/asm-i386
------------
-If you know beforehand more than one good commits, you can narrow the
-bisect space down without doing the whole tree checkout every time you
-give good commits. You give the bad revision immediately after `start`
-and then you give all the good revisions you have:
+If you know beforehand more than one good commit, you can narrow the
+bisect space down by specifying all of the good commits immediately after
+the bad commit when issuing the `bisect start` command:
------------
$ git bisect start v2.6.20-rc6 v2.6.20-rc4 v2.6.20-rc1 --
@@ -209,38 +210,38 @@ Bisect run
~~~~~~~~~~
If you have a script that can tell if the current source code is good
-or bad, you can automatically bisect using:
+or bad, you can bisect by issuing the command:
------------
$ git bisect run my_script arguments
------------
-Note that the "run" script (`my_script` in the above example) should
-exit with code 0 in case the current source code is good. Exit with a
+Note that the script (`my_script` in the above example) should
+exit with code 0 if the current source code is good, and exit with a
code between 1 and 127 (inclusive), except 125, if the current
source code is bad.
-Any other exit code will abort the automatic bisect process. (A
-program that does "exit(-1)" leaves $? = 255, see exit(3) manual page,
-the value is chopped with "& 0377".)
+Any other exit code will abort the bisect process. It should be noted
+that a program that terminates via "exit(-1)" leaves $? = 255, (see the
+exit(3) manual page), as the value is chopped with "& 0377".
The special exit code 125 should be used when the current source code
-cannot be tested. If the "run" script exits with this code, the current
-revision will be skipped, see `git bisect skip` above.
+cannot be tested. If the script exits with this code, the current
+revision will be skipped (see `git bisect skip` above).
-You may often find that during bisect you want to have near-constant
-tweaks (e.g., s/#define DEBUG 0/#define DEBUG 1/ in a header file, or
-"revision that does not have this commit needs this patch applied to
-work around other problem this bisection is not interested in")
-applied to the revision being tested.
+You may often find that during a bisect session you want to have
+temporary modifications (e.g. s/#define DEBUG 0/#define DEBUG 1/ in a
+header file, or "revision that does not have this commit needs this
+patch applied to work around another problem this bisection is not
+interested in") applied to the revision being tested.
To cope with such a situation, after the inner 'git bisect' finds the
-next revision to test, with the "run" script, you can apply that tweak
-before compiling, run the real test, and after the test decides if the
-revision (possibly with the needed tweaks) passed the test, rewind the
-tree to the pristine state. Finally the "run" script can exit with
-the status of the real test to let the "git bisect run" command loop to
-determine the outcome.
+next revision to test, the script can apply the patch
+before compiling, run the real test, and afterwards decide if the
+revision (possibly with the needed patch) passed the test and then
+rewind the tree to the pristine state. Finally the script should exit
+with the status of the real test to let the "git bisect run" command loop
+determine the eventual outcome of the bisect session.
EXAMPLES
--------
@@ -264,39 +265,39 @@ $ git bisect run make test # "make test" builds and tests
------------
$ cat ~/test.sh
#!/bin/sh
-make || exit 125 # this "skip"s broken builds
+make || exit 125 # this skips broken builds
make test # "make test" runs the test suite
$ git bisect start v1.3 v1.1 -- # v1.3 is bad, v1.1 is good
$ git bisect run ~/test.sh
------------
+
Here we use a "test.sh" custom script. In this script, if "make"
-fails, we "skip" the current commit.
+fails, we skip the current commit.
+
-It's safer to use a custom script outside the repo to prevent
+It is safer to use a custom script outside the repository to prevent
interactions between the bisect, make and test processes and the
script.
+
-And "make test" should "exit 0", if the test suite passes, and
-"exit 1" (for example) otherwise.
+"make test" should "exit 0", if the test suite passes, and
+"exit 1" otherwise.
* Automatically bisect a broken test case:
+
------------
$ cat ~/test.sh
#!/bin/sh
-make || exit 125 # this "skip"s broken builds
+make || exit 125 # this skips broken builds
~/check_test_case.sh # does the test case passes ?
$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
$ git bisect run ~/test.sh
------------
+
-Here "check_test_case.sh" should "exit 0", if the test case passes,
-and "exit 1" (for example) otherwise.
+Here "check_test_case.sh" should "exit 0" if the test case passes,
+and "exit 1" otherwise.
+
-It's safer if both "test.sh" and "check_test_case.sh" scripts are
-outside the repo to prevent interactions between the bisect, make and
-test processes and the scripts.
+It is safer if both "test.sh" and "check_test_case.sh" scripts are
+outside the repository to prevent interactions between the bisect,
+make and test processes and the scripts.
* Automatically bisect a broken test suite:
+
--
1.6.2.1
^ permalink raw reply related
* Re: [PATCH] Define a version of lstat(2) specially for copy operation
From: Mark Levedahl @ 2009-03-18 3:17 UTC (permalink / raw)
To: git
In-Reply-To: <20090317213820.GC13458@blimp.localdomain>
Alex Riesen wrote:
> So that Cygwin port can continue work around its supporting
> library and get access to its faked file attributes.
>
> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
> ---
> Junio C Hamano, Tue, Mar 17, 2009 21:42:31 +0100:
>> But isn't this something shops that do deploy Cygwin version of git want
>> to see fixed, so that they can have a site-wide policy implemented in the
>
> Frankly, I doubt they know or care.
Please don't presume to speak for the world here. I have a not insignificant
group of users, many on Cygwin, and we depend upon identical behavior
between Linux and Cygwin versions of git. I maintain my own local build of
git for my group, among other reasons is to disable the non-Posix lstat
hack. Using the Win32 lstat does not speed up git that much (maybe 20-30%
in my experience) and this trade-off of compatibility vs being not quite so
dreadfully slow is certainly not worth it for me. (Obviously, others have a
different view, or this feature would not exist).
So, I strongly urge keeping the differences between POSIX/Linux git and
Cygwin git as minimal as possible.
Mark Levedahl
^ permalink raw reply
* Re: [PATCH 1/4] Documentation: minor grammatical fixes in git-archive.txt.
From: David J. Mellor @ 2009-03-18 2:54 UTC (permalink / raw)
To: Michael J Gruber; +Cc: gitster, git
In-Reply-To: <49BF6AD9.4020207@drmicha.warpmail.net>
On 03/17/2009 02:18 AM, Michael J Gruber wrote:
> One minor reoccurring issue is the following type of construct:
>
> ###
> The good/bad input is logged, and:
>
> ------------
> $ git bisect log
> ------------
>
> shows what you have done so far.
> ###
>
> The first line is not a complete sentence.
I agree. I will send a revised patch (patch 2 in this sequence) that
corrects this.
> Neither is the last one,
> which you have to read together with the code inset (that's fine), which
> on the other belongs to the sentence started in line 1.
>
> All of the above constitutes 1 sentence and should not be chopped in
> parts by the colon.
>
> I know this construct is somewhat common, but I don't think it is
> correct. In any case it disrupts the reading flow. [In fact, that
> disruption is the very reason why it is sometimes used in the middle of
> a written sentence: as a substitute for the rhetoric element "pause".]
I agree that it is probably not strictly correct, but this construct
appears frequently in the git documentation. My main concern with this
patch was to make the presentation of example command lines internally
consistent, if not strictly grammatically correct, i.e. some examples
were introduced following a colon, while others were not.
> In the example above your patch introduces it, in other places it has
> been used before. So this might my an opportunity to get rid of it
> consistently ;)
Go for it!
> Michael
>
David.
^ permalink raw reply
* Re: Local clone checks out wrong branch based on remote HEAD
From: Jeff King @ 2009-03-18 1:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Daniel Barkalow, Tom Preston-Werner, git
In-Reply-To: <7viqm7pvkl.fsf@gitster.siamese.dyndns.org>
On Tue, Mar 17, 2009 at 04:40:26PM -0700, Junio C Hamano wrote:
> The first round's protocol extension was not quite backward compatible
> but in a benign way, in that it did not break anything but induced a
> harmless warning from older ls-remote. The second round did not have such
> flaw but it got a "Yuck".
>
> From: Jeff King <peff@peff.net>
> Date: Mon, 1 Dec 2008 12:44:15 -0500
> Message-ID: <20081201174414.GA22185@coredump.intra.peff.net>
> Subject: Re: [PATCH 5/6 (v2)] upload-pack: send the HEAD information
>
> I somehow feel that the "Yuck" was addressed not to the patches but to the
> problem the patch needs to address.
Actually, you addressed my original "yuck" as it was a misunderstanding
on my part of how the protocol worked. I did lay out a few further
complaints in:
http://thread.gmane.org/gmane.comp.version-control.git/102039/focus=102070
To summarize, they were:
1. sending the server capabilities repeatedly
2. extensibility of this technique
3. handling empty clone
I think (1) is something we can just live with. It's a few dozen extra
bytes per symref line. But just look at all the crap a normal HTTP
request sends. ;)
For (2), I think it would work to simply define each NUL-separated field
after the first as an "extra info" slot, and put a header in that slot.
So send something like:
[0-9a-f]{40} HEAD\0<server capabilities>\0symref refs/heads/master\n
And as we add new "here is something extra about this ref" fields, they
get assigned new headers. Sadly it is too late to do such a thing for
the server capabilities slot, so slot 1 must remain there. But at least
we can keep it open for the future.
For (3), we would have to investigate how badly a 0{40} sha-1 break
current clients (which understand empty clone, but maybe not this new
"branch to be born" syntax). Or maybe it is OK to say "this is the new
way to do empty clone, and everything less than v1.6.3 will not be able
to handle your empty clone" (which is true for everything less than
v1.6.2 or so, anyway).
-Peff
^ permalink raw reply
* Re: [EGIT PATCH 01/25] Use generics for collections in commit dialog and import page
From: Shawn O. Pearce @ 2009-03-18 1:45 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237336849-2036-1-git-send-email-robin.rosenberg@dewire.com>
> Subject: Re: [EGIT PATCH 01/25] Use generics for collections in commit
..............................^^
Are there 24 remaining patches in this series? I only got this one.
--
Shawn.
^ permalink raw reply
* [JGIT PATCH 12/12] Implement git-core t/t6012-rev-list-simplify test case
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-12-git-send-email-spearce@spearce.org>
This test case provides a known graph and results that git-core has
been producing since Aug 3, 2008. Half of the test is commented out
as JGit does not produce the correct results, or does not support a
flag necessary to indicate how the results should be determined.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
As I said in the series cover letter, this test is more busted
then correct. I'm quite sure the test is right, and the JGit
library is wrong.
.../jgit/revwalk/RevWalkPathFilter6012Test.java | 162 ++++++++++++++++++++
1 files changed, 162 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java
new file mode 100644
index 0000000..b2fdb16
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.HashMap;
+
+import org.spearce.jgit.treewalk.filter.AndTreeFilter;
+import org.spearce.jgit.treewalk.filter.PathFilterGroup;
+import org.spearce.jgit.treewalk.filter.TreeFilter;
+
+// Note: Much of this test case is broken as it depends upon
+// the graph applying topological sorting *before* doing merge
+// simplification. It also depends upon a difference between
+// full history and non-full history for a path, something we
+// don't quite yet have a distiction for in JGit.
+//
+public class RevWalkPathFilter6012Test extends RevWalkTestCase {
+ private static final String pA = "pA", pF = "pF", pE = "pE";
+
+ private RevCommit a, b, c, d, e, f, g, h, i;
+
+ private HashMap<RevCommit, String> byName;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ // Test graph was stolen from git-core t6012-rev-list-simplify
+ // (by Junio C Hamano in 65347030590bcc251a9ff2ed96487a0f1b9e9fa8)
+ //
+ final RevBlob zF = blob("zF");
+ final RevBlob zH = blob("zH");
+ final RevBlob zI = blob("zI");
+ final RevBlob zS = blob("zS");
+ final RevBlob zY = blob("zY");
+
+ a = commit(tree(file(pF, zH)));
+ b = commit(tree(file(pF, zI)), a);
+ c = commit(tree(file(pF, zI)), a);
+ d = commit(tree(file(pA, zS), file(pF, zI)), c);
+ parse(d);
+ e = commit(d.getTree(), d, b);
+ f = commit(tree(file(pA, zS), file(pE, zY), file(pF, zI)), e);
+ parse(f);
+ g = commit(tree(file(pE, zY), file(pF, zI)), b);
+ h = commit(f.getTree(), g, f);
+ i = commit(tree(file(pA, zS), file(pE, zY), file(pF, zF)), h);
+
+ byName = new HashMap<RevCommit, String>();
+ for (Field z : RevWalkPathFilter6012Test.class.getDeclaredFields()) {
+ if (z.getType() == RevCommit.class)
+ byName.put((RevCommit) z.get(this), z.getName());
+ }
+ }
+
+ protected void check(final RevCommit... order) throws Exception {
+ markStart(i);
+ final StringBuilder act = new StringBuilder();
+ for (final RevCommit z : rw) {
+ final String name = byName.get(z);
+ assertNotNull(name);
+ act.append(name);
+ act.append(' ');
+ }
+ final StringBuilder exp = new StringBuilder();
+ for (final RevCommit z : order) {
+ final String name = byName.get(z);
+ assertNotNull(name);
+ exp.append(name);
+ exp.append(' ');
+ }
+ assertEquals(exp.toString(), act.toString());
+ }
+
+ protected void filter(final String path) {
+ rw.setTreeFilter(AndTreeFilter.create(PathFilterGroup
+ .createFromStrings(Collections.singleton(path)),
+ TreeFilter.ANY_DIFF));
+ }
+
+ public void test1() throws Exception {
+ // TODO --full-history
+ check(i, h, g, f, e, d, c, b, a);
+ }
+
+ public void test2() throws Exception {
+ // TODO --full-history
+ filter(pF);
+ // TODO fix broken test
+ // check(i, h, e, c, b, a);
+ }
+
+ public void test3() throws Exception {
+ // TODO --full-history
+ rw.sort(RevSort.TOPO);
+ filter(pF);
+ // TODO fix broken test
+ // check(i, h, e, c, b, a);
+ }
+
+ public void test4() throws Exception {
+ // TODO --full-history
+ rw.sort(RevSort.COMMIT_TIME_DESC);
+ filter(pF);
+ // TODO fix broken test
+ // check(i, h, e, c, b, a);
+ }
+
+ public void test5() throws Exception {
+ // TODO --simplify-merges
+ filter(pF);
+ // TODO fix broken test
+ // check(i, e, c, b, a);
+ }
+
+ public void test6() throws Exception {
+ filter(pF);
+ check(i, b, a);
+ }
+
+ public void test7() throws Exception {
+ rw.sort(RevSort.TOPO);
+ filter(pF);
+ check(i, b, a);
+ }
+}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 11/12] Add some basic logic tests for TreeFilter on RevWalk
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-11-git-send-email-spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../jgit/revwalk/RevWalkPathFilter1Test.java | 176 ++++++++++++++++++++
1 files changed, 176 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java
new file mode 100644
index 0000000..c74ab80
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+import java.util.Collections;
+
+import org.spearce.jgit.treewalk.filter.AndTreeFilter;
+import org.spearce.jgit.treewalk.filter.PathFilterGroup;
+import org.spearce.jgit.treewalk.filter.TreeFilter;
+
+public class RevWalkPathFilter1Test extends RevWalkTestCase {
+ protected void filter(final String path) {
+ rw.setTreeFilter(AndTreeFilter.create(PathFilterGroup
+ .createFromStrings(Collections.singleton(path)),
+ TreeFilter.ANY_DIFF));
+ }
+
+ public void testEmpty_EmptyTree() throws Exception {
+ final RevCommit a = commit();
+ filter("a");
+ markStart(a);
+ assertNull(rw.next());
+ }
+
+ public void testEmpty_NoMatch() throws Exception {
+ final RevCommit a = commit(tree(file("0", blob("0"))));
+ filter("a");
+ markStart(a);
+ assertNull(rw.next());
+ }
+
+ public void testSimple1() throws Exception {
+ final RevCommit a = commit(tree(file("0", blob("0"))));
+ filter("0");
+ markStart(a);
+ assertCommit(a, rw.next());
+ assertNull(rw.next());
+ }
+
+ public void testEdits_MatchNone() throws Exception {
+ final RevCommit a = commit(tree(file("0", blob("a"))));
+ final RevCommit b = commit(tree(file("0", blob("b"))), a);
+ final RevCommit c = commit(tree(file("0", blob("c"))), b);
+ final RevCommit d = commit(tree(file("0", blob("d"))), c);
+ filter("a");
+ markStart(d);
+ assertNull(rw.next());
+ }
+
+ public void testEdits_MatchAll() throws Exception {
+ final RevCommit a = commit(tree(file("0", blob("a"))));
+ final RevCommit b = commit(tree(file("0", blob("b"))), a);
+ final RevCommit c = commit(tree(file("0", blob("c"))), b);
+ final RevCommit d = commit(tree(file("0", blob("d"))), c);
+ filter("0");
+ markStart(d);
+ assertCommit(d, rw.next());
+ assertCommit(c, rw.next());
+ assertCommit(b, rw.next());
+ assertCommit(a, rw.next());
+ assertNull(rw.next());
+ }
+
+ public void testStringOfPearls_FilePath1() throws Exception {
+ final RevCommit a = commit(tree(file("d/f", blob("a"))));
+ final RevCommit b = commit(tree(file("d/f", blob("a"))), a);
+ final RevCommit c = commit(tree(file("d/f", blob("b"))), b);
+ filter("d/f");
+ markStart(c);
+
+ assertCommit(c, rw.next());
+ assertEquals(1, c.getParentCount());
+ assertCommit(a, c.getParent(0)); // b was skipped
+
+ assertCommit(a, rw.next());
+ assertEquals(0, a.getParentCount());
+ assertNull(rw.next());
+ }
+
+ public void testStringOfPearls_FilePath2() throws Exception {
+ final RevCommit a = commit(tree(file("d/f", blob("a"))));
+ final RevCommit b = commit(tree(file("d/f", blob("a"))), a);
+ final RevCommit c = commit(tree(file("d/f", blob("b"))), b);
+ final RevCommit d = commit(tree(file("d/f", blob("b"))), c);
+ filter("d/f");
+ markStart(d);
+
+ // d was skipped
+ assertCommit(c, rw.next());
+ assertEquals(1, c.getParentCount());
+ assertCommit(a, c.getParent(0)); // b was skipped
+
+ assertCommit(a, rw.next());
+ assertEquals(0, a.getParentCount());
+ assertNull(rw.next());
+ }
+
+ public void testStringOfPearls_DirPath2() throws Exception {
+ final RevCommit a = commit(tree(file("d/f", blob("a"))));
+ final RevCommit b = commit(tree(file("d/f", blob("a"))), a);
+ final RevCommit c = commit(tree(file("d/f", blob("b"))), b);
+ final RevCommit d = commit(tree(file("d/f", blob("b"))), c);
+ filter("d");
+ markStart(d);
+
+ // d was skipped
+ assertCommit(c, rw.next());
+ assertEquals(1, c.getParentCount());
+ assertCommit(a, c.getParent(0)); // b was skipped
+
+ assertCommit(a, rw.next());
+ assertEquals(0, a.getParentCount());
+ assertNull(rw.next());
+ }
+
+ public void testStringOfPearls_FilePath3() throws Exception {
+ final RevCommit a = commit(tree(file("d/f", blob("a"))));
+ final RevCommit b = commit(tree(file("d/f", blob("a"))), a);
+ final RevCommit c = commit(tree(file("d/f", blob("b"))), b);
+ final RevCommit d = commit(tree(file("d/f", blob("b"))), c);
+ final RevCommit e = commit(tree(file("d/f", blob("b"))), d);
+ final RevCommit f = commit(tree(file("d/f", blob("b"))), e);
+ final RevCommit g = commit(tree(file("d/f", blob("b"))), f);
+ final RevCommit h = commit(tree(file("d/f", blob("b"))), g);
+ final RevCommit i = commit(tree(file("d/f", blob("c"))), h);
+ filter("d/f");
+ markStart(i);
+
+ assertCommit(i, rw.next());
+ assertEquals(1, i.getParentCount());
+ assertCommit(c, i.getParent(0)); // h..d was skipped
+
+ assertCommit(c, rw.next());
+ assertEquals(1, c.getParentCount());
+ assertCommit(a, c.getParent(0)); // b was skipped
+
+ assertCommit(a, rw.next());
+ assertEquals(0, a.getParentCount());
+ assertNull(rw.next());
+ }
+}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 09/12] Add tests for basic RevObject methods related to type, flags
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-9-git-send-email-spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/RevObjectTest.java | 171 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/RevWalkTestCase.java | 18 ++
2 files changed, 189 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java
new file mode 100644
index 0000000..0eaafbf
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+import org.spearce.jgit.lib.AnyObjectId;
+import org.spearce.jgit.lib.Constants;
+
+public class RevObjectTest extends RevWalkTestCase {
+ public void testId() throws Exception {
+ final RevCommit a = commit();
+ assertSame(a, a.getId());
+ }
+
+ public void testEqualsIsIdentity() throws Exception {
+ final RevCommit a1 = commit();
+ final RevCommit b1 = commit();
+
+ assertTrue(a1.equals(a1));
+ assertTrue(a1.equals((Object) a1));
+ assertFalse(a1.equals(b1));
+
+ assertFalse(a1.equals(a1.copy()));
+ assertFalse(a1.equals((Object) a1.copy()));
+ assertFalse(a1.equals(""));
+
+ final RevWalk rw2 = new RevWalk(db);
+ final RevCommit a2 = rw2.parseCommit(a1);
+ final RevCommit b2 = rw2.parseCommit(b1);
+ assertNotSame(a1, a2);
+ assertNotSame(b1, b2);
+
+ assertFalse(a1.equals(a2));
+ assertFalse(b1.equals(b2));
+
+ assertEquals(a1.hashCode(), a2.hashCode());
+ assertEquals(b1.hashCode(), b2.hashCode());
+
+ assertTrue(AnyObjectId.equals(a1, a2));
+ assertTrue(AnyObjectId.equals(b1, b2));
+ }
+
+ public void testRevObjectTypes() throws Exception {
+ assertEquals(Constants.OBJ_TREE, emptyTree.getType());
+ assertEquals(Constants.OBJ_COMMIT, commit().getType());
+ assertEquals(Constants.OBJ_BLOB, blob("").getType());
+ assertEquals(Constants.OBJ_TAG, tag("emptyTree", emptyTree).getType());
+ }
+
+ public void testHasRevFlag() throws Exception {
+ final RevCommit a = commit();
+ assertFalse(a.has(RevFlag.UNINTERESTING));
+ a.flags |= RevWalk.UNINTERESTING;
+ assertTrue(a.has(RevFlag.UNINTERESTING));
+ }
+
+ public void testHasAnyFlag() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ final RevFlagSet s = new RevFlagSet();
+ s.add(flag1);
+ s.add(flag2);
+
+ assertFalse(a.hasAny(s));
+ a.flags |= flag1.mask;
+ assertTrue(a.hasAny(s));
+ }
+
+ public void testHasAllFlag() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ final RevFlagSet s = new RevFlagSet();
+ s.add(flag1);
+ s.add(flag2);
+
+ assertFalse(a.hasAll(s));
+ a.flags |= flag1.mask;
+ assertFalse(a.hasAll(s));
+ a.flags |= flag2.mask;
+ assertTrue(a.hasAll(s));
+ }
+
+ public void testAddRevFlag() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ assertEquals(0, a.flags);
+
+ a.add(flag1);
+ assertEquals(flag1.mask, a.flags);
+
+ a.add(flag2);
+ assertEquals(flag1.mask | flag2.mask, a.flags);
+ }
+
+ public void testAddRevFlagSet() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ final RevFlagSet s = new RevFlagSet();
+ s.add(flag1);
+ s.add(flag2);
+
+ assertEquals(0, a.flags);
+
+ a.add(s);
+ assertEquals(flag1.mask | flag2.mask, a.flags);
+ }
+
+ public void testRemoveRevFlag() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ a.add(flag1);
+ a.add(flag2);
+ assertEquals(flag1.mask | flag2.mask, a.flags);
+ a.remove(flag2);
+ assertEquals(flag1.mask, a.flags);
+ }
+
+ public void testRemoveRevFlagSet() throws Exception {
+ final RevCommit a = commit();
+ final RevFlag flag1 = rw.newFlag("flag1");
+ final RevFlag flag2 = rw.newFlag("flag2");
+ final RevFlag flag3 = rw.newFlag("flag3");
+ final RevFlagSet s = new RevFlagSet();
+ s.add(flag1);
+ s.add(flag2);
+ a.add(flag3);
+ a.add(s);
+ assertEquals(flag1.mask | flag2.mask | flag3.mask, a.flags);
+ a.remove(s);
+ assertEquals(flag3.mask, a.flags);
+ }
+}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
index f83be8d..501aa13 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
@@ -40,9 +40,11 @@
import java.util.Date;
import org.spearce.jgit.lib.Commit;
+import org.spearce.jgit.lib.Constants;
import org.spearce.jgit.lib.ObjectWriter;
import org.spearce.jgit.lib.PersonIdent;
import org.spearce.jgit.lib.RepositoryTestCase;
+import org.spearce.jgit.lib.Tag;
import org.spearce.jgit.lib.Tree;
/** Support for tests of the {@link RevWalk} class. */
@@ -67,6 +69,11 @@ protected void tick(final int secDelta) {
nowTick += secDelta * 1000L;
}
+ protected RevBlob blob(final String content) throws Exception {
+ return rw.lookupBlob(ow.writeBlob(content
+ .getBytes(Constants.CHARACTER_ENCODING)));
+ }
+
protected RevCommit commit(final RevCommit... parents) throws Exception {
return commit(1, parents);
}
@@ -83,6 +90,17 @@ protected RevCommit commit(final int secDelta, final RevCommit... parents)
return rw.lookupCommit(ow.writeCommit(c));
}
+ protected RevTag tag(final String name, final RevObject dst)
+ throws Exception {
+ final Tag t = new Tag(db);
+ t.setType(Constants.typeString(dst.getType()));
+ t.setObjId(dst.toObjectId());
+ t.setTag(name);
+ t.setTagger(new PersonIdent(jcommitter, new Date(nowTick)));
+ t.setMessage("");
+ return (RevTag) rw.lookupAny(ow.writeTag(t), Constants.OBJ_TAG);
+ }
+
protected <T extends RevObject> T parse(final T t) throws Exception {
rw.parse(t);
return t;
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 10/12] Add tests for ObjectWalk
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-10-git-send-email-spearce@spearce.org>
This covers most of the common operations in an ObjectWalk, such
as culling off a common base and any trees reachable from that
common base.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/ObjectWalkTest.java | 190 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/RevWalkTestCase.java | 64 +++++++-
2 files changed, 251 insertions(+), 3 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java
new file mode 100644
index 0000000..86f4277
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+public class ObjectWalkTest extends RevWalkTestCase {
+ protected ObjectWalk objw;
+
+ protected RevWalk createRevWalk() {
+ return objw = new ObjectWalk(db);
+ }
+
+ public void testNoCommits() throws Exception {
+ assertNull(objw.next());
+ assertNull(objw.nextObject());
+ }
+
+ public void testTwoCommitsEmptyTree() throws Exception {
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ markStart(b);
+
+ assertCommit(b, objw.next());
+ assertCommit(a, objw.next());
+ assertNull(objw.next());
+
+ assertSame(emptyTree, objw.nextObject());
+ assertNull(objw.nextObject());
+ }
+
+ public void testOneCommitOneTreeTwoBlob() throws Exception {
+ final RevBlob f0 = blob("0");
+ final RevBlob f1 = blob("1");
+ final RevTree t = tree(file("0", f0), file("1", f1), file("2", f1));
+ final RevCommit a = commit(t);
+ markStart(a);
+
+ assertCommit(a, objw.next());
+ assertNull(objw.next());
+
+ assertSame(t, objw.nextObject());
+ assertSame(f0, objw.nextObject());
+ assertSame(f1, objw.nextObject());
+ assertNull(objw.nextObject());
+ }
+
+ public void testTwoCommitTwoTreeTwoBlob() throws Exception {
+ final RevBlob f0 = blob("0");
+ final RevBlob f1 = blob("1");
+ final RevBlob f2 = blob("0v2");
+ final RevTree ta = tree(file("0", f0), file("1", f1), file("2", f1));
+ final RevTree tb = tree(file("0", f2), file("1", f1), file("2", f1));
+ final RevCommit a = commit(ta);
+ final RevCommit b = commit(tb, a);
+ markStart(b);
+
+ assertCommit(b, objw.next());
+ assertCommit(a, objw.next());
+ assertNull(objw.next());
+
+ assertSame(tb, objw.nextObject());
+ assertSame(f2, objw.nextObject());
+ assertSame(f1, objw.nextObject());
+
+ assertSame(ta, objw.nextObject());
+ assertSame(f0, objw.nextObject());
+
+ assertNull(objw.nextObject());
+ }
+
+ public void testTwoCommitDeepTree1() throws Exception {
+ final RevBlob f0 = blob("0");
+ final RevBlob f1 = blob("0v2");
+ final RevTree ta = tree(file("a/b/0", f0));
+ final RevTree tb = tree(file("a/b/1", f1));
+ final RevCommit a = commit(ta);
+ final RevCommit b = commit(tb, a);
+ markStart(b);
+
+ assertCommit(b, objw.next());
+ assertCommit(a, objw.next());
+ assertNull(objw.next());
+
+ assertSame(tb, objw.nextObject());
+ assertSame(get(tb, "a"), objw.nextObject());
+ assertSame(get(tb, "a/b"), objw.nextObject());
+ assertSame(f1, objw.nextObject());
+
+ assertSame(ta, objw.nextObject());
+ assertSame(get(ta, "a"), objw.nextObject());
+ assertSame(get(ta, "a/b"), objw.nextObject());
+ assertSame(f0, objw.nextObject());
+
+ assertNull(objw.nextObject());
+ }
+
+ public void testTwoCommitDeepTree2() throws Exception {
+ final RevBlob f1 = blob("1");
+ final RevTree ta = tree(file("a/b/0", f1), file("a/c/q", f1));
+ final RevTree tb = tree(file("a/b/1", f1), file("a/c/q", f1));
+ final RevCommit a = commit(ta);
+ final RevCommit b = commit(tb, a);
+ markStart(b);
+
+ assertCommit(b, objw.next());
+ assertCommit(a, objw.next());
+ assertNull(objw.next());
+
+ assertSame(tb, objw.nextObject());
+ assertSame(get(tb, "a"), objw.nextObject());
+ assertSame(get(tb, "a/b"), objw.nextObject());
+ assertSame(f1, objw.nextObject());
+ assertSame(get(tb, "a/c"), objw.nextObject());
+
+ assertSame(ta, objw.nextObject());
+ assertSame(get(ta, "a"), objw.nextObject());
+ assertSame(get(ta, "a/b"), objw.nextObject());
+
+ assertNull(objw.nextObject());
+ }
+
+ public void testCull() throws Exception {
+ final RevBlob f1 = blob("1");
+ final RevBlob f2 = blob("2");
+ final RevBlob f3 = blob("3");
+ final RevBlob f4 = blob("4");
+
+ final RevTree ta = tree(file("a/1", f1), file("c/3", f3));
+ final RevCommit a = commit(ta);
+
+ final RevTree tb = tree(file("a/1", f2), file("c/3", f3));
+ final RevCommit b1 = commit(tb, a);
+ final RevCommit b2 = commit(tb, b1);
+
+ final RevTree tc = tree(file("a/1", f4));
+ final RevCommit c1 = commit(tc, a);
+ final RevCommit c2 = commit(tc, c1);
+
+ markStart(b2);
+ markUninteresting(c2);
+
+ assertCommit(b2, objw.next());
+ assertCommit(b1, objw.next());
+ assertNull(objw.next());
+
+ assertTrue(a.has(RevFlag.UNINTERESTING));
+ assertTrue(ta.has(RevFlag.UNINTERESTING));
+ assertTrue(f1.has(RevFlag.UNINTERESTING));
+ assertTrue(f3.has(RevFlag.UNINTERESTING));
+
+ assertSame(tb, objw.nextObject());
+ assertSame(get(tb, "a"), objw.nextObject());
+ assertSame(f2, objw.nextObject());
+ assertNull(objw.nextObject());
+ }
+}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
index 501aa13..0a1e7b8 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
@@ -37,15 +37,23 @@
package org.spearce.jgit.revwalk;
+import java.util.Collections;
import java.util.Date;
+import org.spearce.jgit.dircache.DirCache;
+import org.spearce.jgit.dircache.DirCacheBuilder;
+import org.spearce.jgit.dircache.DirCacheEntry;
import org.spearce.jgit.lib.Commit;
import org.spearce.jgit.lib.Constants;
+import org.spearce.jgit.lib.FileMode;
+import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.lib.ObjectWriter;
import org.spearce.jgit.lib.PersonIdent;
import org.spearce.jgit.lib.RepositoryTestCase;
import org.spearce.jgit.lib.Tag;
import org.spearce.jgit.lib.Tree;
+import org.spearce.jgit.treewalk.TreeWalk;
+import org.spearce.jgit.treewalk.filter.PathFilterGroup;
/** Support for tests of the {@link RevWalk} class. */
public abstract class RevWalkTestCase extends RepositoryTestCase {
@@ -60,11 +68,15 @@
public void setUp() throws Exception {
super.setUp();
ow = new ObjectWriter(db);
- rw = new RevWalk(db);
+ rw = createRevWalk();
emptyTree = rw.parseTree(ow.writeTree(new Tree(db)));
nowTick = 1236977987000L;
}
+ protected RevWalk createRevWalk() {
+ return new RevWalk(db);
+ }
+
protected void tick(final int secDelta) {
nowTick += secDelta * 1000L;
}
@@ -74,15 +86,61 @@ protected RevBlob blob(final String content) throws Exception {
.getBytes(Constants.CHARACTER_ENCODING)));
}
+ protected DirCacheEntry file(final String path, final RevBlob blob)
+ throws Exception {
+ final DirCacheEntry e = new DirCacheEntry(path);
+ e.setFileMode(FileMode.REGULAR_FILE);
+ e.setObjectId(blob);
+ return e;
+ }
+
+ protected RevTree tree(final DirCacheEntry... entries) throws Exception {
+ final DirCache dc = DirCache.newInCore();
+ final DirCacheBuilder b = dc.builder();
+ for (final DirCacheEntry e : entries)
+ b.add(e);
+ b.finish();
+ return rw.lookupTree(dc.writeTree(ow));
+ }
+
+ protected RevObject get(final RevTree tree, final String path)
+ throws Exception {
+ final TreeWalk tw = new TreeWalk(db);
+ tw.setFilter(PathFilterGroup.createFromStrings(Collections
+ .singleton(path)));
+ tw.reset(tree);
+ while (tw.next()) {
+ if (tw.isSubtree() && !path.equals(tw.getPathString())) {
+ tw.enterSubtree();
+ continue;
+ }
+ final ObjectId entid = tw.getObjectId(0);
+ final FileMode entmode = tw.getFileMode(0);
+ return rw.lookupAny(entid, entmode.getObjectType());
+ }
+ fail("Can't find " + path + " in tree " + tree.name());
+ return null; // never reached.
+ }
+
protected RevCommit commit(final RevCommit... parents) throws Exception {
- return commit(1, parents);
+ return commit(1, emptyTree, parents);
+ }
+
+ protected RevCommit commit(final RevTree tree, final RevCommit... parents)
+ throws Exception {
+ return commit(1, tree, parents);
}
protected RevCommit commit(final int secDelta, final RevCommit... parents)
throws Exception {
+ return commit(secDelta, emptyTree, parents);
+ }
+
+ protected RevCommit commit(final int secDelta, final RevTree tree,
+ final RevCommit... parents) throws Exception {
tick(secDelta);
final Commit c = new Commit(db);
- c.setTreeId(emptyTree);
+ c.setTreeId(tree);
c.setParentIds(parents);
c.setAuthor(new PersonIdent(jauthor, new Date(nowTick)));
c.setCommitter(new PersonIdent(jcommitter, new Date(nowTick)));
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 07/12] Add unit tests for LIFORevQueue
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-7-git-send-email-spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/LIFORevQueueTest.java | 69 ++++++++++++++++++++
1 files changed, 69 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java
new file mode 100644
index 0000000..b1ce5fa
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class LIFORevQueueTest extends RevQueueTestCase<LIFORevQueue> {
+ protected LIFORevQueue create() {
+ return new LIFORevQueue();
+ }
+
+ public void testEmpty() throws Exception {
+ super.testEmpty();
+ assertEquals(0, q.outputType());
+ }
+
+ public void testCloneEmpty() throws Exception {
+ q = new LIFORevQueue(AbstractRevQueue.EMPTY_QUEUE);
+ assertNull(q.next());
+ }
+
+ public void testAddLargeBlocks() throws Exception {
+ final ArrayList<RevCommit> lst = new ArrayList<RevCommit>();
+ for (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) {
+ final RevCommit c = commit();
+ lst.add(c);
+ q.add(c);
+ }
+ Collections.reverse(lst);
+ for (int i = 0; i < lst.size(); i++)
+ assertSame(lst.get(i), q.next());
+ }
+}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 08/12] Add unit tests for AbstractRevQueue.EMPTY_QUEUE
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-8-git-send-email-spearce@spearce.org>
Also fix anybodyHasFlag() to return false, as the queue is empty,
and thus nobody has that flag. This matches the behavior of the
other queue types.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../jgit/revwalk/AlwaysEmptyRevQueueTest.java | 63 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/AbstractRevQueue.java | 2 +-
2 files changed, 64 insertions(+), 1 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java
new file mode 100644
index 0000000..94edd0a
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+public class AlwaysEmptyRevQueueTest extends RevWalkTestCase {
+ private final AbstractRevQueue q = AbstractRevQueue.EMPTY_QUEUE;
+
+ public void testEmpty() throws Exception {
+ assertNull(q.next());
+ assertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+ assertEquals(0, q.outputType());
+ }
+
+ public void testClear() throws Exception {
+ q.clear();
+ testEmpty();
+ }
+
+ public void testAddFails() throws Exception {
+ try {
+ q.add(commit());
+ fail("Did not throw UnsupportedOperationException");
+ } catch (UnsupportedOperationException e) {
+ // expected result
+ }
+ }
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java
index 5bb969d..9a6bf81 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java
@@ -133,7 +133,7 @@ public RevCommit next() {
@Override
boolean anybodyHasFlag(int f) {
- return true;
+ return false;
}
@Override
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 06/12] Add unit tests for FIFORevQueue
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-6-git-send-email-spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/FIFORevQueueTest.java | 81 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/BlockRevQueue.java | 2 +-
2 files changed, 82 insertions(+), 1 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java
new file mode 100644
index 0000000..99ee031
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+import java.util.ArrayList;
+
+public class FIFORevQueueTest extends RevQueueTestCase<FIFORevQueue> {
+ protected FIFORevQueue create() {
+ return new FIFORevQueue();
+ }
+
+ public void testEmpty() throws Exception {
+ super.testEmpty();
+ assertEquals(0, q.outputType());
+ }
+
+ public void testCloneEmpty() throws Exception {
+ q = new FIFORevQueue(AbstractRevQueue.EMPTY_QUEUE);
+ assertNull(q.next());
+ }
+
+ public void testAddLargeBlocks() throws Exception {
+ final ArrayList<RevCommit> lst = new ArrayList<RevCommit>();
+ for (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) {
+ final RevCommit c = commit();
+ lst.add(c);
+ q.add(c);
+ }
+ for (int i = 0; i < lst.size(); i++)
+ assertSame(lst.get(i), q.next());
+ }
+
+ public void testUnpopAtFront() throws Exception {
+ final RevCommit a = commit();
+ final RevCommit b = commit();
+ final RevCommit c = commit();
+
+ q.add(a);
+ q.unpop(b);
+ q.unpop(c);
+
+ assertSame(c, q.next());
+ assertSame(b, q.next());
+ assertSame(a, q.next());
+ }
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java
index 9660de8..8c0e46d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/BlockRevQueue.java
@@ -104,7 +104,7 @@ void clear() {
}
static final class Block {
- private static final int BLOCK_SIZE = 256;
+ static final int BLOCK_SIZE = 256;
/** Next block in our chain of blocks; null if we are the last. */
Block next;
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 05/12] Add unit tests for DateRevQueue
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-5-git-send-email-spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/DateRevQueueTest.java | 118 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/RevQueueTestCase.java | 85 ++++++++++++++
2 files changed, 203 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java
new file mode 100644
index 0000000..c29fd55
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+public class DateRevQueueTest extends RevQueueTestCase<DateRevQueue> {
+ protected DateRevQueue create() {
+ return new DateRevQueue();
+ }
+
+ public void testEmpty() throws Exception {
+ super.testEmpty();
+ assertNull(q.peek());
+ assertEquals(Generator.SORT_COMMIT_TIME_DESC, q.outputType());
+ }
+
+ public void testCloneEmpty() throws Exception {
+ q = new DateRevQueue(AbstractRevQueue.EMPTY_QUEUE);
+ assertNull(q.next());
+ }
+
+ public void testInsertOutOfOrder() throws Exception {
+ final RevCommit a = parse(commit());
+ final RevCommit b = parse(commit(10, a));
+ final RevCommit c1 = parse(commit(5, b));
+ final RevCommit c2 = parse(commit(-50, b));
+
+ q.add(c2);
+ q.add(a);
+ q.add(b);
+ q.add(c1);
+
+ assertCommit(c1, q.next());
+ assertCommit(b, q.next());
+ assertCommit(a, q.next());
+ assertCommit(c2, q.next());
+ assertNull(q.next());
+ }
+
+ public void testInsertTie() throws Exception {
+ final RevCommit a = parse(commit());
+ final RevCommit b = parse(commit(0, a));
+ {
+ q = create();
+ q.add(a);
+ q.add(b);
+
+ assertCommit(a, q.next());
+ assertCommit(b, q.next());
+ assertNull(q.next());
+ }
+ {
+ q = create();
+ q.add(b);
+ q.add(a);
+
+ assertCommit(b, q.next());
+ assertCommit(a, q.next());
+ assertNull(q.next());
+ }
+ }
+
+ public void testCloneFIFO() throws Exception {
+ final RevCommit a = parse(commit());
+ final RevCommit b = parse(commit(200, a));
+ final RevCommit c = parse(commit(200, b));
+
+ final FIFORevQueue src = new FIFORevQueue();
+ src.add(a);
+ src.add(b);
+ src.add(c);
+
+ q = new DateRevQueue(src);
+ assertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+ assertCommit(c, q.peek());
+ assertCommit(c, q.peek());
+
+ assertCommit(c, q.next());
+ assertCommit(b, q.next());
+ assertCommit(a, q.next());
+ assertNull(q.next());
+ }
+}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java
new file mode 100644
index 0000000..8b379d6
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.revwalk;
+
+public abstract class RevQueueTestCase<T extends AbstractRevQueue> extends
+ RevWalkTestCase {
+ protected T q;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ q = create();
+ }
+
+ protected abstract T create();
+
+ public void testEmpty() throws Exception {
+ assertNull(q.next());
+ assertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+ }
+
+ public void testClear() throws Exception {
+ final RevCommit a = parse(commit());
+ final RevCommit b = parse(commit(a));
+
+ q.add(a);
+ q.add(b);
+ q.clear();
+ assertNull(q.next());
+ }
+
+ public void testHasFlags() throws Exception {
+ final RevCommit a = parse(commit());
+ final RevCommit b = parse(commit(a));
+
+ q.add(a);
+ q.add(b);
+
+ assertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+
+ a.flags |= RevWalk.UNINTERESTING;
+ assertFalse(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertTrue(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+
+ b.flags |= RevWalk.UNINTERESTING;
+ assertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));
+ assertTrue(q.anybodyHasFlag(RevWalk.UNINTERESTING));
+ }
+}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 04/12] Test that RevFilter.MERGE_BASE cannot use a TreeFilter
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-4-git-send-email-spearce@spearce.org>
Only TreeFilter.ALL is permitted right now when computing a merge
base, as the generator pipeline doesn't support parent rewrites
during a merge base computation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../spearce/jgit/revwalk/RevWalkMergeBaseTest.java | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
index fc1a37c..c8fdf5e 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -38,6 +38,7 @@
package org.spearce.jgit.revwalk;
import org.spearce.jgit.revwalk.filter.RevFilter;
+import org.spearce.jgit.treewalk.filter.TreeFilter;
public class RevWalkMergeBaseTest extends RevWalkTestCase {
public void testNone() throws Exception {
@@ -50,6 +51,22 @@ public void testNone() throws Exception {
assertNull(rw.next());
}
+ public void testDisallowTreeFilter() throws Exception {
+ final RevCommit c1 = commit();
+ final RevCommit c2 = commit();
+
+ rw.setRevFilter(RevFilter.MERGE_BASE);
+ rw.setTreeFilter(TreeFilter.ANY_DIFF);
+ markStart(c1);
+ markStart(c2);
+ try {
+ assertNull(rw.next());
+ fail("did not throw IllegalStateException");
+ } catch (IllegalStateException ise) {
+ // expected result
+ }
+ }
+
public void testSimple() throws Exception {
final RevCommit a = commit();
final RevCommit b = commit(a);
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 03/12] Change RevWalkTestCase to use RevCommit, not ObjectId
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-3-git-send-email-spearce@spearce.org>
We build a RevWalk once per test, and only execute a single traversal
in that test run. Its more clear to use the RevCommit type from that
object pool to represent a commit entity than the generic ObjectId.
When creating a new commit we allocate its RevCommit from the pool,
but we delay parsing until as late as necessary. This is needed for
at least one test where it validates whether or not the parents of a
commit were allocated after traversal finishes.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/RevWalkCullTest.java | 28 +++---
.../spearce/jgit/revwalk/RevWalkFilterTest.java | 91 ++++++++++----------
.../spearce/jgit/revwalk/RevWalkMergeBaseTest.java | 45 +++++-----
.../org/spearce/jgit/revwalk/RevWalkSortTest.java | 64 +++++++-------
.../org/spearce/jgit/revwalk/RevWalkTestCase.java | 30 +++---
5 files changed, 126 insertions(+), 132 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
index e734273..2f61598 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
@@ -37,8 +37,6 @@
package org.spearce.jgit.revwalk;
-import org.spearce.jgit.lib.ObjectId;
-
public class RevWalkCullTest extends RevWalkTestCase {
public void testProperlyCullAllAncestors1() throws Exception {
// Credit goes to Junio C Hamano <gitster@pobox.com> for this
@@ -46,10 +44,10 @@ public void testProperlyCullAllAncestors1() throws Exception {
//
// We induce a clock skew so two is dated before one.
//
- final ObjectId a = commit();
- final ObjectId b = commit(-2400, a);
- final ObjectId c = commit(b);
- final ObjectId d = commit(c);
+ final RevCommit a = commit();
+ final RevCommit b = commit(-2400, a);
+ final RevCommit c = commit(b);
+ final RevCommit d = commit(c);
markStart(a);
markUninteresting(d);
@@ -60,11 +58,11 @@ public void testProperlyCullAllAncestors2() throws Exception {
// Despite clock skew on c1 being very old it should not
// produce, neither should a or b, or any part of that chain.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(-5, b);
- final ObjectId c2 = commit(10, b);
- final ObjectId d = commit(c1, c2);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(-5, b);
+ final RevCommit c2 = commit(10, b);
+ final RevCommit d = commit(c1, c2);
markStart(d);
markUninteresting(c1);
@@ -74,14 +72,14 @@ public void testProperlyCullAllAncestors2() throws Exception {
}
public void testProperlyCullAllAncestors_LongHistory() throws Exception {
- final ObjectId a = commit();
- ObjectId b = commit(a);
+ final RevCommit a = commit();
+ RevCommit b = commit(a);
for (int i = 0; i < 24; i++) {
b = commit(b);
if ((i & 2) == 0)
markUninteresting(b);
}
- final ObjectId c = commit(b);
+ final RevCommit c = commit(b);
markStart(c);
markUninteresting(b);
@@ -91,6 +89,6 @@ public void testProperlyCullAllAncestors_LongHistory() throws Exception {
// We should have aborted before we got back so far that "a"
// would be parsed. Thus, its parents shouldn't be allocated.
//
- assertNull(rw.lookupCommit(a).parents);
+ assertNull(a.parents);
}
}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
index d079bdc..6a26d2e 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
@@ -42,7 +42,6 @@
import org.spearce.jgit.errors.IncorrectObjectTypeException;
import org.spearce.jgit.errors.MissingObjectException;
import org.spearce.jgit.errors.StopWalkException;
-import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.revwalk.filter.AndRevFilter;
import org.spearce.jgit.revwalk.filter.NotRevFilter;
import org.spearce.jgit.revwalk.filter.OrRevFilter;
@@ -52,9 +51,9 @@
private static final MyAll MY_ALL = new MyAll();
public void testFilter_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(RevFilter.ALL);
markStart(c);
@@ -65,9 +64,9 @@ public void testFilter_ALL() throws Exception {
}
public void testFilter_Negate_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(RevFilter.ALL.negate());
markStart(c);
@@ -75,9 +74,9 @@ public void testFilter_Negate_ALL() throws Exception {
}
public void testFilter_NOT_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(NotRevFilter.create(RevFilter.ALL));
markStart(c);
@@ -85,9 +84,9 @@ public void testFilter_NOT_ALL() throws Exception {
}
public void testFilter_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(RevFilter.NONE);
markStart(c);
@@ -95,9 +94,9 @@ public void testFilter_NONE() throws Exception {
}
public void testFilter_NOT_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(NotRevFilter.create(RevFilter.NONE));
markStart(c);
@@ -108,9 +107,9 @@ public void testFilter_NOT_NONE() throws Exception {
}
public void testFilter_ALL_And_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(AndRevFilter.create(RevFilter.ALL, RevFilter.NONE));
markStart(c);
@@ -118,9 +117,9 @@ public void testFilter_ALL_And_NONE() throws Exception {
}
public void testFilter_NONE_And_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(AndRevFilter.create(RevFilter.NONE, RevFilter.ALL));
markStart(c);
@@ -128,9 +127,9 @@ public void testFilter_NONE_And_ALL() throws Exception {
}
public void testFilter_ALL_Or_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(OrRevFilter.create(RevFilter.ALL, RevFilter.NONE));
markStart(c);
@@ -141,9 +140,9 @@ public void testFilter_ALL_Or_NONE() throws Exception {
}
public void testFilter_NONE_Or_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(OrRevFilter.create(RevFilter.NONE, RevFilter.ALL));
markStart(c);
@@ -154,9 +153,9 @@ public void testFilter_NONE_Or_ALL() throws Exception {
}
public void testFilter_MY_ALL_And_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(AndRevFilter.create(MY_ALL, RevFilter.NONE));
markStart(c);
@@ -164,9 +163,9 @@ public void testFilter_MY_ALL_And_NONE() throws Exception {
}
public void testFilter_NONE_And_MY_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(AndRevFilter.create(RevFilter.NONE, MY_ALL));
markStart(c);
@@ -174,9 +173,9 @@ public void testFilter_NONE_And_MY_ALL() throws Exception {
}
public void testFilter_MY_ALL_Or_NONE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(OrRevFilter.create(MY_ALL, RevFilter.NONE));
markStart(c);
@@ -187,9 +186,9 @@ public void testFilter_MY_ALL_Or_NONE() throws Exception {
}
public void testFilter_NONE_Or_MY_ALL() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
rw.setRevFilter(OrRevFilter.create(RevFilter.NONE, MY_ALL));
markStart(c);
@@ -200,12 +199,12 @@ public void testFilter_NONE_Or_MY_ALL() throws Exception {
}
public void testFilter_NO_MERGES() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(b);
- final ObjectId c2 = commit(b);
- final ObjectId d = commit(c1, c2);
- final ObjectId e = commit(d);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(b);
+ final RevCommit c2 = commit(b);
+ final RevCommit d = commit(c1, c2);
+ final RevCommit e = commit(d);
rw.setRevFilter(RevFilter.NO_MERGES);
markStart(e);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
index cec4e3f..fc1a37c 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -37,13 +37,12 @@
package org.spearce.jgit.revwalk;
-import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.revwalk.filter.RevFilter;
public class RevWalkMergeBaseTest extends RevWalkTestCase {
public void testNone() throws Exception {
- final ObjectId c1 = commit(commit(commit()));
- final ObjectId c2 = commit(commit(commit()));
+ final RevCommit c1 = commit(commit(commit()));
+ final RevCommit c2 = commit(commit(commit()));
rw.setRevFilter(RevFilter.MERGE_BASE);
markStart(c1);
@@ -52,10 +51,10 @@ public void testNone() throws Exception {
}
public void testSimple() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(commit(commit(commit(commit(b)))));
- final ObjectId c2 = commit(commit(commit(commit(commit(b)))));
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(commit(commit(commit(commit(b)))));
+ final RevCommit c2 = commit(commit(commit(commit(commit(b)))));
rw.setRevFilter(RevFilter.MERGE_BASE);
markStart(c1);
@@ -65,11 +64,11 @@ public void testSimple() throws Exception {
}
public void testMultipleHeads_SameBase1() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(commit(commit(commit(commit(b)))));
- final ObjectId c2 = commit(commit(commit(commit(commit(b)))));
- final ObjectId c3 = commit(commit(commit(b)));
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(commit(commit(commit(commit(b)))));
+ final RevCommit c2 = commit(commit(commit(commit(commit(b)))));
+ final RevCommit c3 = commit(commit(commit(b)));
rw.setRevFilter(RevFilter.MERGE_BASE);
markStart(c1);
@@ -80,12 +79,12 @@ public void testMultipleHeads_SameBase1() throws Exception {
}
public void testMultipleHeads_SameBase2() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
- final ObjectId d1 = commit(commit(commit(commit(commit(b)))));
- final ObjectId d2 = commit(commit(commit(commit(commit(c)))));
- final ObjectId d3 = commit(commit(commit(c)));
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
+ final RevCommit d1 = commit(commit(commit(commit(commit(b)))));
+ final RevCommit d2 = commit(commit(commit(commit(commit(c)))));
+ final RevCommit d3 = commit(commit(commit(c)));
rw.setRevFilter(RevFilter.MERGE_BASE);
markStart(d1);
@@ -101,11 +100,11 @@ public void testCrissCross() throws Exception {
// clean merge base for d,e as they each merged the parents b,c
// in different orders.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(a);
- final ObjectId d = commit(b, c);
- final ObjectId e = commit(c, b);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(a);
+ final RevCommit d = commit(b, c);
+ final RevCommit e = commit(c, b);
rw.setRevFilter(RevFilter.MERGE_BASE);
markStart(d);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
index 3ed1565..7435197 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
@@ -37,14 +37,12 @@
package org.spearce.jgit.revwalk;
-import org.spearce.jgit.lib.ObjectId;
-
public class RevWalkSortTest extends RevWalkTestCase {
public void testSort_Default() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(1, a);
- final ObjectId c = commit(1, b);
- final ObjectId d = commit(1, c);
+ final RevCommit a = commit();
+ final RevCommit b = commit(1, a);
+ final RevCommit c = commit(1, b);
+ final RevCommit d = commit(1, c);
markStart(d);
assertCommit(d, rw.next());
@@ -55,10 +53,10 @@ public void testSort_Default() throws Exception {
}
public void testSort_COMMIT_TIME_DESC() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
- final ObjectId d = commit(c);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
+ final RevCommit d = commit(c);
rw.sort(RevSort.COMMIT_TIME_DESC);
markStart(d);
@@ -70,10 +68,10 @@ public void testSort_COMMIT_TIME_DESC() throws Exception {
}
public void testSort_REVERSE() throws Exception {
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(b);
- final ObjectId d = commit(c);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(b);
+ final RevCommit d = commit(c);
rw.sort(RevSort.REVERSE);
markStart(d);
@@ -88,10 +86,10 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {
// Despite being out of order time-wise, a strand-of-pearls must
// still maintain topological order.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c = commit(-5, b);
- final ObjectId d = commit(10, c);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c = commit(-5, b);
+ final RevCommit d = commit(10, c);
assertTrue(parse(a).getCommitTime() < parse(d).getCommitTime());
assertTrue(parse(c).getCommitTime() < parse(b).getCommitTime());
@@ -107,11 +105,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder1() throws Exception {
public void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {
// c1 is back dated before its parent.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(-5, b);
- final ObjectId c2 = commit(10, b);
- final ObjectId d = commit(c1, c2);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(-5, b);
+ final RevCommit c2 = commit(10, b);
+ final RevCommit d = commit(c1, c2);
rw.sort(RevSort.COMMIT_TIME_DESC);
markStart(d);
@@ -126,11 +124,11 @@ public void testSort_COMMIT_TIME_DESC_OutOfOrder2() throws Exception {
public void testSort_TOPO() throws Exception {
// c1 is back dated before its parent.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(-5, b);
- final ObjectId c2 = commit(10, b);
- final ObjectId d = commit(c1, c2);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(-5, b);
+ final RevCommit c2 = commit(10, b);
+ final RevCommit d = commit(c1, c2);
rw.sort(RevSort.TOPO);
markStart(d);
@@ -145,11 +143,11 @@ public void testSort_TOPO() throws Exception {
public void testSort_TOPO_REVERSE() throws Exception {
// c1 is back dated before its parent.
//
- final ObjectId a = commit();
- final ObjectId b = commit(a);
- final ObjectId c1 = commit(-5, b);
- final ObjectId c2 = commit(10, b);
- final ObjectId d = commit(c1, c2);
+ final RevCommit a = commit();
+ final RevCommit b = commit(a);
+ final RevCommit c1 = commit(-5, b);
+ final RevCommit c2 = commit(10, b);
+ final RevCommit d = commit(c1, c2);
rw.sort(RevSort.TOPO);
rw.sort(RevSort.REVERSE, true);
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
index a477be9..f83be8d 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
@@ -40,7 +40,6 @@
import java.util.Date;
import org.spearce.jgit.lib.Commit;
-import org.spearce.jgit.lib.ObjectId;
import org.spearce.jgit.lib.ObjectWriter;
import org.spearce.jgit.lib.PersonIdent;
import org.spearce.jgit.lib.RepositoryTestCase;
@@ -50,7 +49,7 @@
public abstract class RevWalkTestCase extends RepositoryTestCase {
protected ObjectWriter ow;
- protected ObjectId emptyTree;
+ protected RevTree emptyTree;
protected long nowTick;
@@ -59,20 +58,20 @@
public void setUp() throws Exception {
super.setUp();
ow = new ObjectWriter(db);
- emptyTree = ow.writeTree(new Tree(db));
- nowTick = 1236977987000L;
rw = new RevWalk(db);
+ emptyTree = rw.parseTree(ow.writeTree(new Tree(db)));
+ nowTick = 1236977987000L;
}
protected void tick(final int secDelta) {
nowTick += secDelta * 1000L;
}
- protected ObjectId commit(final ObjectId... parents) throws Exception {
+ protected RevCommit commit(final RevCommit... parents) throws Exception {
return commit(1, parents);
}
- protected ObjectId commit(final int secDelta, final ObjectId... parents)
+ protected RevCommit commit(final int secDelta, final RevCommit... parents)
throws Exception {
tick(secDelta);
final Commit c = new Commit(db);
@@ -81,22 +80,23 @@ protected ObjectId commit(final int secDelta, final ObjectId... parents)
c.setAuthor(new PersonIdent(jauthor, new Date(nowTick)));
c.setCommitter(new PersonIdent(jcommitter, new Date(nowTick)));
c.setMessage("");
- return ow.writeCommit(c);
+ return rw.lookupCommit(ow.writeCommit(c));
}
- protected RevCommit parse(final ObjectId commitId) throws Exception {
- return rw.parseCommit(commitId);
+ protected <T extends RevObject> T parse(final T t) throws Exception {
+ rw.parse(t);
+ return t;
}
- protected void markStart(final ObjectId commitId) throws Exception {
- rw.markStart(parse(commitId));
+ protected void markStart(final RevCommit commit) throws Exception {
+ rw.markStart(commit);
}
- protected void markUninteresting(final ObjectId commitId) throws Exception {
- rw.markUninteresting(parse(commitId));
+ protected void markUninteresting(final RevCommit commit) throws Exception {
+ rw.markUninteresting(commit);
}
- protected void assertCommit(final ObjectId commitId, final RevCommit commit) {
- assertEquals(commitId.name(), commit != null ? commit.name() : null);
+ protected void assertCommit(final RevCommit exp, final RevCommit act) {
+ assertSame(exp, act);
}
}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 02/12] Mark non-overridable methods of RevObject final
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-2-git-send-email-spearce@spearce.org>
There isn't a huge benefit to allowing these methods to be overridden,
and subclasses might actually screw them up given that flags is only
visible within our package. Mark them all final instead.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../src/org/spearce/jgit/revwalk/RevObject.java | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
index 8c7cc23..e8fb29f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
@@ -70,17 +70,17 @@ abstract void parse(RevWalk walk) throws MissingObjectException,
*
* @return unique hash of this object.
*/
- public ObjectId getId() {
+ public final ObjectId getId() {
return this;
}
@Override
- public boolean equals(final ObjectId o) {
+ public final boolean equals(final ObjectId o) {
return this == o;
}
@Override
- public boolean equals(final Object o) {
+ public final boolean equals(final Object o) {
return this == o;
}
@@ -91,7 +91,7 @@ public boolean equals(final Object o) {
* the flag to test.
* @return true if the flag has been added to this object; false if not.
*/
- public boolean has(final RevFlag flag) {
+ public final boolean has(final RevFlag flag) {
return (flags & flag.mask) != 0;
}
@@ -103,7 +103,7 @@ public boolean has(final RevFlag flag) {
* @return true if any flag in the set has been added to this object; false
* if not.
*/
- public boolean hasAny(final RevFlagSet set) {
+ public final boolean hasAny(final RevFlagSet set) {
return (flags & set.mask) != 0;
}
@@ -115,7 +115,7 @@ public boolean hasAny(final RevFlagSet set) {
* @return true if all flags of the set have been added to this object;
* false if some or none have been added.
*/
- public boolean hasAll(final RevFlagSet set) {
+ public final boolean hasAll(final RevFlagSet set) {
return (flags & set.mask) == set.mask;
}
@@ -127,7 +127,7 @@ public boolean hasAll(final RevFlagSet set) {
* @param flag
* the flag to mark on this object, for later testing.
*/
- public void add(final RevFlag flag) {
+ public final void add(final RevFlag flag) {
flags |= flag.mask;
}
@@ -137,7 +137,7 @@ public void add(final RevFlag flag) {
* @param set
* the set of flags to mark on this object, for later testing.
*/
- public void add(final RevFlagSet set) {
+ public final void add(final RevFlagSet set) {
flags |= set.mask;
}
@@ -149,7 +149,7 @@ public void add(final RevFlagSet set) {
* @param flag
* the flag to remove from this object.
*/
- public void remove(final RevFlag flag) {
+ public final void remove(final RevFlag flag) {
flags &= ~flag.mask;
}
@@ -159,7 +159,7 @@ public void remove(final RevFlag flag) {
* @param set
* the flag to remove from this object.
*/
- public void remove(final RevFlagSet set) {
+ public final void remove(final RevFlagSet set) {
flags &= ~set.mask;
}
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 01/12] Fix copyright year in revwalk test file headers
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <1237340451-31562-1-git-send-email-spearce@spearce.org>
These were all created in 2009, not 2008.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../org/spearce/jgit/revwalk/RevFlagSetTest.java | 2 +-
.../org/spearce/jgit/revwalk/RevWalkCullTest.java | 2 +-
.../spearce/jgit/revwalk/RevWalkFilterTest.java | 2 +-
.../spearce/jgit/revwalk/RevWalkMergeBaseTest.java | 2 +-
.../org/spearce/jgit/revwalk/RevWalkSortTest.java | 2 +-
.../org/spearce/jgit/revwalk/RevWalkTestCase.java | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java
index 76f3cbb..ff02d64 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevFlagSetTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
index 93bd645..e734273 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkCullTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
index cf2975d..d079bdc 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkFilterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
index b05e774..cec4e3f 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkMergeBaseTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
index 6f2eedc..3ed1565 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkSortTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
index bd696dd..a477be9 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, Google Inc.
+ * Copyright (C) 2009, Google Inc.
*
* All rights reserved.
*
--
1.6.2.1.286.g8173
^ permalink raw reply related
* [JGIT PATCH 00/12] Improve test coverage in revwalk
From: Shawn O. Pearce @ 2009-03-18 1:40 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
Most of these patches are to improve the test coverage within the
revwalk package.
The last commit points out what I feared, which is that a RevWalk
with a PathFilter applied doesn't produce the same results that
git-core would produce in the same situation. We're either missing
some functions necessary to implement it, or we flat out produce
a wrong graph in some cases.
The tests are commented out because JUnit doesn't have a notion of
"known broken". But I did leave in TODO comments. I'd like to
apply the test, and then work later to improve it, but I'm open
to suggestions.
Shawn O. Pearce (12):
Fix copyright year in revwalk test file headers
Mark non-overridable methods of RevObject final
Change RevWalkTestCase to use RevCommit, not ObjectId
Test that RevFilter.MERGE_BASE cannot use a TreeFilter
Add unit tests for DateRevQueue
Add unit tests for FIFORevQueue
Add unit tests for LIFORevQueue
Add unit tests for AbstractRevQueue.EMPTY_QUEUE
Add tests for basic RevObject methods related to type, flags
Add tests for ObjectWalk
Add some basic logic tests for TreeFilter on RevWalk
Implement git-core t/t6012-rev-list-simplify test case
.../jgit/revwalk/AlwaysEmptyRevQueueTest.java | 63 +++++++
.../org/spearce/jgit/revwalk/DateRevQueueTest.java | 118 ++++++++++++
.../org/spearce/jgit/revwalk/FIFORevQueueTest.java | 81 +++++++++
.../org/spearce/jgit/revwalk/LIFORevQueueTest.java | 69 +++++++
.../org/spearce/jgit/revwalk/ObjectWalkTest.java | 190 ++++++++++++++++++++
.../org/spearce/jgit/revwalk/RevFlagSetTest.java | 2 +-
.../org/spearce/jgit/revwalk/RevObjectTest.java | 171 ++++++++++++++++++
.../org/spearce/jgit/revwalk/RevQueueTestCase.java | 85 +++++++++
.../org/spearce/jgit/revwalk/RevWalkCullTest.java | 30 ++--
.../spearce/jgit/revwalk/RevWalkFilterTest.java | 93 +++++-----
.../spearce/jgit/revwalk/RevWalkMergeBaseTest.java | 64 ++++---
.../jgit/revwalk/RevWalkPathFilter1Test.java | 176 ++++++++++++++++++
.../jgit/revwalk/RevWalkPathFilter6012Test.java | 162 +++++++++++++++++
.../org/spearce/jgit/revwalk/RevWalkSortTest.java | 66 ++++----
.../org/spearce/jgit/revwalk/RevWalkTestCase.java | 110 ++++++++++--
.../org/spearce/jgit/revwalk/AbstractRevQueue.java | 2 +-
.../org/spearce/jgit/revwalk/BlockRevQueue.java | 2 +-
.../src/org/spearce/jgit/revwalk/RevObject.java | 20 +-
18 files changed, 1353 insertions(+), 151 deletions(-)
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/AlwaysEmptyRevQueueTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/DateRevQueueTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/FIFORevQueueTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/LIFORevQueueTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/ObjectWalkTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevObjectTest.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevQueueTestCase.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter1Test.java
create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkPathFilter6012Test.java
^ permalink raw reply
* [JGIT PATCH 3/4 v2] Cap the number of open files in the WindowCache
From: Shawn O. Pearce @ 2009-03-18 1:36 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
In-Reply-To: <200903180109.40074.robin.rosenberg.lists@dewire.com>
The default WindowCache configuration is:
packedGitLimit: 10 MB
packedGitWindowSize: 8 KB
10 MB / 8 KB allows up to 1280 windows permitted in the WindowCache
at any given time. If every window came from a unique pack file, we
need 1280 file descriptors just for the resources in the WindowCache.
For most applications this is way beyond the hard limit configured
for the host JVM, causing java.io.IOException("Too many open files")
from possibly any part of JGit or the host application.
Specifically, I ran into this problem in Gerrit Code Review, where we
commonly see hundreds of very small pack files spread over hundreds
of Git repositories, all accessed from a persistent JVM that is also
hosting an SSH daemon and a web server. The aggressive caching of
windows in the WindowCache and of Repository objects in Gerrit's
own RepositoryCache caused us to retain far too many tiny pack files.
We now set the limit at 128 open files, assuming this is a reasonable
limit for most applications using the library. Git repositories tend
to be in the handful of packs/repository (e.g. <10 packs/repository)
and applications using JGit tend to access only a handful of Git
repositories at a time (e.g. <10 repositories/JVM).
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> onsdag 18 mars 2009 00:08:03 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> > Arrrgh.
> >
> > OK. Maybe scrap that part of the patch then?
> Yes, I think so
Scrapped the ugly test for getMessage() when the open fails.
So we no longer try to reduce fd usage on failure.
.../src/org/spearce/jgit/lib/WindowCache.java | 26 +++++++++++++++++++-
.../org/spearce/jgit/lib/WindowCacheConfig.java | 20 +++++++++++++++
2 files changed, 45 insertions(+), 1 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
index ba1124a..f755dad 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCache.java
@@ -54,6 +54,8 @@ private static final int bits(int newSize) {
return Integer.numberOfTrailingZeros(newSize);
}
+ private static int maxFileCount;
+
private static int maxByteCount;
private static int windowSize;
@@ -70,10 +72,13 @@ private static final int bits(int newSize) {
private static ByteWindow lruTail;
+ private static int openFileCount;
+
private static int openByteCount;
static {
final WindowCacheConfig c = new WindowCacheConfig();
+ maxFileCount = c.getPackedGitOpenFiles();
maxByteCount = c.getPackedGitLimit();
windowSizeShift = bits(c.getPackedGitWindowSize());
windowSize = 1 << windowSizeShift;
@@ -133,6 +138,13 @@ private static synchronized void reconfigureImpl(final WindowCacheConfig cfg) {
boolean prune = false;
boolean evictAll = false;
+ if (maxFileCount < cfg.getPackedGitOpenFiles())
+ maxFileCount = cfg.getPackedGitOpenFiles();
+ else if (maxFileCount > cfg.getPackedGitOpenFiles()) {
+ maxFileCount = cfg.getPackedGitOpenFiles();
+ prune = true;
+ }
+
if (maxByteCount < cfg.getPackedGitLimit()) {
maxByteCount = cfg.getPackedGitLimit();
} else if (maxByteCount > cfg.getPackedGitLimit()) {
@@ -230,15 +242,21 @@ private static synchronized final void getImpl(final WindowCursor curs,
if (wp.openCount == 0) {
try {
+ openFileCount++;
+ releaseMemory();
+ runClearedWindowQueue();
wp.openCount = 1;
wp.cacheOpen();
} catch (IOException ioe) {
+ openFileCount--;
wp.openCount = 0;
throw ioe;
} catch (RuntimeException ioe) {
+ openFileCount--;
wp.openCount = 0;
throw ioe;
} catch (Error ioe) {
+ openFileCount--;
wp.openCount = 0;
throw ioe;
} finally {
@@ -278,6 +296,7 @@ private static synchronized final void getImpl(final WindowCursor curs,
static synchronized void markLoaded(final ByteWindow w) {
if (--w.provider.openCount == 0) {
+ openFileCount--;
w.provider.cacheClose();
}
}
@@ -291,13 +310,17 @@ private static void makeMostRecent(ByteWindow<?> e) {
private static void releaseMemory() {
ByteWindow<?> e = lruTail;
- while (openByteCount > maxByteCount && e != null) {
+ while (isOverLimit() && e != null) {
final ByteWindow<?> p = e.lruPrev;
clear(e);
e = p;
}
}
+ private static boolean isOverLimit() {
+ return openByteCount > maxByteCount || openFileCount > maxFileCount;
+ }
+
/**
* Remove all windows associated with a specific provider.
* <p>
@@ -341,6 +364,7 @@ private static void clear(final ByteWindow<?> e) {
private static void unlinkSize(final ByteWindow<?> e) {
if (e.sizeActive) {
if (--e.provider.openCount == 0) {
+ openFileCount--;
e.provider.cacheClose();
}
openByteCount -= e.size;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java
index b4c4638..d906a7c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WindowCacheConfig.java
@@ -45,6 +45,8 @@
/** 1024 {@link #KB} (number of bytes in one mebibyte/megabyte) */
public static final int MB = 1024 * KB;
+ private int packedGitOpenFiles;
+
private int packedGitLimit;
private int packedGitWindowSize;
@@ -55,6 +57,7 @@
/** Create a default configuration. */
public WindowCacheConfig() {
+ packedGitOpenFiles = 128;
packedGitLimit = 10 * MB;
packedGitWindowSize = 8 * KB;
packedGitMMAP = false;
@@ -62,6 +65,23 @@ public WindowCacheConfig() {
}
/**
+ * @return maximum number of streams to open at a time. Open packs count
+ * against the process limits. <b>Default is 128.</b>
+ */
+ public int getPackedGitOpenFiles() {
+ return packedGitOpenFiles;
+ }
+
+ /**
+ * @param fdLimit
+ * maximum number of streams to open at a time. Open packs count
+ * against the process limits
+ */
+ public void setPackedGitOpenFiles(final int fdLimit) {
+ packedGitOpenFiles = fdLimit;
+ }
+
+ /**
* @return maximum number bytes of heap memory to dedicate to caching pack
* file data. <b>Default is 10 MB.</b>
*/
--
1.6.2.1.286.g8173
^ permalink raw reply related
* Re: Suggested Workflow Question
From: Marcel M. Cary @ 2009-03-18 1:27 UTC (permalink / raw)
To: Roger Garvin; +Cc: git@vger.kernel.org
In-Reply-To: <loom.20090317T175010-470@post.gmane.org>
Roger Garvin wrote:
> I work for a small company with about 15 developers who work concurrently on
> about 10+ projects both in new development and support.
> We do custom software for manufacturing and production systems. Part of our
> contracts with our customers is a perpetual single use license of the source
> code at each facility.
> So we have a copy of the source on our office server, and another copy at each
> customer site. When we had only 5 developers it was easier to handle. Now that
> we are growing we need a source control system and I have been looking heavily
> into Git. Our old workflow does not seem that it will fit well with Git
> however, but I feel that I need a distributed system to keep track of the office
> version and the on-site versions of our source since development is taking place
> on both.
> (Some customers also have separate development, and testing versions on their
> servers as well.)
>
> I have created git repositories on a couple of our project source directories as
> test beds. Right now (second day) I am the only one who is actually using git.
> Everyone else is simply accessing the files on the server as they have always
> done, and I am making the commits when I see signifigant changes.
>
> My question is really a request for modified workflow ideas. My plan was to
> have a master repository in our office server with clones at each customer site,
> and multiple branches for test, QA, and production versions of the source.
> Since most of these customers have closed networks, we would rely on people
> traveling onsite, or emailing patches to get any updates back into our office
> repository.
>
> Thank you for any assistance for this revision control newb.
>
> Roger Garvin
The workflow elements you mention so far sound sane to me:
* a repository in your office
* repositories at customer sites
* emailing patches when direct connections are not possible
* test and dev branches for each customer
I presume there will also be a production branch in customer
repositories on which you arrange production releases... or maybe you
just tag your test branch when it passes?
When you send patches via email, keep in mind that you'll have to convey
which branch they belong on "out of band", for example after the commit
message and above the diffstat.
There was an interesting discussion about maintaining per-client code on
different branches recently, but I can't find it.
I've found Git to be very flexible. Maybe you could start by emulating
your current workflow and refine it as you go? If you find you don't
know how code travels currently... well, maybe you can just let your
team pass patches around until patterns emerge.
Marcel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox