Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread martin f krafft
also sprach Dieter Plaetinck  [2011.03.20.1235 +0100]:
> oh, one more thing.
> you can query the current branch in a pure-python way, by reading .git/HEAD

No, please do not use this. Use

  git symbolic-ref -q HEAD || git name-rev --name-only HEAD

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
sex an und für sich ist reine selbstbefriedigung.
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread Dieter Plaetinck
On Wed, 23 Mar 2011 08:00:27 +0100
martin f krafft  wrote:

> also sprach Dieter Plaetinck  [2011.03.20.1235
> +0100]:
> > oh, one more thing.
> > you can query the current branch in a pure-python way, by
> > reading .git/HEAD
> 
> No, please do not use this. Use
> 
>   git symbolic-ref -q HEAD || git name-rev --name-only HEAD
> 

well, the idea behind doing it in pure-python is removing the overhead
of spawning extra processes, do you have an argument why reading the
branchname of the current HEAD in a few lines of python is bad?

Dieter
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread René Mayrhofer
Am Mittwoch, 23. März 2011, um 09:33:37 schrieb Dieter Plaetinck:
> On Wed, 23 Mar 2011 08:00:27 +0100
> martin f krafft  wrote:
> 
> > also sprach Dieter Plaetinck  [2011.03.20.1235
> > +0100]:
> > > oh, one more thing.
> > > you can query the current branch in a pure-python way, by
> > > reading .git/HEAD
> > 
> > No, please do not use this. Use
> > 
> >   git symbolic-ref -q HEAD || git name-rev --name-only HEAD
> > 
> 
> well, the idea behind doing it in pure-python is removing the overhead
> of spawning extra processes, do you have an argument why reading the
> branchname of the current HEAD in a few lines of python is bad?

I agree with Martin that parsing git internals does not seem the right way to 
do it - they might change at some point. Additionally, I'd like to keep 
dvcs-autosync as agnostic to the used DVCS as possible (otherwise it will 
quickly become a git-autosync). At the moment, the DVCS can be swapped out by 
changing only the config file options. If I can keep that without sacrificing 
too much performance, I'd like to do so.

best regards,
Rene


signature.asc
Description: This is a digitally signed message part.
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread martin f krafft
also sprach Dieter Plaetinck  [2011.03.23.0933 +0100]:
> well, the idea behind doing it in pure-python is removing the
> overhead of spawning extra processes, do you have an argument why
> reading the branchname of the current HEAD in a few lines of
> python is bad?

.git/* is not a public API. It's considered internal.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"america may be unique in being a country which has leapt
 from barbarism to decadence without touching civilization."
-- john o'hara
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread Felix Kaiser
On Wed, Mar 23, 2011 at 11:50 AM, martin f krafft  wrote:
>
> also sprach Dieter Plaetinck  [2011.03.23.0933 +0100]:
> > well, the idea behind doing it in pure-python is removing the
> > overhead of spawning extra processes, do you have an argument why
> > reading the branchname of the current HEAD in a few lines of
> > python is bad?
>
> .git/* is not a public API. It's considered internal.
>

Not its not.

Its even documented[1]: "... a valid git repository must have the HEAD
file; some porcelains may use it to guess the designated "default"
branch of the repository (usually master)."

(dvcs-autosync is such a porcelain)

Greetings
Felix

[1] http://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: Python script for automatic synchronization based on inotify

2011-03-23 Thread martin f krafft
also sprach Felix Kaiser  [2011.03.23.1250 +0100]:
> > .git/* is not a public API. It's considered internal.
> >
> 
> Not its not.
> 
> Its even documented[1]: "... a valid git repository must have the
> HEAD file; some porcelains may use it to guess the designated
> "default" branch of the repository (usually master)."

Ha. This is news to me. Interesting, thanks.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"next the statesmen will invent cheap lies, putting the blame upon the
 nation that is attacked, and every man will be glad of those
 conscience-soothing falsities, and will diligently study them, and
 refuse to examine any refutations of them; and thus he will by and by
 convince himself that the war is just, and will thank god for the
 better sleep he enjoys after this process of grotesque
 self-deception."
 -- mark twain
 
spamtraps: madduck.bo...@madduck.net


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home