Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-11 Thread Tom Roche

summary: Testing the Demeester hook[1] shows that it does not solve the 
input-side problem (more below), though it may solve the output-side 
problem. The input-side/output-side dichotomy is detailed below.
I sketch below what an input-side solution might look like. Is there a hook (or 
other solution) that would solve the input-side problem? 

details:

Tom Roche Tue Feb 10 19:46:36 CET 2015 [2]
 note the newbie in the Subject line :-) I'm a beginner-level `git` user 
 and a totally-novice-level `vcsh` user.

Vincent Demeester Tue, 10 Feb 2015 21:27:51 +0100 [1]
 I [don't think this is] a newbie question

I installed vcsh (via debian package) late Monday night (9 Feb). It's now early 
Wednesday night (11 Feb). How I could be much more newbie?

That I've gotten to this point with vcsh is also a tribute to vcsh's ease of 
use, e.g., that the 30 Second How-to[3] works so well. (And that the vcsh 
team has done the packaging work, which is non-trivial.)

input-side vs output-side
=

 vcsh looks for executable file as hooks in $XDG_CONFIG_HOME/vcsh/hooks-enabled
 (usually $XDG_CONFIG_HOME is $HOME/.config so ~/.config/vcsh/hooks-enabled).
 Let's create an executable script : 
 ~/.config/vcsh/hooks-enabled/setUpSparseCheckout.sh

Hmm ... 'checkout' seems to imply this hook is meant to solve the output-side 
problem rather than the input-side problem. This is understandable in that 
there seems to be much more interest in the output-side than the input-side[4]; 
however, I have tried to make clear that I am concerned with the input-side and 
*not* the output-side:

Tom Roche Tue Feb 10 19:00:07 CET 2015 [4] (rearranged)
 a lotta people, for a long time, has been concerned with what I would call
 [the output-side] (or, temporally, post-commit): they don't want [to 
 checkout]
 extraneous content to checkout into their $HOME. [But] I'm asking about the
 *input* side, or *pre-commit*: how can I get a README into the root of a 
 [local] repo
 (to make it available for a remote/web repo) *without* putting it into 
 ${HOME} pre-commit?

Here's a sketch of an input-side problem (reproduced in detail below):

 1. I create repo=vcsh-bash to VC files including ~/.bash* . I add a 
 ~/README.rst to make it available to its remote/web repo, then commit and 
 push.

 2. I create repo=vcsh-emacs to VC files including ~/.authinfo , 
 ~/bin/emacsclient_helper.sh , ~/emacs/init.el , etc . I rewrite 
 ~/README.rst to make that available to the remote for vcsh-emacs, then 
 commit and push.

 3. I make a change to ~/.bashrc , which I seek to commit to vcsh-bash. 
 `vcsh vcsh-bash status` shows as modified=

 * ~/.bashrc[- that I intend]
 * ~/README.rst [- that I want to avoid]

handwaving an input-side solution
=

Here's a sketch (adapted from this vcsh issue[5]) of a workflow enable by an 
input-side solution. My guesses about what would need done to implement such a 
solution are indicated by '(TODO)':

1. `mkdir -p ~/path/to/input-side-soln/fakeroot/`
2. create/edit ~/path/to/input-side-soln/fakeroot/README.rst
3. `vcsh init input-side-soln`
4. (TODO) tell repo=input-side-soln that its filetree has *2* roots:
4.1. (TODO) a real root @ ~/
4.1. (TODO) a fake root @ ~/path/to/input-side-soln/fakeroot/
5. `vcsh input-side-soln add ~/.bashrc 
~/path/to/input-side-soln/fakeroot/README.rst`

6. input-side-soln now believes:
6.1. it has staged ./.bashrc
6.2. it should checkout ./.bashrc to ~/.bashrc
6.3. it should look for changes to ./.bashrc @ ~/.bashrc
6.4. (TODO) it has staged ./README.rst
6.5. (TODO) it should checkout ./README.rst to 
~/path/to/input-side-soln/fakeroot/README.rst
6.6. (TODO) it should look for changes to ./README.rst @ 
~/path/to/input-side-soln/fakeroot/README.rst

7. `vcsh input-side-soln status | head -n 20`
...
 Changes to be committed:
...
   new file:   .bashrc
   new file:   README.rst
8. `vcsh input-side-soln commit ...`
...
  create mode 100644 .bashrc
  create mode 100644 README.rst

