* Re: [WIP PATCH] Add 'git fast-export', the sister of 'git fast-import'
From: Shawn O. Pearce @ 2007-11-21 7:47 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Johannes Schindelin, git
In-Reply-To: <4743E1D6.4010308@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> wrote:
> Johannes Schindelin schrieb:
> > Oh, and it relies on "int" being castable to void * and vice
> > versa. Is anybody aware of a platform where this can lead to
> > problems?
>
> Win64?
Does anyone even use that? I thought that was dead. Like Vista.
Seriously though, we include stdint.h. If you want to cast a void*
to an integer type and back use ptrint_t. That's what it exists for.
--
Shawn.
^ permalink raw reply
* Re: [WIP PATCH] Add 'git fast-export', the sister of 'git fast-import'
From: Johannes Sixt @ 2007-11-21 7:44 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0711210336210.27959@racer.site>
Johannes Schindelin schrieb:
> Oh, and it relies on "int" being castable to void * and vice
> versa. Is anybody aware of a platform where this can lead to
> problems?
Win64?
-- Hannes
^ permalink raw reply
* Re: [PATCH 1/2] send-pack: cluster ref status reporting
From: Jeff King @ 2007-11-21 7:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alex Riesen, git
In-Reply-To: <7vwsscgie2.fsf@gitster.siamese.dyndns.org>
On Tue, Nov 20, 2007 at 11:36:05PM -0800, Junio C Hamano wrote:
> Heh, at least I've privately queued it at the tip of
> jk/send-pack for review but not merged it to 'next' yet, after
> fixing it up (the last round I also fixed up so that was partly
> why I noticed -- the patch did not apply).
OK, good. I should have noticed because I also ran across the same patch
failure when I did a rebase earlier today, but I didn't consider that
the mistake had slipped out of my repo. :) Sorry for the confusion.
> The idea feels sound, and code under cursory look was fine.
I think it is probably worth applying then. It is slightly more useful
to the user, and I haven't been able to see any downside.
-Peff
^ permalink raw reply
* Re: [PATCH 1/2] send-pack: cluster ref status reporting
From: Jeff King @ 2007-11-21 7:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alex Riesen, git
In-Reply-To: <20071121073332.GA10244@sigill.intra.peff.net>
On Wed, Nov 21, 2007 at 02:33:32AM -0500, Jeff King wrote:
> > > + case REF_STATUS_REMOTE_REJECT:
> > > + print_ref_status('!', "[remote rejected]", ref,
> > > + ref->deletion ? ref->peer_ref : NULL,
> > > + ref->remote_status);
> > > + break;
>
> Gah, sorry. This crept in because I based it on the previous, broken
> version of the other patch series which had the same problem (and
> obviously this chunk is just a pure code move + reindent).
You will also find that it doesn't apply cleanly to 'next', since it
attempts to remove the bogus version of the lines (while you correctly
fixed them up when you applied to 'next').
Below is a fixed version of the patch for convenience.
-- >8 --
send-pack: cluster ref status reporting
Instead of intermingling success and failure, we now print:
1. all uptodate refs (if args.verbose is enabled)
2. successfully pushed refs
3. failed refs
with the assumption that the user is most likely to see the
ones at the end, and therefore we order them from "least
interesting" to "most interesting."
---
builtin-send-pack.c | 93 +++++++++++++++++++++++++++++----------------------
1 files changed, 53 insertions(+), 40 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 3aab89c..25ae1fe 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -298,52 +298,65 @@ static void print_ok_ref_status(struct ref *ref)
}
}
+static int print_one_push_status(struct ref *ref, const char *dest, int count)
+{
+ if (!count)
+ fprintf(stderr, "To %s\n", dest);
+
+ switch(ref->status) {
+ case REF_STATUS_NONE:
+ print_ref_status('X', "[no match]", ref, NULL, NULL);
+ break;
+ case REF_STATUS_REJECT_NODELETE:
+ print_ref_status('!', "[rejected]", ref, NULL,
+ "remote does not support deleting refs");
+ break;
+ case REF_STATUS_UPTODATE:
+ print_ref_status('=', "[up to date]", ref,
+ ref->peer_ref, NULL);
+ break;
+ case REF_STATUS_REJECT_NONFASTFORWARD:
+ print_ref_status('!', "[rejected]", ref, ref->peer_ref,
+ "non-fast forward");
+ break;
+ case REF_STATUS_REMOTE_REJECT:
+ print_ref_status('!', "[remote rejected]", ref,
+ ref->deletion ? NULL : ref->peer_ref,
+ ref->remote_status);
+ break;
+ case REF_STATUS_EXPECTING_REPORT:
+ print_ref_status('!', "[remote failure]", ref,
+ ref->deletion ? NULL : ref->peer_ref,
+ "remote failed to report status");
+ break;
+ case REF_STATUS_OK:
+ print_ok_ref_status(ref);
+ break;
+ }
+
+ return 1;
+}
+
static void print_push_status(const char *dest, struct ref *refs)
{
struct ref *ref;
- int shown_dest = 0;
+ int n = 0;
- for (ref = refs; ref; ref = ref->next) {
- if (!ref->status)
- continue;
- if (ref->status == REF_STATUS_UPTODATE && !args.verbose)
- continue;
+ if (args.verbose) {
+ for (ref = refs; ref; ref = ref->next)
+ if (ref->status == REF_STATUS_UPTODATE)
+ n += print_one_push_status(ref, dest, n);
+ }
- if (!shown_dest) {
- fprintf(stderr, "To %s\n", dest);
- shown_dest = 1;
- }
+ for (ref = refs; ref; ref = ref->next)
+ if (ref->status == REF_STATUS_OK)
+ n += print_one_push_status(ref, dest, n);
- switch(ref->status) {
- case REF_STATUS_NONE:
- print_ref_status('X', "[no match]", ref, NULL, NULL);
- break;
- case REF_STATUS_REJECT_NODELETE:
- print_ref_status('!', "[rejected]", ref, NULL,
- "remote does not support deleting refs");
- break;
- case REF_STATUS_UPTODATE:
- print_ref_status('=', "[up to date]", ref,
- ref->peer_ref, NULL);
- break;
- case REF_STATUS_REJECT_NONFASTFORWARD:
- print_ref_status('!', "[rejected]", ref, ref->peer_ref,
- "non-fast forward");
- break;
- case REF_STATUS_REMOTE_REJECT:
- print_ref_status('!', "[remote rejected]", ref,
- ref->deletion ? NULL : ref->peer_ref,
- ref->remote_status);
- break;
- case REF_STATUS_EXPECTING_REPORT:
- print_ref_status('!', "[remote failure]", ref,
- ref->deletion ? NULL : ref->peer_ref,
- "remote failed to report status");
- break;
- case REF_STATUS_OK:
- print_ok_ref_status(ref);
- break;
- }
+ for (ref = refs; ref; ref = ref->next) {
+ if (ref->status != REF_STATUS_NONE &&
+ ref->status != REF_STATUS_UPTODATE &&
+ ref->status != REF_STATUS_OK)
+ n += print_one_push_status(ref, dest, n);
}
}
--
1.5.3.6.1786.g2e199
^ permalink raw reply related
* [ANNOUNCE] git-gui 0.9.0
From: Shawn O. Pearce @ 2007-11-21 7:36 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
git-gui 0.9.0 is now available on repo.or.cz:
gitweb: http://repo.or.cz/w/git-gui.git
git: git://repo.or.cz/git-gui.git
http://repo.or.cz/r/git-gui.git
This is the first release that includes i18n support. I'm kicking
it out as something between a pre-release and a full release.
The English version has been quite stable and is in heavy production
use by a lot of users so I figure its time to tag it. Some of the
non-English translations may need to be updated, but many of them
are reasonably current. I'm inclined to do a 0.9.1 in the near
future if updated translations come in.
Many thanks to all those who have contributed to this release.
-----
Major notable improvements over the 0.8 series:
* More native appearance on Mac OS X
git-gui now displays "Git Gui" as its application name in the
menu bar, instead of "Wish". It also uses Henrik Nyh's Git
logo in the dock and error dialogs.
* Window/shortcut icon on Microsoft Windows
The icon in the upper left corner of each window's title bar
(and on the taskbar) is now Henrik Nyh's Git logo instead of
the Tcl feather.
On Windows git-gui now creates true Windows shortcuts to launch
git-gui in a specific repository. This allows the icon to be a
git specific icon instead of the generic Windows batch file icon.
* Repository creation/clone UI
Starting git-gui outside of a repository allows the user to
create a new repository, clone an existing repository or open a
previously accessed repository. The clone process actually uses
a pure Tcl implementation of git-clone, based on `git init &&
git remote add origin ... && git fetch`.
This makes it easier to create a shortcut to launch git-gui
from desktop menu systems, e.g. the Windows Start menu or
the Mac OS X dock.
* i18n translations for de, hu, it, ja, ru, zh_cn
Some of these are still under development. Hopefully we can
get even more translations in 0.9.1.
-----
Changes since 0.8.4:
Alex Riesen (2):
More updates and corrections to the russian translation of git-gui
Updated russian translation of git-gui
Christian Stimming (12):
Mark strings for translation.
Makefile rules for translation catalog generation and installation.
Add glossary that can be converted into a po file for each language.
Add glossary translation template into git.
German translation for git-gui
German glossary for translation
git-gui: Add more words to translation glossary
git-gui: Update German glossary according to mailing list discussion
git-gui: Incorporate glossary changes into existing German translation
git-gui: Update German translation, including latest glossary changes
git-gui: Add more terms to glossary.
git-gui: Update German translation
Harri Ilari Tapio Liusvaara (1):
git-gui: Disambiguate "commit"
Irina Riesen (1):
git-gui: initial version of russian translation
Johannes Schindelin (7):
Add po/git-gui.pot
Ignore po/*.msg
git-gui: Deiconify startup wizard so it raises to the top
git-gui: add a simple msgfmt replacement
po2msg: ignore entries marked with "fuzzy"
po2msg: ignore untranslated messages
po2msg: actually output statistics
Johannes Sixt (1):
git-gui: Change main window layout to support wider screens
Junio C Hamano (2):
git-gui po/README: Guide to translators
git-gui: Update Japanese strings (part 2)
Kirill (1):
Updated Russian translation.
Michele Ballabio (4):
git-gui: remove dots in some UI strings
git-gui: add some strings to translation
git-gui: fix typo in lib/blame.tcl
git-gui: update Italian translation
Miklos Vajna (1):
Hungarian translation of git-gui
Paolo Ciarrocchi (1):
Italian translation of git-gui
Shawn O. Pearce (55):
git-gui: Locate the library directory early during startup
git-gui: Initialize Tcl's msgcat library for internationalization
git-gui: Update po/README as symlink process is not necessary
git-gui: Correct stock message for 'Invalid font specified in %s'
git-gui: Quiet the msgfmt part of the make process
git-gui: Ensure msgfmt failure stops GNU make
git-gui: Mark revision chooser tooltip for translation
git-gui: Localize commit/author dates when displaying them
git-gui: Support context-sensitive i18n
git-gui: Document the new i18n context support
git-gui: Make the tree browser also use lightgray selection
git-gui: Paper bag fix missing translated strings
git-gui: Fix missing i18n markup in push/fetch windows
git-gui: Support native Win32 Tcl/Tk under Cygwin
git-gui: Refactor some UI init to occur earlier
git-gui: Allow users to choose/create/clone a repository
git-gui: Avoid console scrollbars unless they are necessary
git-gui: Don't bother showing OS error message about hardlinks
git-gui: Keep the UI responsive while counting objects in clone
git-gui: Copy objects/info/alternates during standard clone
git-gui: Don't delete console window namespaces too early
git-gui: Don't delete scrollbars in console windows
git-gui: Switch the git-gui logo to Henrik Nyh's logo
git-gui: Make the status bar easier to read in the setup wizard
git-gui: Use Henrik Nyh's git logo icon on Windows systems
git-gui: Support a native Mac OS X application bundle
git-gui: Refer to ourselves as "Git Gui" and not "git-gui"
git-gui: Allow forced push into remote repository
git-gui: Refactor Henrik Nyh's logo into its own procedure
git-gui: Refactor about dialog code into its own module
git-gui: Include our Git logo in the about dialog
git-gui: Use progress meter in the status bar during index updates
git-gui: Consolidate the Fetch and Push menus into a Remote menu
git-gui: Bind Cmd-, to Preferences on Mac OS X
git-gui: Shorten the staged/unstaged changes title bar text
git-gui: Updated po strings based on current sources
git-gui: Move load_config procedure below git-version selection
git-gui: Refactor git-config --list parsing
git-gui: Support LFs embedded in config file values
git-gui: Change repository browser radio buttons to hyperlinks
git-gui: Offer repository management features in menu bar
git-gui: Fix bind errors when switching repository chooser panels
git-gui: Disable the text widget in the repository chooser
git-gui: Bind n/c/o accelerators in repository chooser
git-gui: Ensure copyright message is correctly read as UTF-8
git-gui: Use proper Windows shortcuts instead of bat files
git-gui: Support cloning Cygwin based work-dirs
git-gui: Collapse $env(HOME) to ~/ in recent repositories on Windows
git-gui: Honor a config.mak in git-gui's top level
git-gui: Paper bag fix the global config parsing
git-gui: Make sure we get errors from git-update-index
git-gui: Protect against bad translation strings
git-gui: Allow users to set font weights to bold
git-gui: Bind Meta-T for "Stage To Commit" menu action
git-gui 0.9.0
Steffen Prohaska (4):
git-gui: add directory git-gui is located in to PATH (on Windows)
git-gui: set NO_MSGFMT to force using pure tcl replacement in msysgit
git-gui: add mingw specific startup wrapper
git-gui: offer a list of recent repositories on startup
Xudong Guan (2):
Initial Chinese translation for git-gui
git-gui: Added initial version of po/glossary/zh_cn.po
しらいしななこ (2):
Japanese translation of git-gui
git-gui: Update Japanese strings
--
Shawn.
^ permalink raw reply
* Re: [PATCH 1/2] send-pack: cluster ref status reporting
From: Junio C Hamano @ 2007-11-21 7:36 UTC (permalink / raw)
To: Jeff King; +Cc: Alex Riesen, git
In-Reply-To: <20071121073332.GA10244@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Gah, sorry. This crept in because I based it on the previous, broken
> version of the other patch series which had the same problem (and
> obviously this chunk is just a pure code move + reindent).
>
> But pretend like it was competently prepared and give your comments on
> the idea. ;)
Heh, at least I've privately queued it at the tip of
jk/send-pack for review but not merged it to 'next' yet, after
fixing it up (the last round I also fixed up so that was partly
why I noticed -- the patch did not apply).
The idea feels sound, and code under cursory look was fine.
^ permalink raw reply
* Re: [PATCH 1/2] send-pack: cluster ref status reporting
From: Jeff King @ 2007-11-21 7:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Alex Riesen, git
In-Reply-To: <7v1wakhxh4.fsf@gitster.siamese.dyndns.org>
On Tue, Nov 20, 2007 at 11:24:55PM -0800, Junio C Hamano wrote:
> > + case REF_STATUS_REMOTE_REJECT:
> > + print_ref_status('!', "[remote rejected]", ref,
> > + ref->deletion ? ref->peer_ref : NULL,
> > + ref->remote_status);
> > + break;
> > + case REF_STATUS_EXPECTING_REPORT:
> > + print_ref_status('!', "[remote failure]", ref,
> > + ref->deletion ? ref->peer_ref : NULL,
> > + "remote failed to report status");
> > + break;
>
> Eh,... in ref->deletion mode, the peer_ref is...
Gah, sorry. This crept in because I based it on the previous, broken
version of the other patch series which had the same problem (and
obviously this chunk is just a pure code move + reindent).
But pretend like it was competently prepared and give your comments on
the idea. ;)
-Peff
^ permalink raw reply
* Re: [PATCH 1/2] send-pack: cluster ref status reporting
From: Junio C Hamano @ 2007-11-21 7:24 UTC (permalink / raw)
To: Jeff King; +Cc: Alex Riesen, git
In-Reply-To: <20071120111801.GA7814@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> +static int print_one_push_status(struct ref *ref, const char *dest, int count)
> +{
> ...
> + case REF_STATUS_REMOTE_REJECT:
> + print_ref_status('!', "[remote rejected]", ref,
> + ref->deletion ? ref->peer_ref : NULL,
> + ref->remote_status);
> + break;
> + case REF_STATUS_EXPECTING_REPORT:
> + print_ref_status('!', "[remote failure]", ref,
> + ref->deletion ? ref->peer_ref : NULL,
> + "remote failed to report status");
> + break;
Eh,... in ref->deletion mode, the peer_ref is...
^ permalink raw reply
* [PATCH] Revert "t5516: test update of local refs on push"
From: Jeff King @ 2007-11-21 7:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Alex Riesen
This reverts commit 09fba7a59d38d1cafaf33eadaf1d409c4113b30c.
These tests are superseded by the ones in t5404 (added in
6fa92bf3 and 8736a848), which are more extensive and better
organized.
Signed-off-by: Jeff King <peff@peff.net>
---
When Alex introduced t5404, I had the feeling I had written similar
tests before, but I failed to find them. I think starting t5404 was a
much more sensible organization, especially since these two tests don't
follow the style of the rest of t5516 very well.
t/t5516-fetch-push.sh | 28 ----------------------------
1 files changed, 0 insertions(+), 28 deletions(-)
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 86f9b53..4fbd5b1 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -254,32 +254,4 @@ test_expect_success 'push with dry-run' '
check_push_result $old_commit heads/master
'
-test_expect_success 'push updates local refs' '
-
- rm -rf parent child &&
- mkdir parent && cd parent && git init &&
- echo one >foo && git add foo && git commit -m one &&
- cd .. &&
- git clone parent child && cd child &&
- echo two >foo && git commit -a -m two &&
- git push &&
- test $(git rev-parse master) = $(git rev-parse remotes/origin/master)
-
-'
-
-test_expect_success 'push does not update local refs on failure' '
-
- rm -rf parent child &&
- mkdir parent && cd parent && git init &&
- echo one >foo && git add foo && git commit -m one &&
- echo exit 1 >.git/hooks/pre-receive &&
- chmod +x .git/hooks/pre-receive &&
- cd .. &&
- git clone parent child && cd child &&
- echo two >foo && git commit -a -m two || exit 1
- git push && exit 1
- test $(git rev-parse master) != $(git rev-parse remotes/origin/master)
-
-'
-
test_done
--
1.5.3.6.1786.g2e199
^ permalink raw reply related
* Re: [PATCH] avoid "defined but not used" warning for fetch_objs_via_walker
From: Junio C Hamano @ 2007-11-21 7:10 UTC (permalink / raw)
To: Jeff King; +Cc: git, Daniel Barkalow
In-Reply-To: <20071118081722.GA31563@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Because this function is static and used only by the
> http-walker, when NO_CURL is defined, gcc emits a "defined
> but not used" warning.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> On master. I like to compile with -Werror to make sure I don't miss
> warnings as the compile scrolls by.
>
> This fix feels a little wrong, since the function isn't specific to http
> support, but hopefully the comment should be obvious if we ever add
> another similar commit walker that needs it.
Yeah, while I share your -Werror desire it sure feels a bit
dirty. As it does not look like we will be taking any new
walkers, I think your patch is reasonable, though.
^ permalink raw reply
* Re: [PATCH 0/3] Implement git-svn: info
From: David D. Kilzer @ 2007-11-21 6:59 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <1195627399-25209-1-git-send-email-ddkilzer@kilzer.net>
"David D. Kilzer" <ddkilzer@kilzer.net> wrote:
> Eric Wong <normalperson@yhbt.net> wrote:
> > Can we expect the output of "svn info" to not change between
> > versions? I know "svn status" has changed between versions of
> > svn. I'd prefer if we keep the expected.* files hard-coded
> > in a test directory and compare those instead. Maybe use sed
> > to substitute placeholders for timestamps..
> Done.
Grrr. I remember the reason I didn't do this in the first place. In Patch
2/3, there are now hard-coded directory paths and my username in the static
expected-* files.
That means that either I need to replace the "URL:", "Repository Root:" and
"Last Changed Author:" fields with place-holders (weakening the effectiveness
of the tests), or switch back to more dynamic tests.
Thoughts?
Dave
^ permalink raw reply
* Re: [PATCH] autoconf: Add tests for memmem, strtoumax and mkdtemp functions
From: Shawn O. Pearce @ 2007-11-21 6:58 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <200711191947.05960.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> wrote:
> By the way, do you have idea how to test for the following
> in configure.ac:
>
> * Define NO_PREAD if you have a problem with pread() system call (e.g.
> cygwin.dll before v1.5.22).
>
> - what is the problem? how to detect it?
This also appears to be broken on HP-UX (e.g. we need to set
NO_PREAD there). Thiago on IRC talked about this the other day
when he was trying to build git on a bunch of different systems.
Unfortunately this may just need to be an OS based test. The code
compiles just fine but when index-pack tries to use pread to walk
back through the deltas and generate their SHA-1s it barfs without
an error code. I suspect the failure is pread claiming it put the
data into the user buffer but not actually doing so, which causes
zlib's inflate() to then see data corruption.
Ouch.
--
Shawn.
^ permalink raw reply
* Re: [PATCH] send-email: add transfer encoding header with content-type
From: Junio C Hamano @ 2007-11-21 6:58 UTC (permalink / raw)
To: Jeff King
Cc: Uwe Kleine-König, git, Brian Swetland,
Russell King - ARM Linux, Nicolas Pitre
In-Reply-To: <20071120125404.GB7998@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
>> I think we should add
>>
>> Content-Transfer-Encoding: 8bit
>
> Even though Brian's mail turned out to be hand-generated, this problem
> does exist in git-send-email. I don't know why I didn't add the encoding
> header in the first place, since it is clearly required.
>
> Junio, I think this is maint-worthy.
Yeah, looks good.
^ permalink raw reply
* Re: [PATCH] Fix warning about bitfield in struct ref
From: Shawn O. Pearce @ 2007-11-21 6:51 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.64.0711200058270.16728@wbgn129.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Sun, 18 Nov 2007, Shawn O. Pearce wrote:
>
> > + unsigned int force:1,
>
> Isn't this "unsigned force:1" everywhere else in git's source?
That may be true but Junio already applied it as "unsigned int"
as I wrote it. Anyway "unsigned int" and "unsigned" will give the
same result here; I just typed 4 characters more than I needed to.
--
Shawn.
^ permalink raw reply
* Re: [PATCH] gitview: revamped to use string.join, stripped a function def
From: Junio C Hamano @ 2007-11-21 6:50 UTC (permalink / raw)
To: rae l; +Cc: Aneesh Kumar K.V, git, cr_quan, Scott James Remnant
In-Reply-To: <91b13c310711202119j4f9e20f0n2515babe5f9217ac@mail.gmail.com>
"rae l" <crquan@gmail.com> writes:
> Please give some comments.
>
> On Sep 28, 2007 3:55 AM, Denis Cheng <crquan@gmail.com> wrote:
>> Signed-off-by: Denis Cheng <crquan@gmail.com>
Blast from the past ;-).
>> -def list_to_string(args, skip):
>> - count = len(args)
>> - i = skip
>> - str_arg=" "
>> - while (i < count ):
>> - str_arg = str_arg + args[i]
>> - str_arg = str_arg + " "
>> - i = i+1
>> -
>> - return str_arg
>> ...
>> """Fill in different windows with info from the reposiroty"""
>> - fp = os.popen("git rev-parse --sq --default HEAD " + list_to_string(args, 1))
>> + fp = os.popen("git rev-parse --sq --default HEAD " + " ".join(args[1:]))
Obviously correct, loses extra SPs on both ends of the args
string, and reads more Pythonic.
^ permalink raw reply
* [PATCH 3/3 v2] git-svn: info --url [path]
From: David D. Kilzer @ 2007-11-21 6:49 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <1195627399-25209-4-git-send-email-ddkilzer@kilzer.net>
Return the svn URL for the given path, or return the svn
repository URL if no path is given.
Added one test to t/t9117-git-svn-info.sh.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---
Added missing documentation change, and tweaked commit log.
Documentation/git-svn.txt | 2 +-
git-svn.perl | 9 +++++++--
t/t9117-git-svn-info.sh | 4 ++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index c3fc878..295b14b 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -196,7 +196,7 @@ Any other arguments are passed directly to `git log'
'info'::
Shows information about a file or directory similar to what
`svn info' provides. Does not currently support a -r/--revision
- argument.
+ argument. Use the --url option to output only the 'URL:' field.
--
diff --git a/git-svn.perl b/git-svn.perl
index 406ee6f..eaf2187 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -65,7 +65,7 @@ my ($_stdin, $_help, $_edit,
$_template, $_shared,
$_version, $_fetch_all, $_no_rebase,
$_merge, $_strategy, $_dry_run, $_local,
- $_prefix, $_no_checkout, $_verbose);
+ $_prefix, $_no_checkout, $_url, $_verbose);
$Git::SVN::_follow_parent = 1;
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
'config-dir=s' => \$Git::SVN::Ra::config_dir,
@@ -181,7 +181,7 @@ my %cmd = (
'info' => [ \&cmd_info,
"Show info about the latest SVN revision
on the current branch",
- { } ],
+ { 'url' => \$_url, } ],
);
my $cmd;
@@ -770,6 +770,11 @@ sub cmd_info {
}
my $full_url = $url . ($path eq "." ? "" : "/$path");
+ if ($_url) {
+ print $full_url, "\n";
+ return;
+ }
+
my $result = "Path: $path\n";
$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
$result .= "URL: " . $full_url . "\n";
diff --git a/t/t9117-git-svn-info.sh b/t/t9117-git-svn-info.sh
index c7ca006..800d1c4 100644
--- a/t/t9117-git-svn-info.sh
+++ b/t/t9117-git-svn-info.sh
@@ -183,4 +183,8 @@ test_expect_success 'info unknown-symlink-directory' "
git-diff ../t9117/expected.info-unknown-symlink-directory -
"
+test_expect_success 'info --url' '
+ test $(cd gitwc; git-svn info --url) = $svnrepo
+ '
+
test_done
--
1.5.3.4
^ permalink raw reply related
* Re: [PATCH] When re-initializing, set shared permissions on all directories.
From: Junio C Hamano @ 2007-11-21 6:45 UTC (permalink / raw)
To: Jon Jensen; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0711202045140.4046@ybpnyubfg.ybpnyqbznva>
Jon Jensen <jon@endpoint.com> writes:
> Below is a small patch to make git-init --shared change permissions
> not just of .git/refs/ but of the other directories too.
Those existing calls to adjust_shared_perm() are not about
changing permissions for existing directories, but are meant to
change the ones we _create_ under the user's umask() during the
initialization.
As you said, your change does not go far enough and you have to
tell the users to run "chmod" (and "chgrp") anyway. If we were
to update init-db, then it would need to do the recursive chmod
and chgrp itself.
However, the user need to do recursive chmod and chgrp to
correct earlier screwups and to adjust to the new reality anyway
(see below), and doing so using vanilla filesystem tools is
often easier. It might be better to train them early how to do
so, instead of making git-init a specialized command that knows
how to run chmod and chgrp in $GIT_DIR, as one of the major
strength of git comes from the fact that its implementation is
transparent. People who can read or write under $GIT_DIR can
access or build on the history --- it's just that simple.
Exposing users to the filesystem enhances that transparency.
Two reasons for correcting an initial screw-up, and two reasons
for adjusting the new reality are:
(A) making a non-shared repository to a shared one; you need
$ find .git -type d -print | xargs chmod g+rwxs
$ find .git -type f -print | xargs chmod g+rX
(B) the same as above but the repository is owned by your
personal group, not project; you further need
$ chgrp -R projectgroup .git
(C) an already shared project repository is transferred to a
new group; you need
$ chgrp -R newprojectgroup .git
(D) a shared repository is turned back to a private one; you
may need (if you are paranoid and do not want them to be
read):
$ find .git -type d -print | xargs chmod go=
$ find .git -type f -print | xargs chmod go=
or (if you only want to refuse writing)
$ find .git -type d -print | xargs chmod g-w
$ find .git -type f -print | xargs chmod g-w
Of course the above assumes that your umask is at most 077 (iow,
you did not forbid any access to yourself).
So I'd suggest us to do this in three steps:
Step #1. Documentation.
(1) How to transform a personal, non-shared project to a shared
one;
(2) How to transfer a shared project from one group to another;
(3) How to transform a shared project to a non-shared,
private one (two variants);
I think your documentation patch is a good start, but notice
the differences from the above (A)-(D).
Step #2. Teach "git-init --shared" to do (1),
Step #3. Discuss if we want to teach the "re-initialization"
mode of git-init to do (2) and (3) as well, and if so,
design and code it. We'd need new options to name the
desired group and such so it would involve an
interface change.
Personally, I suspect that we do not need to go any further than
Step #1 above, but people who like "magic" may disagree. Don't
take my suspicion as a rejection.
^ permalink raw reply
* [PATCH 3/3] git-svn: info --url [path]
From: David D. Kilzer @ 2007-11-21 6:43 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <1195627399-25209-3-git-send-email-ddkilzer@kilzer.net>
Return the svn URL for the given path, or return the svn
repository URL if no path is given.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---
git-svn.perl | 9 +++++++--
t/t9117-git-svn-info.sh | 4 ++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 406ee6f..eaf2187 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -65,7 +65,7 @@ my ($_stdin, $_help, $_edit,
$_template, $_shared,
$_version, $_fetch_all, $_no_rebase,
$_merge, $_strategy, $_dry_run, $_local,
- $_prefix, $_no_checkout, $_verbose);
+ $_prefix, $_no_checkout, $_url, $_verbose);
$Git::SVN::_follow_parent = 1;
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
'config-dir=s' => \$Git::SVN::Ra::config_dir,
@@ -181,7 +181,7 @@ my %cmd = (
'info' => [ \&cmd_info,
"Show info about the latest SVN revision
on the current branch",
- { } ],
+ { 'url' => \$_url, } ],
);
my $cmd;
@@ -770,6 +770,11 @@ sub cmd_info {
}
my $full_url = $url . ($path eq "." ? "" : "/$path");
+ if ($_url) {
+ print $full_url, "\n";
+ return;
+ }
+
my $result = "Path: $path\n";
$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
$result .= "URL: " . $full_url . "\n";
diff --git a/t/t9117-git-svn-info.sh b/t/t9117-git-svn-info.sh
index c7ca006..800d1c4 100644
--- a/t/t9117-git-svn-info.sh
+++ b/t/t9117-git-svn-info.sh
@@ -183,4 +183,8 @@ test_expect_success 'info unknown-symlink-directory' "
git-diff ../t9117/expected.info-unknown-symlink-directory -
"
+test_expect_success 'info --url' '
+ test $(cd gitwc; git-svn info --url) = $svnrepo
+ '
+
test_done
--
1.5.3.4
^ permalink raw reply related
* [PATCH 2/3] git-svn info: implement info command
From: David D. Kilzer @ 2007-11-21 6:43 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <1195627399-25209-2-git-send-email-ddkilzer@kilzer.net>
Implement "git-svn info" for files and directories based on the
"svn info" command. Note that the -r/--revision argument is not
supported yet.
Added 18 tests in t/t9117-git-svn-info.sh.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---
Documentation/git-svn.txt | 5 +
git-svn.perl | 132 ++++++++++++++++
t/t9117-git-svn-info.sh | 186 +++++++++++++++++++++++
t/t9117/expected.info-added-directory | 7 +
t/t9117/expected.info-added-file | 8 +
t/t9117/expected.info-added-symlink-directory | 8 +
t/t9117/expected.info-added-symlink-file | 8 +
t/t9117/expected.info-deleted-directory | 11 ++
t/t9117/expected.info-deleted-file | 14 ++
t/t9117/expected.info-deleted-symlink-directory | 14 ++
t/t9117/expected.info-deleted-symlink-file | 14 ++
t/t9117/expected.info-directory | 11 ++
t/t9117/expected.info-dot | 11 ++
t/t9117/expected.info-file | 14 ++
t/t9117/expected.info-no-arguments | 11 ++
t/t9117/expected.info-symlink-directory | 14 ++
t/t9117/expected.info-symlink-file | 14 ++
t/t9117/expected.info-unknown-directory | 2 +
t/t9117/expected.info-unknown-file | 2 +
t/t9117/expected.info-unknown-symlink-directory | 2 +
t/t9117/expected.info-unknown-symlink-file | 2 +
t/t9117/regenerate.sh | 186 +++++++++++++++++++++++
22 files changed, 676 insertions(+), 0 deletions(-)
create mode 100644 t/t9117-git-svn-info.sh
create mode 100644 t/t9117/expected.info-added-directory
create mode 100644 t/t9117/expected.info-added-file
create mode 100644 t/t9117/expected.info-added-symlink-directory
create mode 100644 t/t9117/expected.info-added-symlink-file
create mode 100644 t/t9117/expected.info-deleted-directory
create mode 100644 t/t9117/expected.info-deleted-file
create mode 100644 t/t9117/expected.info-deleted-symlink-directory
create mode 100644 t/t9117/expected.info-deleted-symlink-file
create mode 100644 t/t9117/expected.info-directory
create mode 100644 t/t9117/expected.info-dot
create mode 100644 t/t9117/expected.info-file
create mode 100644 t/t9117/expected.info-no-arguments
create mode 100644 t/t9117/expected.info-symlink-directory
create mode 100644 t/t9117/expected.info-symlink-file
create mode 100644 t/t9117/expected.info-unknown-directory
create mode 100644 t/t9117/expected.info-unknown-file
create mode 100644 t/t9117/expected.info-unknown-symlink-directory
create mode 100644 t/t9117/expected.info-unknown-symlink-file
create mode 100755 t/t9117/regenerate.sh
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 488e4b1..c3fc878 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -193,6 +193,11 @@ Any other arguments are passed directly to `git log'
repository (that has been init-ed with git-svn).
The -r<revision> option is required for this.
+'info'::
+ Shows information about a file or directory similar to what
+ `svn info' provides. Does not currently support a -r/--revision
+ argument.
+
--
OPTIONS
diff --git a/git-svn.perl b/git-svn.perl
index aff429a..406ee6f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -178,6 +178,10 @@ my %cmd = (
'file|F=s' => \$_file,
'revision|r=s' => \$_revision,
%cmt_opts } ],
+ 'info' => [ \&cmd_info,
+ "Show info about the latest SVN revision
+ on the current branch",
+ { } ],
);
my $cmd;
@@ -583,12 +587,18 @@ sub cmd_create_ignore {
sub canonicalize_path {
my ($path) = @_;
+ my $dot_slash_added = 0;
+ if (substr($path, 0, 1) ne "/") {
+ $path = "./" . $path;
+ $dot_slash_added = 1;
+ }
# File::Spec->canonpath doesn't collapse x/../y into y (for a
# good reason), so let's do this manually.
$path =~ s#/+#/#g;
$path =~ s#/\.(?:/|$)#/#g;
$path =~ s#/[^/]+/\.\.##g;
$path =~ s#/$##g;
+ $path =~ s#^\./## if $dot_slash_added;
return $path;
}
@@ -740,6 +750,104 @@ sub cmd_commit_diff {
}
}
+sub cmd_info {
+ my $path = canonicalize_path(shift or ".");
+ unless (scalar(@_) == 0) {
+ die "Too many arguments specified\n";
+ }
+
+ my ($file_type, $diff_status) = find_file_type_and_diff_status($path);
+
+ if (!$file_type && !$diff_status) {
+ print STDERR "$path: (Not a versioned resource)\n\n";
+ return;
+ }
+
+ my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
+ unless ($gs) {
+ die "Unable to determine upstream SVN information from ",
+ "working tree history\n";
+ }
+ my $full_url = $url . ($path eq "." ? "" : "/$path");
+
+ my $result = "Path: $path\n";
+ $result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
+ $result .= "URL: " . $full_url . "\n";
+
+ my $repos_root = $gs->ra->{repos_root};
+ Git::SVN::remove_username($repos_root);
+ $result .= "Repository Root: $repos_root\n";
+ $result .= "Repository UUID: $uuid\n" unless $diff_status eq "A";
+ $result .= "Revision: " . ($diff_status eq "A" ? 0 : $rev) . "\n";
+
+ $result .= "Node Kind: " .
+ ($file_type eq "dir" ? "directory" : "file") . "\n";
+
+ my $schedule = $diff_status eq "A"
+ ? "add"
+ : ($diff_status eq "D" ? "delete" : "normal");
+ $result .= "Schedule: $schedule\n";
+
+ if ($diff_status eq "A") {
+ print $result, "\n";
+ return;
+ }
+
+ my ($lc_author, $lc_rev, $lc_date_utc);
+ my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $path);
+ my $log = command_output_pipe(@args);
+ my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
+ while (<$log>) {
+ if (/^${esc_color}author (.+) <[^>]+> (\d+) ([\-\+]?\d+)$/o) {
+ $lc_author = $1;
+ $lc_date_utc = Git::SVN::Log::parse_git_date($2, $3);
+ } elsif (/^${esc_color} (git-svn-id:.+)$/o) {
+ (undef, $lc_rev, undef) = ::extract_metadata($1);
+ }
+ }
+ close $log;
+
+ Git::SVN::Log::set_local_timezone();
+
+ $result .= "Last Changed Author: $lc_author\n";
+ $result .= "Last Changed Rev: $lc_rev\n";
+ $result .= "Last Changed Date: " .
+ Git::SVN::Log::format_svn_date($lc_date_utc) . "\n";
+
+ if ($file_type ne "dir") {
+ my $text_last_updated_date =
+ ($diff_status eq "D" ? $lc_date_utc : (stat $path)[9]);
+ $result .=
+ "Text Last Updated: " .
+ Git::SVN::Log::format_svn_date($text_last_updated_date) .
+ "\n";
+ my $checksum;
+ if ($diff_status eq "D") {
+ my ($fh, $ctx) =
+ command_output_pipe(qw(cat-file blob), "HEAD:$path");
+ if ($file_type eq "link") {
+ my $file_name = <$fh>;
+ $checksum = Git::SVN::Util::md5sum("link $file_name");
+ } else {
+ $checksum = Git::SVN::Util::md5sum($fh);
+ }
+ command_close_pipe($fh, $ctx);
+ } elsif ($file_type eq "link") {
+ my $file_name =
+ command(qw(cat-file blob), "HEAD:$path");
+ $checksum =
+ Git::SVN::Util::md5sum("link " . $file_name);
+ } else {
+ open FILE, "<", $path or die $!;
+ $checksum = Git::SVN::Util::md5sum(\*FILE);
+ close FILE or die $!;
+ }
+ $result .= "Checksum: " . $checksum . "\n";
+ }
+
+ print $result, "\n";
+}
+
########################### utility functions #########################
sub rebase_cmd {
@@ -1047,6 +1155,30 @@ sub linearize_history {
(\@linear_refs, \%parents);
}
+sub find_file_type_and_diff_status {
+ my ($path) = @_;
+
+ my $diff_output =
+ command_oneline(qw(diff --cached --name-status --), $path) || "";
+ my $diff_status = (split(' ', $diff_output))[0] || "";
+
+ my $ls_tree = command_oneline(qw(ls-tree HEAD), $path) || "";
+
+ return (undef, undef) if !$diff_status && !$ls_tree;
+
+ if ($diff_status eq "A") {
+ return ("link", $diff_status) if -l $path;
+ return ("dir", $diff_status) if -d $path;
+ return ("file", $diff_status);
+ }
+
+ my $mode = (split(' ', $ls_tree))[0] || "";
+
+ return ("link", $diff_status) if $mode eq "120000";
+ return ("dir", $diff_status) if $mode eq "040000";
+ return ("file", $diff_status);
+}
+
package Git::SVN::Util;
use strict;
use warnings;
diff --git a/t/t9117-git-svn-info.sh b/t/t9117-git-svn-info.sh
new file mode 100644
index 0000000..c7ca006
--- /dev/null
+++ b/t/t9117-git-svn-info.sh
@@ -0,0 +1,186 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 David D. Kilzer
+
+test_description='git-svn info'
+
+. ./lib-git-svn.sh
+
+test_expect_success 'setup repository and import' "
+ mkdir info &&
+ cd info &&
+ echo one > file &&
+ ln -s file symlink-file &&
+ mkdir directory &&
+ touch directory/.placeholder &&
+ ln -s directory symlink-directory &&
+ svn import -m 'initial' . $svnrepo &&
+ cd .. &&
+ mkdir gitwc &&
+ cd gitwc &&
+ git-svn init $svnrepo &&
+ git-svn fetch &&
+ cd ..
+ "
+
+test_expect_success 'info no arguments' "
+ (cd gitwc; git-svn info) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' |
+ git-diff ../t9117/expected.info-no-arguments -
+ "
+
+test_expect_success 'info dot' "
+ (cd gitwc; git-svn info .) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' |
+ git-diff ../t9117/expected.info-dot -
+ "
+
+test_expect_success 'info file' "
+ (cd gitwc; git-svn info file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-file -
+ "
+
+test_expect_success 'info directory' "
+ (cd gitwc; git-svn info directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' |
+ git-diff ../t9117/expected.info-directory -
+ "
+
+test_expect_success 'info symlink-file' "
+ (cd gitwc; git-svn info symlink-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-symlink-file -
+ "
+
+test_expect_success 'info symlink-directory' "
+ (cd gitwc; git-svn info symlink-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-symlink-directory -
+ "
+
+test_expect_success 'info added-file' "
+ echo two > gitwc/added-file &&
+ cd gitwc &&
+ git add added-file &&
+ cd .. &&
+ (cd gitwc; git-svn info added-file) |
+ git-diff ../t9117/expected.info-added-file -
+ "
+
+test_expect_success 'info added-directory' "
+ mkdir gitwc/added-directory &&
+ touch gitwc/added-directory/.placeholder &&
+ cd gitwc &&
+ git add added-directory &&
+ cd .. &&
+ (cd gitwc; git-svn info added-directory) |
+ git-diff ../t9117/expected.info-added-directory -
+ "
+
+test_expect_success 'info added-symlink-file' "
+ cd gitwc &&
+ ln -s added-file added-symlink-file &&
+ git add added-symlink-file &&
+ cd .. &&
+ (cd gitwc; git-svn info added-symlink-file) |
+ git-diff ../t9117/expected.info-added-symlink-file -
+ "
+
+test_expect_success 'info added-symlink-directory' "
+ cd gitwc &&
+ ln -s added-directory added-symlink-directory &&
+ git add added-symlink-directory &&
+ cd .. &&
+ (cd gitwc; git-svn info added-symlink-directory) |
+ git-diff ../t9117/expected.info-added-symlink-directory -
+ "
+
+test_expect_success 'info deleted-file' "
+ cd gitwc &&
+ git rm -f file > /dev/null &&
+ cd .. &&
+ (cd gitwc; git-svn info file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-deleted-file -
+ "
+
+test_expect_success 'info deleted-directory' "
+ cd gitwc &&
+ git rm -r -f directory > /dev/null &&
+ cd .. &&
+ (cd gitwc; git-svn info directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' |
+ git-diff ../t9117/expected.info-deleted-directory -
+ "
+
+test_expect_success 'info deleted-symlink-file' "
+ cd gitwc &&
+ git rm -f symlink-file > /dev/null &&
+ cd .. &&
+ (cd gitwc; git-svn info symlink-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-deleted-symlink-file -
+ "
+
+test_expect_success 'info deleted-symlink-directory' "
+ cd gitwc &&
+ git rm -f symlink-directory > /dev/null &&
+ cd .. &&
+ (cd gitwc; git-svn info symlink-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' |
+ git-diff ../t9117/expected.info-deleted-symlink-directory -
+ "
+
+# NOTE: git does not have the concept of replaced objects,
+# so we can't test for them.
+#test_expect_success 'info replaced-file' "/usr/bin/true"
+#test_expect_success 'info replaced-directory' "/usr/bin/true"
+#test_expect_success 'info replaced-symlink-file' "/usr/bin/true"
+#test_expect_success 'info replaced-symlink-directory' "/usr/bin/true"
+
+test_expect_success 'info unknown-file' "
+ echo two > gitwc/unknown-file &&
+ (cd gitwc; git-svn info unknown-file) 2>&1 |
+ git-diff ../t9117/expected.info-unknown-file -
+ "
+
+test_expect_success 'info unknown-directory' "
+ mkdir gitwc/unknown-directory &&
+ (cd gitwc; git-svn info unknown-directory) 2>&1 |
+ git-diff ../t9117/expected.info-unknown-directory -
+ "
+
+test_expect_success 'info unknown-symlink-file' "
+ cd gitwc &&
+ ln -s unknown-file unknown-symlink-file &&
+ cd .. &&
+ (cd gitwc; git-svn info unknown-symlink-file) 2>&1 |
+ git-diff ../t9117/expected.info-unknown-symlink-file -
+ "
+
+test_expect_success 'info unknown-symlink-directory' "
+ cd gitwc &&
+ ln -s unknown-directory unknown-symlink-directory &&
+ cd .. &&
+ (cd gitwc; git-svn info unknown-symlink-directory) 2>&1 |
+ git-diff ../t9117/expected.info-unknown-symlink-directory -
+ "
+
+test_done
diff --git a/t/t9117/expected.info-added-directory b/t/t9117/expected.info-added-directory
new file mode 100644
index 0000000..2622900
--- /dev/null
+++ b/t/t9117/expected.info-added-directory
@@ -0,0 +1,7 @@
+Path: added-directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/added-directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Revision: 0
+Node Kind: directory
+Schedule: add
+
diff --git a/t/t9117/expected.info-added-file b/t/t9117/expected.info-added-file
new file mode 100644
index 0000000..2881f93
--- /dev/null
+++ b/t/t9117/expected.info-added-file
@@ -0,0 +1,8 @@
+Path: added-file
+Name: added-file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/added-file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Revision: 0
+Node Kind: file
+Schedule: add
+
diff --git a/t/t9117/expected.info-added-symlink-directory b/t/t9117/expected.info-added-symlink-directory
new file mode 100644
index 0000000..fa3d511
--- /dev/null
+++ b/t/t9117/expected.info-added-symlink-directory
@@ -0,0 +1,8 @@
+Path: added-symlink-directory
+Name: added-symlink-directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/added-symlink-directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Revision: 0
+Node Kind: file
+Schedule: add
+
diff --git a/t/t9117/expected.info-added-symlink-file b/t/t9117/expected.info-added-symlink-file
new file mode 100644
index 0000000..cd14e62
--- /dev/null
+++ b/t/t9117/expected.info-added-symlink-file
@@ -0,0 +1,8 @@
+Path: added-symlink-file
+Name: added-symlink-file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/added-symlink-file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Revision: 0
+Node Kind: file
+Schedule: add
+
diff --git a/t/t9117/expected.info-deleted-directory b/t/t9117/expected.info-deleted-directory
new file mode 100644
index 0000000..ec8bda5
--- /dev/null
+++ b/t/t9117/expected.info-deleted-directory
@@ -0,0 +1,11 @@
+Path: directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: directory
+Schedule: delete
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+
diff --git a/t/t9117/expected.info-deleted-file b/t/t9117/expected.info-deleted-file
new file mode 100644
index 0000000..7951183
--- /dev/null
+++ b/t/t9117/expected.info-deleted-file
@@ -0,0 +1,14 @@
+Path: file
+Name: file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: delete
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 5bbf5a52328e7439ae6e719dfe712200
+
diff --git a/t/t9117/expected.info-deleted-symlink-directory b/t/t9117/expected.info-deleted-symlink-directory
new file mode 100644
index 0000000..2fb452d
--- /dev/null
+++ b/t/t9117/expected.info-deleted-symlink-directory
@@ -0,0 +1,14 @@
+Path: symlink-directory
+Name: symlink-directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/symlink-directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: delete
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 7f5674b838ad799ab8962413b1f84095
+
diff --git a/t/t9117/expected.info-deleted-symlink-file b/t/t9117/expected.info-deleted-symlink-file
new file mode 100644
index 0000000..c2945f9
--- /dev/null
+++ b/t/t9117/expected.info-deleted-symlink-file
@@ -0,0 +1,14 @@
+Path: symlink-file
+Name: symlink-file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/symlink-file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: delete
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 73f9c467f93002e83dc229a229bbc4cb
+
diff --git a/t/t9117/expected.info-directory b/t/t9117/expected.info-directory
new file mode 100644
index 0000000..29dfa37
--- /dev/null
+++ b/t/t9117/expected.info-directory
@@ -0,0 +1,11 @@
+Path: directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: directory
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+
diff --git a/t/t9117/expected.info-dot b/t/t9117/expected.info-dot
new file mode 100644
index 0000000..c3bf061
--- /dev/null
+++ b/t/t9117/expected.info-dot
@@ -0,0 +1,11 @@
+Path: .
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: directory
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+
diff --git a/t/t9117/expected.info-file b/t/t9117/expected.info-file
new file mode 100644
index 0000000..9350107
--- /dev/null
+++ b/t/t9117/expected.info-file
@@ -0,0 +1,14 @@
+Path: file
+Name: file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 5bbf5a52328e7439ae6e719dfe712200
+
diff --git a/t/t9117/expected.info-no-arguments b/t/t9117/expected.info-no-arguments
new file mode 100644
index 0000000..c3bf061
--- /dev/null
+++ b/t/t9117/expected.info-no-arguments
@@ -0,0 +1,11 @@
+Path: .
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: directory
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+
diff --git a/t/t9117/expected.info-symlink-directory b/t/t9117/expected.info-symlink-directory
new file mode 100644
index 0000000..70255ac
--- /dev/null
+++ b/t/t9117/expected.info-symlink-directory
@@ -0,0 +1,14 @@
+Path: symlink-directory
+Name: symlink-directory
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/symlink-directory
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 7f5674b838ad799ab8962413b1f84095
+
diff --git a/t/t9117/expected.info-symlink-file b/t/t9117/expected.info-symlink-file
new file mode 100644
index 0000000..8465c1d
--- /dev/null
+++ b/t/t9117/expected.info-symlink-file
@@ -0,0 +1,14 @@
+Path: symlink-file
+Name: symlink-file
+URL: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo/symlink-file
+Repository Root: file:///Users/ddkilzer/Projects/C/git/t/trash/svnrepo
+Repository UUID: REPOSITORY-UUID
+Revision: 1
+Node Kind: file
+Schedule: normal
+Last Changed Author: ddkilzer
+Last Changed Rev: 1
+Last Changed Date: LAST-CHANGED-DATE-STRING
+Text Last Updated: TEXT-LAST-UPDATED-STRING
+Checksum: 73f9c467f93002e83dc229a229bbc4cb
+
diff --git a/t/t9117/expected.info-unknown-directory b/t/t9117/expected.info-unknown-directory
new file mode 100644
index 0000000..b5eef7d
--- /dev/null
+++ b/t/t9117/expected.info-unknown-directory
@@ -0,0 +1,2 @@
+unknown-directory: (Not a versioned resource)
+
diff --git a/t/t9117/expected.info-unknown-file b/t/t9117/expected.info-unknown-file
new file mode 100644
index 0000000..89f102e
--- /dev/null
+++ b/t/t9117/expected.info-unknown-file
@@ -0,0 +1,2 @@
+unknown-file: (Not a versioned resource)
+
diff --git a/t/t9117/expected.info-unknown-symlink-directory b/t/t9117/expected.info-unknown-symlink-directory
new file mode 100644
index 0000000..37d3106
--- /dev/null
+++ b/t/t9117/expected.info-unknown-symlink-directory
@@ -0,0 +1,2 @@
+unknown-symlink-directory: (Not a versioned resource)
+
diff --git a/t/t9117/expected.info-unknown-symlink-file b/t/t9117/expected.info-unknown-symlink-file
new file mode 100644
index 0000000..cae9ab0
--- /dev/null
+++ b/t/t9117/expected.info-unknown-symlink-file
@@ -0,0 +1,2 @@
+unknown-symlink-file: (Not a versioned resource)
+
diff --git a/t/t9117/regenerate.sh b/t/t9117/regenerate.sh
new file mode 100755
index 0000000..16d039d
--- /dev/null
+++ b/t/t9117/regenerate.sh
@@ -0,0 +1,186 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 David D. Kilzer
+
+test_description='regenerate results for git-svn info'
+
+cd `dirname $0`/..
+. ./lib-git-svn.sh
+
+test_expect_success 'setup repository and import' "
+ mkdir info &&
+ cd info &&
+ echo one > file &&
+ ln -s file symlink-file &&
+ mkdir directory &&
+ touch directory/.placeholder &&
+ ln -s directory symlink-directory &&
+ svn import -m 'initial' . $svnrepo &&
+ cd .. &&
+ svn co $svnrepo svnwc
+ "
+
+test_expect_success 'info no arguments' "
+ (cd svnwc; svn info) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ >../t9117/expected.info-no-arguments
+ "
+
+test_expect_success 'info dot' "
+ (cd svnwc; svn info .) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ >../t9117/expected.info-dot
+ "
+
+test_expect_success 'info file' "
+ (cd svnwc; svn info file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-file
+ "
+
+test_expect_success 'info directory' "
+ (cd svnwc; svn info directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ >../t9117/expected.info-directory
+ "
+
+test_expect_success 'info symlink-file' "
+ (cd svnwc; svn info symlink-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-symlink-file
+ "
+
+test_expect_success 'info symlink-directory' "
+ (cd svnwc; svn info symlink-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-symlink-directory
+ "
+
+test_expect_success 'info added-file' "
+ echo two > svnwc/added-file &&
+ cd svnwc &&
+ svn add added-file > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info added-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ >../t9117/expected.info-added-file
+ "
+
+test_expect_success 'info added-directory' "
+ mkdir svnwc/added-directory &&
+ cd svnwc &&
+ svn add added-directory > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info added-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ >../t9117/expected.info-added-directory
+ "
+
+test_expect_success 'info added-symlink-file' "
+ cd svnwc &&
+ ln -s added-file added-symlink-file &&
+ svn add added-symlink-file > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info added-symlink-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ >../t9117/expected.info-added-symlink-file
+ "
+
+test_expect_success 'info added-symlink-directory' "
+ cd svnwc &&
+ ln -s added-directory added-symlink-directory &&
+ svn add added-symlink-directory > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info added-symlink-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ >../t9117/expected.info-added-symlink-directory
+ "
+
+test_expect_success 'info deleted-file' "
+ cd svnwc &&
+ svn rm --force file > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-deleted-file
+ "
+
+test_expect_success 'info deleted-directory' "
+ cd svnwc &&
+ svn rm --force directory > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ >../t9117/expected.info-deleted-directory
+ "
+
+test_expect_success 'info deleted-symlink-file' "
+ cd svnwc &&
+ svn rm --force symlink-file > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info symlink-file) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-deleted-symlink-file
+ "
+
+test_expect_success 'info deleted-symlink-directory' "
+ cd svnwc &&
+ svn rm --force symlink-directory > /dev/null &&
+ cd .. &&
+ (cd svnwc; svn info symlink-directory) |
+ sed -e 's/^\(Repository UUID:\).*/\1 REPOSITORY-UUID/' \
+ -e 's/^\(Last Changed Date:\).*/\1 LAST-CHANGED-DATE-STRING/' \
+ -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
+ >../t9117/expected.info-deleted-symlink-directory
+ "
+
+# NOTE: git does not have the concept of replaced objects,
+# so we can't test for them.
+#test_expect_success 'info replaced-file' "/usr/bin/true"
+#test_expect_success 'info replaced-directory' "/usr/bin/true"
+#test_expect_success 'info replaced-symlink-file' "/usr/bin/true"
+#test_expect_success 'info replaced-symlink-directory' "/usr/bin/true"
+
+test_expect_success 'info unknown-file' "
+ echo two > svnwc/unknown-file &&
+ (cd svnwc; svn info unknown-file) \
+ 2>../t9117/expected.info-unknown-file
+ "
+
+test_expect_success 'info unknown-directory' "
+ mkdir svnwc/unknown-directory &&
+ (cd svnwc; svn info unknown-directory) \
+ 2>../t9117/expected.info-unknown-directory
+ "
+
+test_expect_success 'info unknown-symlink-file' "
+ cd svnwc &&
+ ln -s unknown-file unknown-symlink-file &&
+ cd .. &&
+ (cd svnwc; svn info unknown-symlink-file) \
+ 2>../t9117/expected.info-unknown-symlink-file
+ "
+
+test_expect_success 'info unknown-symlink-directory' "
+ cd svnwc &&
+ ln -s unknown-directory unknown-symlink-directory &&
+ cd .. &&
+ (cd svnwc; svn info unknown-symlink-directory) \
+ 2>../t9117/expected.info-unknown-symlink-directory
+ "
+
+test_done
--
1.5.3.4
^ permalink raw reply related
* [PATCH 0/3] Implement git-svn: info
From: David D. Kilzer @ 2007-11-21 6:43 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <20071117225402.GC28755@muzzle>
I've split the original RFC patch into two patches (one for the
refactoring changes, and one for implementing the "git svn info"
command), and added a third to imlement "git svn info --url" per
Eric's request.
Eric Wong <normalperson@yhbt.net> wrote:
> "David D. Kilzer" <ddkilzer@kilzer.net> wrote:
> > Implement "git-svn info" for files and directories based on the "svn info"
> > command. Note that the -r/--revision argument is not supported yet.
> [...]
> Wow. I can honestly say I've never even noticed the "Schedule:" field
> in `svn info'. I would've been perfectly happy to accept an
> implementation of `git svn info' without that :)
I never noticed it, either, until I went to implement this feature!
My goal is to stay as true to the "svn info" output as "git svn log"
has done for "svn log".
> > I've also tried to be aggressive in extracting common code into functions.
> I like it, but this should be a separate patch.
See Patch 1/3.
> camelCase variables requires more time for the brain to parse (they're
> easier to write, but take more time to read), please use snake_case like
> the rest of git-svn (and git).
I've switched all variables from camelCase to snake_case. Sorry...old
habit.
> > + # FIXME: We use a combination of git-diff, git-ls-files and git-cat-file
> > + # to divine the state and type of object that was passed in as $path.
> > + # There has to be a better way. Note that only $diffStatus is used
> > + # beyond setting $isDirectory below.
>
> I agree it's pretty ugly. You can probably expand git-runstatus to do
> this. git-commit.sh used to use something like this until git-runstatus
> was added. On the other hand, I'd be content if we dropped support
> for this info entirely since `git-status' is perfectly good.
I thought I saw a patch on the mailing list to remove git-runstatus
after rewriting git-status in C. Because of that, I extracted this
code into a find_file_type_and_diff_status() function in Patch 2/3.
The logic in the function is much easier to follow now, and this also
resulted in cleaning up the cmd_info() function.
> IMNSHO, "URL:" and "Repository Root:" and occasionally "Revision:" (on the
> top-level directory) would be the only useful things this command would
> have to offer.
See above about emulating "svn info" as closely as possible.
> Being able to run something like `git svn info --url <path>'
> to get something like http://svn.foo.org/project/trunk/<path> would be
> nice, too.
See Patch 3/3.
> Please wrap lines at 80 characters. I have a hard time following long
> lines.
Everything has been rewrapped for 80 columns.
> git ls-tree HEAD <filename> will show the mode of a deleted file
Thanks, used this with success in find_file_type_and_diff_status().
> > + rm -rf info gitwc svnwc &&
> All git tests should start you off on a clean trash/ directory...
Removed.
> > + touch -c -r svnwc/symlink-directory gitwc/symlink-directory
> Are -r and -c portable? I remember writing test-chmtime to workaround
> some arguments for touch not being portable.
The touch and cp commands were removed after restructuring the
t/t9117-git-svn-info.sh script to use static expected-* files and
replacing command output using sed.
> Can we expect the output of "svn info" to not change between
> versions? I know "svn status" has changed between versions of
> svn. I'd prefer if we keep the expected.* files hard-coded
> in a test directory and compare those instead. Maybe use sed
> to substitute placeholders for timestamps..
Done.
> Also, git-diff can be used against arbitrary files nowadays, no
> need to rely on a working diff command in the system :)
Done.
> > + cp -p gitwc/added-file svnwc/added-file &&
> I can't remember if cp -p is portable, either...
Fixed (see above).
Dave
^ permalink raw reply
* [PATCH 1/3] git-svn: extract reusable code into utility functions
From: David D. Kilzer @ 2007-11-21 6:43 UTC (permalink / raw)
To: Eric Wong; +Cc: git, David D. Kilzer
In-Reply-To: <1195627399-25209-1-git-send-email-ddkilzer@kilzer.net>
Extacted canonicalize_path() in the main package.
Created new Git::SVN::Util package with an md5sum() function. A
new package was created so that Digest::MD5 did not have to be
loaded in the main package. Replaced code in the SVN::Git::Editor
and SVN::Git::Fetcher packages with calls to md5sum().
Extracted the format_svn_date(), parse_git_date() and
set_local_timezone() functions within the Git::SVN::Log package.
Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
---
git-svn.perl | 96 ++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 64 insertions(+), 32 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index e3e00fd..aff429a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -48,7 +48,8 @@ BEGIN {
foreach (qw/command command_oneline command_noisy command_output_pipe
command_input_pipe command_close_pipe/) {
for my $package ( qw(SVN::Git::Editor SVN::Git::Fetcher
- Git::SVN::Migration Git::SVN::Log Git::SVN),
+ Git::SVN::Migration Git::SVN::Log Git::SVN
+ Git::SVN::Util),
__PACKAGE__) {
*{"${package}::$_"} = \&{"Git::$_"};
}
@@ -580,6 +581,17 @@ sub cmd_create_ignore {
});
}
+sub canonicalize_path {
+ my ($path) = @_;
+ # File::Spec->canonpath doesn't collapse x/../y into y (for a
+ # good reason), so let's do this manually.
+ $path =~ s#/+#/#g;
+ $path =~ s#/\.(?:/|$)#/#g;
+ $path =~ s#/[^/]+/\.\.##g;
+ $path =~ s#/$##g;
+ return $path;
+}
+
# get_svnprops(PATH)
# ------------------
# Helper for cmd_propget and cmd_proplist below.
@@ -597,12 +609,7 @@ sub get_svnprops {
# canonicalize the path (otherwise libsvn will abort or fail to
# find the file)
- # File::Spec->canonpath doesn't collapse x/../y into y (for a
- # good reason), so let's do this manually.
- $path =~ s#/+#/#g;
- $path =~ s#/\.(?:/|$)#/#g;
- $path =~ s#/[^/]+/\.\.##g;
- $path =~ s#/$##g;
+ $path = canonicalize_path($path);
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
my $props;
@@ -1040,6 +1047,27 @@ sub linearize_history {
(\@linear_refs, \%parents);
}
+package Git::SVN::Util;
+use strict;
+use warnings;
+use Digest::MD5;
+
+sub md5sum {
+ my $arg = shift;
+ my $ref = ref $arg;
+ my $md5 = Digest::MD5->new();
+ if ($ref eq 'GLOB' || $ref eq 'IO::File') {
+ $md5->addfile($arg) or croak $!;
+ } elsif ($ref eq 'SCALAR') {
+ $md5->add($$arg) or croak $!;
+ } elsif (!$ref) {
+ $md5->add($arg) or croak $!;
+ } else {
+ ::fatal "Can't provide MD5 hash for unknown ref type: '", $ref, "'";
+ }
+ return $md5->hexdigest();
+}
+
package Git::SVN;
use strict;
use warnings;
@@ -2585,7 +2613,6 @@ use strict;
use warnings;
use Carp qw/croak/;
use IO::File qw//;
-use Digest::MD5;
# file baton members: path, mode_a, mode_b, pool, fh, blob, base
sub new {
@@ -2737,9 +2764,7 @@ sub apply_textdelta {
if (defined $exp) {
seek $base, 0, 0 or croak $!;
- my $md5 = Digest::MD5->new;
- $md5->addfile($base);
- my $got = $md5->hexdigest;
+ my $got = Git::SVN::Util::md5sum($base);
die "Checksum mismatch: $fb->{path} $fb->{blob}\n",
"expected: $exp\n",
" got: $got\n" if ($got ne $exp);
@@ -2758,9 +2783,7 @@ sub close_file {
if (my $fh = $fb->{fh}) {
if (defined $exp) {
seek($fh, 0, 0) or croak $!;
- my $md5 = Digest::MD5->new;
- $md5->addfile($fh);
- my $got = $md5->hexdigest;
+ my $got = Git::SVN::Util::md5sum($fh);
if ($got ne $exp) {
die "Checksum mismatch: $path\n",
"expected: $exp\n got: $got\n";
@@ -2812,7 +2835,6 @@ use strict;
use warnings;
use Carp qw/croak/;
use IO::File;
-use Digest::MD5;
sub new {
my ($class, $opts) = @_;
@@ -3116,11 +3138,9 @@ sub chg_file {
$fh->flush == 0 or croak $!;
seek $fh, 0, 0 or croak $!;
- my $md5 = Digest::MD5->new;
- $md5->addfile($fh) or croak $!;
+ my $exp = Git::SVN::Util::md5sum($fh);
seek $fh, 0, 0 or croak $!;
- my $exp = $md5->hexdigest;
my $pool = SVN::Pool->new;
my $atd = $self->apply_textdelta($fbat, undef, $pool);
my $got = SVN::TxDelta::send_stream($fh, @$atd, $pool);
@@ -3833,6 +3853,29 @@ sub run_pager {
exec $pager or ::fatal "Can't run pager: $! ($pager)";
}
+sub format_svn_date {
+ return strftime("%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)", localtime(shift));
+}
+
+sub parse_git_date {
+ my ($t, $tz) = @_;
+ # Date::Parse isn't in the standard Perl distro :(
+ if ($tz =~ s/^\+//) {
+ $t += tz_to_s_offset($tz);
+ } elsif ($tz =~ s/^\-//) {
+ $t -= tz_to_s_offset($tz);
+ }
+ return $t;
+}
+
+sub set_local_timezone {
+ if (defined $TZ) {
+ $ENV{TZ} = $TZ;
+ } else {
+ delete $ENV{TZ};
+ }
+}
+
sub tz_to_s_offset {
my ($tz) = @_;
$tz =~ s/(\d\d)$//;
@@ -3853,13 +3896,7 @@ sub get_author_info {
$dest->{t} = $t;
$dest->{tz} = $tz;
$dest->{a} = $au;
- # Date::Parse isn't in the standard Perl distro :(
- if ($tz =~ s/^\+//) {
- $t += tz_to_s_offset($tz);
- } elsif ($tz =~ s/^\-//) {
- $t -= tz_to_s_offset($tz);
- }
- $dest->{t_utc} = $t;
+ $dest->{t_utc} = parse_git_date($t, $tz);
}
sub process_commit {
@@ -3913,8 +3950,7 @@ sub show_commit_normal {
my ($c) = @_;
print '-' x72, "\nr$c->{r} | ";
print "$c->{c} | " if $show_commit;
- print "$c->{a} | ", strftime("%Y-%m-%d %H:%M:%S %z (%a, %d %b %Y)",
- localtime($c->{t_utc})), ' | ';
+ print "$c->{a} | ", format_svn_date($c->{t_utc}), ' | ';
my $nr_line = 0;
if (my $l = $c->{l}) {
@@ -3954,11 +3990,7 @@ sub cmd_show_log {
my (@args) = @_;
my ($r_min, $r_max);
my $r_last = -1; # prevent dupes
- if (defined $TZ) {
- $ENV{TZ} = $TZ;
- } else {
- delete $ENV{TZ};
- }
+ set_local_timezone();
if (defined $::_revision) {
if ($::_revision =~ /^(\d+):(\d+)$/) {
($r_min, $r_max) = ($1, $2);
--
1.5.3.4
^ permalink raw reply related
* Re: [PATCH] gitview: revamped to use string.join, stripped a function def
From: Vineet Kumar @ 2007-11-21 6:23 UTC (permalink / raw)
To: git
In-Reply-To: <91b13c310711202119j4f9e20f0n2515babe5f9217ac@mail.gmail.com>
* rae l (crquan@gmail.com) [071120 21:19]:
> Please give some comments.
Well I'm just an outside observer, but it looks like a good change to
me.
--
http://www.doorstop.net/
^ permalink raw reply
* Re: [PATCH] gitview: revamped to use string.join, stripped a function def
From: rae l @ 2007-11-21 5:19 UTC (permalink / raw)
To: Aneesh Kumar K.V, Junio C Hamano; +Cc: git, cr_quan, Scott James Remnant
In-Reply-To: <1190922917-5044-1-git-send-email-crquan@gmail.com>
Please give some comments.
On Sep 28, 2007 3:55 AM, Denis Cheng <crquan@gmail.com> wrote:
> Signed-off-by: Denis Cheng <crquan@gmail.com>
> ---
> contrib/gitview/gitview | 13 +------------
> 1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/contrib/gitview/gitview b/contrib/gitview/gitview
> index 5931766..2eb72b1 100755
> --- a/contrib/gitview/gitview
> +++ b/contrib/gitview/gitview
> @@ -36,17 +36,6 @@ except ImportError:
>
> re_ident = re.compile('(author|committer) (?P<ident>.*) (?P<epoch>\d+) (?P<tz>[+-]\d{4})')
>
> -def list_to_string(args, skip):
> - count = len(args)
> - i = skip
> - str_arg=" "
> - while (i < count ):
> - str_arg = str_arg + args[i]
> - str_arg = str_arg + " "
> - i = i+1
> -
> - return str_arg
> -
> def show_date(epoch, tz):
> secs = float(epoch)
> tzsecs = float(tz[1:3]) * 3600
> @@ -1115,7 +1104,7 @@ class GitView(object):
>
> def set_branch(self, args):
> """Fill in different windows with info from the reposiroty"""
> - fp = os.popen("git rev-parse --sq --default HEAD " + list_to_string(args, 1))
> + fp = os.popen("git rev-parse --sq --default HEAD " + " ".join(args[1:]))
> git_rev_list_cmd = fp.read()
> fp.close()
> fp = os.popen("git rev-list --header --topo-order --parents " + git_rev_list_cmd)
> --
> 1.5.3.2
--
Cheng
^ permalink raw reply
* Re: t9106 failure, bisect weirdness
From: carbonated beverage @ 2007-11-21 4:56 UTC (permalink / raw)
To: Christian Couder; +Cc: git, Eric Wong
In-Reply-To: <200711210508.27455.chriscool@tuxfamily.org>
> Ok thanks for doing that too.
> Could you also look at the "file" when the test succeed and when it does not
> and send us both versions and a diff between them (if it's not too big).
Size-wise, they're tiny -- though there's a lot of lines.
The diff:
ramune/lycaeum:t: diff -u works.t fails.t
--- works.t 2007-11-20 21:54:29.000000000 -0700
+++ fails.t 2007-11-20 21:54:39.000000000 -0700
@@ -55,9 +55,9 @@
55
56
57
-5588
+58
59
60
-6611
+61
62
63
And the full (working) file:
1
2
3
4444
5
6
7777
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
5588
59
60
6611
62
63
^ permalink raw reply
* [PATCH] When re-initializing, set shared permissions on all directories.
From: Jon Jensen @ 2007-11-21 3:48 UTC (permalink / raw)
To: git
Hi.
Below is a small patch to make git-init --shared change permissions not
just of .git/refs/ but of the other directories too.
Also a documentation patch for git-init, though after reading discussion
in the list archives from a few weeks ago, I realize people may not be
interested in documentation that shows explicit UNIX commands that may not
apply or could be considered pedantic. Let me know if there's a better way
I can approach this.
Thanks,
Jon
--
From b2895649165d7e6c4bcbe6484d66c84ea7124bd9 Mon Sep 17 00:00:00 2001
From: Jon Jensen <jon@endpoint.com>
Date: Tue, 20 Nov 2007 20:01:14 -0700
Subject: [PATCH] When re-initializing, set shared permissions on all directories.
Before this patch, when re-initializing an existing repository e.g.
as --shared=group, only .git/refs/ was set chmod g+ws. Now the
other directories get that too.
This is probably only helpful when not much has been done with the
repository yet, since it doesn't include subdirectories and files,
so add an example to the documentation to point the way for people
to finish the job.
---
Documentation/git-init.txt | 13 +++++++++++++
builtin-init-db.c | 8 +++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt
index 07484a4..c4a4757 100644
--- a/Documentation/git-init.txt
+++ b/Documentation/git-init.txt
@@ -101,6 +101,19 @@ $ git-add . <2>
<2> add all existing file to the index
+Adjust an existing git repository to work as if it had been created with git init --shared::
++
+----------------
+$ GIT_DIR=/path/to/my/.git git-init --shared <1>
+$ chgrp -R mygroup /path/to/my/.git <2>
+$ find /path/to/my/.git -type d -exec chmod g+ws {} \; <3>
+----------------
++
+<1> adjust configuration for shared repository
+<2> correct group ownership of any existing directories and files; needed if group shared by users is different than the group ownership of repository files
+<3> make all directories set group ownership of newly created files correctly in the future
+
+
Author
------
Written by Linus Torvalds <torvalds@osdl.org>
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 763fa55..d16efa5 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -24,7 +24,13 @@ static void safe_create_dir(const char *dir, int share)
exit(1);
}
}
- else if (share && adjust_shared_perm(dir))
+
+ /*
+ * If the directory already existed, we may still need
+ * to adjust permissions if this is a reinitialization
+ * for a shared repository.
+ */
+ if (share && adjust_shared_perm(dir))
die("Could not make %s writable by group\n", dir);
}
--
1.5.3.6.737.gb2895
^ permalink raw reply related
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