Re: Action stamps

2015-09-03 Thread Trevor Saunders
On Tue, Sep 01, 2015 at 02:27:22AM -0400, Jason Merrill wrote:
> On 08/29/2015 10:58 AM, Dominique d'Humières wrote:
> >>For Jakub or anyone else wanting a key to associate a file with a commit, 
> >>they can decide for themselves
> >>what date format they want to use and whether to bother with the user id. I 
> >>would think that if he is only
> >>interested in commits on the trunk (and so should use log --first-parent), 
> >>the timestamp is sufficient.
> >
> >I share Jakub’s concern about having access to an increasing labeling of the 
> >revisions. What would be the replacement of « svn update -r  »?
> 
> Given git aliases:
> 
> >stamp = show -s --format='%cI!%ce'
> >scommit = "!f(){ d=${1%%!*}; a=${1##*!}; arg=\"--until=$d -1\"; if [ 
> > $a != $1 ]; then arg=\"$arg --committer=$a\"; fi; shift; git rev-list $arg 
> > ${1:+\"$@\"}; }; f"
> >smaster = "!f(){ git scommit \"$1\" trunk --first-parent; }; f"
> >shs = "!f(){ git show $(git smaster $1); }; f"
> >slog = "!f(){ s=$1; shift; git log $(git smaster $s) $*; }; f"
> >sco = "!f(){ git checkout $(git smaster $1); }; f"
> 
> and an action stamp 2015-08-20T20:55:15Z!jason, then
> 
> git sco 2015-08-20T20:55:15Z\!jason
> 
> will check out the (most recent) commit with that stamp.  It also works with
> just the timestamp.

Personally I'd put a pretty big danger! sign with the most recent part.
Consider for example
github.com/mozilla/gecko-dev/commit/6b54a8373b439296949c7f76f6f875b3146502e5
and
github.com/mozilla/gecko-dev/commit/6a35bb7c377620e48683f30f9ef4afde20b66ed0jj

Personally I find coppy and paste hashes to work fairly well especially
since in most cases I need to look at git log or something to know what
commit I want to check out.

 if you want to be nice to readers git.git has the practice of writing
 which is good for machines
 that want sha1s and humans for whom the sha1 works, but can sometimes
 save looking anything up if they know the commit subject.

> A timestamp gives you a simple increasing (though sparse) label, though it
> might not always be unique; when I locally rebase several patches I
> sometimes get two or three with the same timestamp, which I expect to be
> preserved if I push them upstream.

 uh timestamps are most definitely not guaranteed to increase from
 parent commits to their children.  It happens to be the case with
 git-svn because the timestamp comes from when the commit was made in
 the master repo, but if you take away that master svn repo assigning
 timestamps to commits then you will end up with child commits whose
 date is before their parents.  Since rebase updates the commiter date
 but not the author one by default I guess you'd have less trouble of
 this sort if you used that, but still I wouldn't be suprised if its
 pretty easy to make those non monotonic.  Oh actually I just noticed
 you are using %cI so the commiter time which maybe makes it ok?  I'll
 continue to stay away, but at least its not obviously a trap.

Trev


> 
> Jason


Re: Action stamps

2015-09-01 Thread Jason Merrill

On 08/29/2015 10:58 AM, Dominique d'Humières wrote:

For Jakub or anyone else wanting a key to associate a file with a commit, they 
can decide for themselves
what date format they want to use and whether to bother with the user id. I 
would think that if he is only
interested in commits on the trunk (and so should use log --first-parent), the 
timestamp is sufficient.


I share Jakub’s concern about having access to an increasing labeling of the 
revisions. What would be the replacement of « svn update -r  »?


Given git aliases:


stamp = show -s --format='%cI!%ce'
scommit = "!f(){ d=${1%%!*}; a=${1##*!}; arg=\"--until=$d -1\"; if [ $a != $1 ]; then 
arg=\"$arg --committer=$a\"; fi; shift; git rev-list $arg ${1:+\"$@\"}; }; f"
smaster = "!f(){ git scommit \"$1\" trunk --first-parent; }; f"
shs = "!f(){ git show $(git smaster $1); }; f"
slog = "!f(){ s=$1; shift; git log $(git smaster $s) $*; }; f"
sco = "!f(){ git checkout $(git smaster $1); }; f"


and an action stamp 2015-08-20T20:55:15Z!jason, then

git sco 2015-08-20T20:55:15Z\!jason

will check out the (most recent) commit with that stamp.  It also works 
with just the timestamp.


A timestamp gives you a simple increasing (though sparse) label, though 
it might not always be unique; when I locally rebase several patches I 
sometimes get two or three with the same timestamp, which I expect to be 
preserved if I push them upstream.


Jason


Re: Action stamps

2015-09-01 Thread Eric S. Raymond
Jason Merrill :
> Given git aliases:
> 
> >stamp = show -s --format='%cI!%ce'
> >scommit = "!f(){ d=${1%%!*}; a=${1##*!}; arg=\"--until=$d -1\"; if [ 
> > $a != $1 ]; then arg=\"$arg --committer=$a\"; fi; shift; git rev-list $arg 
> > ${1:+\"$@\"}; }; f"
> >smaster = "!f(){ git scommit \"$1\" trunk --first-parent; }; f"
> >shs = "!f(){ git show $(git smaster $1); }; f"
> >slog = "!f(){ s=$1; shift; git log $(git smaster $s) $*; }; f"
> >sco = "!f(){ git checkout $(git smaster $1); }; f"
> 
> and an action stamp 2015-08-20T20:55:15Z!jason, then
> 
> git sco 2015-08-20T20:55:15Z\!jason
> 
> will check out the (most recent) commit with that stamp.  It also works with
> just the timestamp.

This is a corner of git of which I knew not.  How does one set this sort of
alias?  I Google...

Will git config --global alias.stamp = show -s --format='%cI!%ce

and analogous command lines work?

I think I understand what most of these are doing, but...you would be doing
a service to the world if you wrote a little shellscript that set these up,
with short explanatory comments reveraling what each is to be used for, like
this:

# sco - check out most recent commit with specified action stamp

I'd add that to the reposurgeon distribution in a heartbeat.
-- 
http://www.catb.org/~esr/;>Eric S. Raymond


Re: Action stamps

2015-09-01 Thread Jason Merrill

On 09/01/2015 11:59 AM, Eric S. Raymond wrote:

Jason Merrill :

Here's an improved version:


You wrote:

# git scommit   - list most recent commit that matches 
.
# Must also specify a branch to search or --all.

Where must the branch argument appear with respect to the other arguments?


After the stamp; otherwise it doesn't matter, it'll just be passed along 
to git rev-list.



Am I correct that this should be applied by creating or appending to an
[alias] section in ~/.gitconfig?


Yes.

Jason



Re: Action stamps

2015-09-01 Thread Jonathan Wakely
On 1 September 2015 at 10:21, Eric S. Raymond wrote:
> Jason Merrill :
>> Given git aliases:
>>
>> >stamp = show -s --format='%cI!%ce'
>> >scommit = "!f(){ d=${1%%!*}; a=${1##*!}; arg=\"--until=$d -1\"; if 
>> > [ $a != $1 ]; then arg=\"$arg --committer=$a\"; fi; shift; git rev-list 
>> > $arg ${1:+\"$@\"}; }; f"
>> >smaster = "!f(){ git scommit \"$1\" trunk --first-parent; }; f"
>> >shs = "!f(){ git show $(git smaster $1); }; f"
>> >slog = "!f(){ s=$1; shift; git log $(git smaster $s) $*; }; f"
>> >sco = "!f(){ git checkout $(git smaster $1); }; f"
>>
>> and an action stamp 2015-08-20T20:55:15Z!jason, then
>>
>> git sco 2015-08-20T20:55:15Z\!jason
>>
>> will check out the (most recent) commit with that stamp.  It also works with
>> just the timestamp.
>
> This is a corner of git of which I knew not.  How does one set this sort of
> alias?  I Google...
>
> Will git config --global alias.stamp = show -s --format='%cI!%ce
>
> and analogous command lines work?

No. You don't want the = in there to set an alias, and you need to
quote the "show -s ..." string, and escape suitably. It's easier just
to add the lines directly to ~/.gitconfig, which also lets you add a
comment saying what it does.


Re: Action stamps

2015-09-01 Thread Eric S. Raymond
Jason Merrill :
> Here's an improved version:

You wrote:

# git scommit   - list most recent commit that matches 
.
# Must also specify a branch to search or --all.

Where must the branch argument appear with respect to the other arguments?

Am I correct that this should be applied by creating or appending to an
[alias] section in ~/.gitconfig?
-- 
http://www.catb.org/~esr/;>Eric S. Raymond


Re: Action stamps

2015-08-29 Thread Jason Merrill

On 08/26/2015 01:11 PM, Eric S. Raymond wrote:

What I usually do with old commit references in comments is map them
to what I call an action stamp - a user ID followed by an RFC3339
date.  While this is theoretically not quite adequate, in practice
collisions are rare to nonexistent.


For general identification of commits, as with references automatically 
added to Bugzilla and such, that makes a lot of sense.  So in a git 
format string, %ce and %cI.  And we can map back from such a stamp to 
the commit by specifying --author as well as --until; is that what you do?


For Jakub or anyone else wanting a key to associate a file with a 
commit, they can decide for themselves what date format they want to use 
and whether to bother with the user id.  I would think that if he is 
only interested in commits on the trunk (and so should use log 
--first-parent), the timestamp is sufficient.


Jason



Re: Action stamps

2015-08-29 Thread Eric S. Raymond
Jason Merrill ja...@redhat.com:
 On 08/26/2015 01:11 PM, Eric S. Raymond wrote:
 What I usually do with old commit references in comments is map them
 to what I call an action stamp - a user ID followed by an RFC3339
 date.  While this is theoretically not quite adequate, in practice
 collisions are rare to nonexistent.
 
 For general identification of commits, as with references automatically
 added to Bugzilla and such, that makes a lot of sense.  So in a git format
 string, %ce and %cI.  And we can map back from such a stamp to the commit by
 specifying --author as well as --until; is that what you do?

When it comes up.  Which, as I noted before, is less often than people assume.
-- 
a href=http://www.catb.org/~esr/;Eric S. Raymond/a


Re: Action stamps

2015-08-29 Thread Dominique d'Humières
 For Jakub or anyone else wanting a key to associate a file with a commit, 
 they can decide for themselves
 what date format they want to use and whether to bother with the user id. I 
 would think that if he is only
 interested in commits on the trunk (and so should use log --first-parent), 
 the timestamp is sufficient.

I share Jakub’s concern about having access to an increasing labeling of the 
revisions. What would be the replacement of « svn update -r  »?

TIA

Dominique