9. create remote==https://bitbucket.com/tlroche/input-side-soln
10. `vcsh input-side-soln remote add ...`
11. `vcsh input-side-soln push ...`
12. I see an Overview @ https://bitbucket.com/tlroche/input-side-soln !-)

13. `mkdir -p ~/path/to/input-side-test/fakeroot/`
14. create/edit ~/path/to/input-side-test/fakeroot/README.rst
15. `vcsh init input-side-test`
16. (TODO) tell repo=input-side-test that its filetree has *2* roots:
16.1. (TODO) a real root @ ~/
16.1. (TODO) a fake root @ ~/path/to/input-side-test/fakeroot/
17. `vcsh input-side-test add ~/.emacs 
~/path/to/input-side-test/fakeroot/README.rst`

18. input-side-test now believes:
18.1. it has staged ./.emacs
18.2. it should checkout ./.emacs to ~/.emacs
18.3. it should look for changes to ./.emacs @ ~/.emacs
18.4. (TODO) it has staged ./README.rst
18.5. (TODO) it should checkout ./README.rst to 
~/path/to/input-side-test/fakeroot/README.rst
18.6. (TODO) it should look for changes to ./README.rst 

Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-11 Thread Bruce Schultz


On 12 February 2015 12:37:25 PM AEST, Tom Roche tom_ro...@pobox.com wrote:

Bruce Schultz Thu, 12 Feb 2015 12:16:46 +1000 [1]
 Your details below look way too complicated, I suspect you're trying
to make it too complex.

Did you actually *read* my post[2], or just scan it? Given that you're
using an Android client, I suspect the latter.

Guilty

There's only one innovation in my proposal, the fake root. The length
is just due to providing a usecase/scenario ... but you might have
missed that:-)

I have no clue how to get git to do what you propose in your TODO sections, 
sorry.


 you seem to have ~/.bashrc in both your bash and emacs vcsh repos.
That is going to cause trouble. You only ever want a specific file in
one vcsh repo.

Arrggg: ~/.bashrc is obviously relevant to my `bash` config, but it
also has `emacs`-configuration bits.

Maybe a ~/.bashrc.emacs and source that from the real .bashrc if it exists?

Bruce


FWIW, Tom Roche tom_ro...@pobox.com

[1]:
http://lists.madduck.net/pipermail/vcs-home/2015-February/000999.html
[2]:
http://lists.madduck.net/pipermail/vcs-home/2015-February/000998.html
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home

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


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Mark Stillwell

On 15-02-10, Richard Hartmann wrote:

On Tue, Feb 10, 2015 at 2:12 PM, Mark Stillwell mark...@fortawesome.org wrote:

Note that the version of vcsh that is packaged with some versions of ubuntu
has a bug in it, so that it will look for hooks in
$XDH_CONFIG_HOME/vcsh/hooks-enabled rather than
$XDG_CONFIG_HOME/vcsh/hooks-enabled. The easiest fix is just to set
XDH_CONFIG_HOME=${XDG_CONFIG_HOME}.


Ugh... Would anyone happen to know how backports for Ubuntu work?


Not me, apparently they don't like my bug report:

https://bugs.launchpad.net/ubuntu/+source/vcsh/+bug/1352280

--
Mark Stillwell 
___

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


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Mark Stillwell

On 15-02-10, Richard Hartmann wrote:

On Tue, Feb 10, 2015 at 2:12 PM, Mark Stillwell mark...@fortawesome.org wrote:

Note that the version of vcsh that is packaged with some versions of ubuntu
has a bug in it, so that it will look for hooks in
$XDH_CONFIG_HOME/vcsh/hooks-enabled rather than
$XDG_CONFIG_HOME/vcsh/hooks-enabled. The easiest fix is just to set
XDH_CONFIG_HOME=${XDG_CONFIG_HOME}.


Ugh... Would anyone happen to know how backports for Ubuntu work?


PS, Tom, I looked at your original request on github and saw that you had 
already discounted the sparse checkout option. I don't know of any way to 
alias some files within a repository to an alternative path without changing 
the repository root. The best thing that I could think of would be checking 
out to independent directories under $HOME/.config/ and then configuring a 
hook to automatically populate links in home...but then, if you did that you 
wouldn't need vcsh in the first place.


--
Mark Stillwell 
___

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


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread John Whitley
Tom Roche wrote:
 Unfortunately, that's not my question/problem[2]: I'm asking about the
 *input* side, or *pre-commit*: how can I get a README into the root of a
 vcsh-based repo (to make it available for a remote/web repo) *without*
 putting it into ${HOME} pre-commit?

Tom, if I understand your use case correctly, I'll suggest that you're
rather over complicating things.  Just check out your child repos
(vcsh-bash, vcsh-emacs) elsewhere for the input-side editing of the
README.rst files.  E.g. I do this sort of thing in separate clones,
unrelated to vcsh or $HOME, under ~/src.  That's also useful when I want
to work on very experimental changes that I don't want mucking up $HOME.
 So the workflow would be:

1) cd ~/src
2) git clone path-to:vcsh-bash.git
3) cd vcsh-bash
4) edit README.rst to your heart's content
5) commit, push

Wash, rinse, repeat for other repos that need README.rst files.

So long as you have the aforementioned output-side concerns taken care
of, this should work just fine.  It's always clear precisely which
README.rst you're editing and committing at a time without adding undue
weight to vcsh itself to manage this problem.

Also, thanks for bringing this question here. I've been meaning to setup
(the output-side..) stuff in my repos to allow me to add README files
for ages, and this is a great prompting to get off my arse and do it. 
;-)

Cheers,
John

P.S.  I note that the vcsh Ubuntu bug earlier in the thread is listed as
fixed as of a few hours ago (by user @racb).
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Tom Roche

Mark Stillwell Tue, 10 Feb 2015 18:41:41 + [1]
 have you considered just using normal git to create your repo in a 
 subdirectory?

Yes, originally I did this with subdirs and symlinks ... which got whacked by 
changes to `git` as mentioned, e.g., here[2].

thanks anyway, Tom Roche tom_ro...@pobox.com

[1]: http://lists.madduck.net/pipermail/vcs-home/2015-February/000988.html
[2]: 
http://stackoverflow.com/questions/2011637/how-to-have-git-1-6-follow-beyond-symlinks
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Vincent Demeester
Hi,

On February 10, 2015 7:00:07 PM GMT+01:00, Tom Roche tom_ro...@pobox.com 
wrote:

but I guess I should've spelled it out:

1. I create repo=vcsh-bash to VC files including ~/.bash* . I add a
~/README.rst to make it available to its remote/web repo, then commit
and push.

2. I create repo=vcsh-emacs to VC files including ~/.authinfo ,
~/bin/emacsclient_helper.sh , ~/emacs/init.el , etc . I rewrite
~/README.rst to make that available to the remote for vcsh-emacs, then
commit and push.

3. I make a change to ~/.bashrc , which I seek to commit to vcsh-bash.
`vcsh vcsh-bash status` shows as modified=

* ~/.bashrc: that I intend

* ~/README.rst : that I want to avoid

So do you see how the above is input-oriented, or am I unclear, or am
I missing something?

This is really hard to achieve.. There will be only one README.rst in ~/. You 
would have to chechout the correct file when you want to edit it (vcsh 
vcsh-bash run git checkout README.rst.. Right ?


By contrast, note I'm OK with the following, output-oriented usecase
(which ISTM is what you're trying to answer): on a fresh machine, I

1. Clone vcsh-bash. This *outputs* or creates ~/README.rst , which I
must delete.

2. Clone vcsh-emacs. This again outputs ~/README.rst , which again I
must delete.

Net: I don't much care if my repo *outputs* ~/README.rst post-commit ,
I just don't want to hafta *input* ~/README.rst , pre-commit, to avoid
problems with the vcsh equivalents of `git diff` and `git status`.


If you setup a vcsh hook at the 'correct' time (i.e. between the init and the 
first fetch) that will set-up the repository with sparseCheckout to ignore the 
README(s), you won't even have to think about seeing README.rst in git status 
and git diff. The downsides of this approach is that you have to create/edit 
the README outside ~/ and vcsh (in another working copy).

From my point of view, it's easier to set up, it's built-in git and vcsh and 
less error prone (I'm sure I won't ovrride the README because it's not 
present).

My 2 cents :-)

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Tom Roche

Vincent Demeester Tue Feb 10 19:30:08 CET 2015 (rearranged) [1]
 The downsides of this approach is that you have to create/edit the README 
 outside ~/ and vcsh (in another working copy).

That does *not* sound like a problem to me. In fact, (IIUC) I originally 
proposed doing something like that:

TomRoche 9 Feb 2015 ~1730 EST [2]
 I thought I could do something like

   $ mkdir -p ~/info/software/vcsh/fake_repositories/vcsh-bash-fake/
   # edit ~/info/software/vcsh/fake_repositories/vcsh-bash-fake/README.rst
   $ pushd ~/info/software/vcsh/fake_repositories/vcsh-bash-fake/
   $ ls -al # check to see that it indeed is there
   $ vcsh vcsh-bash add README.rst
   $ vcsh vcsh-bash status | | head -n 20
   ...
Changes to be committed:
   ...
  new file:   README.rst

 but vcsh is too smart for that:

   $ vcsh vcsh-bash commit -m 'add a README for the remote'
[master e4d4230] add a README for the remote
 1 file changed, 6 insertions(+)
 create mode 100644 
 info/software/vcsh/fake_repositories/vcsh-bash-fake/README.rst

 If you setup a vcsh hook at the 'correct' time (i.e. between the init and the 
 first fetch)
 that will set-up the repository with sparseCheckout to ignore the README(s),
 you won't even have to think about seeing README.rst in git status and git 
 diff.

OK, but note the newbie in the Subject line :-) I'm a beginner-level `git` 
user and a totally-novice-level `vcsh` user. So can you either explain how to 
setup the `vcsh` hook, or point me to doc? (I'm good with RTFM if I know where 
to find them.)

Your assistance is appreciated, Tom Roche tom_ro...@pobox.com

[1]: http://lists.madduck.net/pipermail/vcs-home/2015-February/000986.html
[2]: https://github.com/RichiH/vcsh/issues/147#issue-57104673
___
vcs-home mailing list
vcs-home@lists.madduck.net
http://lists.madduck.net/listinfo/vcs-home


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Vincent Demeester


Re,

Tom Roche writes:


Vincent Demeester Tue Feb 10 19:30:08 CET 2015 (rearranged) [1]
The downsides of this approach is that you have to create/edit the 
README outside ~/ and vcsh (in another working copy).


That does *not* sound like a problem to me. In fact, (IIUC) I 
originally proposed doing something like that:


TomRoche 9 Feb 2015 ~1730 EST [2]

I thought I could do something like



  $ mkdir -p ~/info/software/vcsh/fake_repositories/vcsh-bash-fake/
  # edit 
~/info/software/vcsh/fake_repositories/vcsh-bash-fake/README.rst

  $ pushd ~/info/software/vcsh/fake_repositories/vcsh-bash-fake/
  $ ls -al # check to see that it indeed is there
  $ vcsh vcsh-bash add README.rst
  $ vcsh vcsh-bash status | | head -n 20
  ...
   Changes to be committed:
  ...
 new file:   README.rst



but vcsh is too smart for that:


Richard already commented on thi (kind of) ; it's not really part of the
use cases of either git or vcsh.


  $ vcsh vcsh-bash commit -m 'add a README for the remote'
   [master e4d4230] add a README for the remote
1 file changed, 6 insertions(+)
create mode 100644 
info/software/vcsh/fake_repositories/vcsh-bash-fake/README.rst


If you setup a vcsh hook at the 'correct' time (i.e. between the init 
and the first fetch)
that will set-up the repository with sparseCheckout to ignore the 
README(s),
you won't even have to think about seeing README.rst in git status and 
git diff.


OK, but note the newbie in the Subject line :-) I'm a beginner-level
`git` user and a totally-novice-level `vcsh` user. So can you either
explain how to setup the `vcsh` hook, or point me to doc? (I'm good
with RTFM if I know where to find them.)


I didn't really notice the newbie in the subject line (I've read it on
my phone) and didn't thought it was a newbie question (and I still not
:P).

Anyway, if you're looking for help, here we go.
As we said earlier, vcsh support some kind of hook, there is multiple
place[1] where you can add yours, that's what we're going to do. We're
also gonna use a pretty cool feature of git, which is called
sparseCheckout[2].

Let's define which hook we want to use ; to do that, let's see how vcsh
clones a repository (or init it). When you call clone, it does :

1. run hook pre-clone
2. call init
2.1. run hook pre-init
2.2. create the right folder and ``cd`` in it
2.3. init it (git init..)
2.4. call upgrade
2.4.1. run hook pre-upgrade
2.4.2. configure stuff (core.bare to false, core.worktree, vcsh.vcsh,
..)
2.4.3. call use
2.4.4. run hook-post-upgrade
2.5. run hook post-init
3. configure stuff (branches, verify if the remote is empty or not, ..)
4. fetching from the remote
5. verifying if there will be no conflicts (files that are present in
$HOME that are not in the current index but are in the remote one).
6. merging it
7. […]

We want to run a command *and* set up a file before merging it (I tend
to think I want to do it as early as possible). The hooks that could
work are after the 2.3 init phase and before merging it, so it's one of:
- pre-upgrade
- post-upgrade
- post-init

I tend to use pre-upgrade but I think the best one might be post-init
:-P.

vcsh looks for executable file as hooks in
$XDG_CONFIG_HOME/vcsh/hooks-enabled (usually $XDG_CONFIG_HOME is
$HOME/config so ~/.config/vcsh/hooks-enabled). Let's create an
executable script : ~/.config/vcsh/hooks-enabled/setUpSparseCheckout.sh
with the following content.

#!/bin/sh
if ! test $(git config core.sparseCheckout) = true; then
   # Enable sparseCheckout for the repository
   git config core.sparseCheckout true
   # And write the sparseCheckout configuration where it's needed
   cat  $GIT_DIR/info/sparse-checkout  EOF
# vcsh automatic sparse-checkout configuration
*
!README
!README.rst
!README.md
!README.org
EOF
fi

A little explanation about the $GIT_DIR/info/sparse-checkout, as it is
documented : sparseCheckout is usually used to specify what files are in
; but in our case we want the opposite, specify what files are *not* in.
That's why we are first writing *, meaning includes all by default,
and then add lines like !README.rst, meaning do not checkout this
one.

Because you can set multiple hooks on vcsh, you could split the previous
one in several pieces (one for git config core.sparseCheckout, one for
the actual file, ..). That's what I'm doing on my bootstrap script[3].

I hope I helped and that it was clear enough to be understood, don't
hesitate to tell me if something is still not clear ;-). Git have also
hooks, so you could play around it too but I think it's would be too
much :P.

(Seems like I have a misconfiguration on my laptop for mails, so I'm
hopefully not reposting this, sorry if I am -_-)


[1]: https://github.com/RichiH/vcsh/blob/master/doc/hooks
[2]: https://schacon.github.io/git/git-read-tree.html#_sparse_checkout
[3]: 
https://github.com/vdemeester/vcsh-home/blob/bootstrap/bootstrap.sh#L73:L127

--
Vincent Demeester
___
vcs-home mailing 

Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Richard Hartmann
I am still not 100% sure if I understand what you want.

Another option thrown into the ring, without being sure if that would
work for you:

You could have one branch with and one without README.rst and have one
rebase on the other automagically.

As an aside: If you have more than one instance of ~/README.rst and
vcsh/Git are aware of this, they will all consider what the other
repos do as changes and thus battle each other unless you take
precautions.


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


Re: newbie: fake README for remote of a `vcsh` repo?

2015-02-10 Thread Mark Stillwell

On 15-02-09, Tom Roche wrote:


For the gory details, see

https://github.com/RichiH/vcsh/issues/147

but my request boils down to this:

I'm using `vcsh` to VC files in $HOME (et al), but

1. I want to leverage the goodness of `vcsh`/`mr` and have repos for bash, 
emacs, ssh, etc


2. I also want to have remote repos (for now, privates on Bitbucket)

3. I also want my remotes to have READMEs.

4. I'm trying to standardize my READMEs on reST (which is advantageous for 
some scientific projects on which I'm *really* working)


So I'd like to know, how to create a README.rst in a fake but committable 
vcsh repo, rather than in $HOME ? Note I'd bail to Bitbucket's web UI to 
create my READMEs, but their web editor will only take Markdown, so I'd 
very much prefer to create a ./README.rst for my project ... just not in 
$HOME.


The easiest thing to do is to set up a vcsh hook that configures the 
repositories to ignore certain files when they're checked out:


https://github.com/marklee77/homedir-bootstrap/blob/master/bootstrap.sh

To set up a new home directory I run:

curl -s 
https://raw.githubusercontent.com/marklee77/homedir-bootstrap/master/bootstrap.sh
 | sh

Note that the version of vcsh that is packaged with some versions of ubuntu 
has a bug in it, so that it will look for hooks in 
$XDH_CONFIG_HOME/vcsh/hooks-enabled rather than 
$XDG_CONFIG_HOME/vcsh/hooks-enabled. The easiest fix is just to set 
XDH_CONFIG_HOME=${XDG_CONFIG_HOME}.


Cheers,
--
Mark Stillwell 
___

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