Detecting out of date checkouts, plus bind without arguments

John Arbash Meinel john at arbash-meinel.com
Tue Jun 20 16:33:03 BST 2006


Adeodato Simó wrote:
> * John Arbash Meinel [Tue, 20 Jun 2006 09:43:55 -0500]:
> 

...

> 
>> Well, you can re-issue 'bzr bind' without having to 'unbind' first. Is
>> that good enough?
> 
> Hmm, perhaps I didn't make myself clear. Imagine I do in my laptop,
> where I have a branch of my project 'foo':
> 
>   % bzr bind sftp://desktop/~/code/programs/misc/foo  # <=== NOTE 1
>   # hack, hack, hack -> all commits go to desktop as well
> 
> Then, the next day, I happen to be on a train so:
> 
>   % bzr unbind
>   # hack, hack, hack -> commits stay local
> 
> And when I get connectivity again:
> 
>   % bzr bind sftp://desktop/~/code/programs/misc/foo   # <=== NOTE 2
>   % bzr commit # -> commits get propagated to desktop

If you want, you don't have to 'unbind'. You can just issue:
'bzr commit --local'.

> 
> My wish is that, in the line marked with "NOTE 2" above, I wouldn't have
> to specify the full location again, since it was already specified
> before. In other words, I'd like for bind to remember its location, like
> pull does, and I guess that it could have a --remember option as well.
> 
> As a side comment, if anybody thinks about implementing that, please
> consider the case when in the line marked with "NOTE 1", a checkout is
> performed.

I'm not sure what you mean by 'a checkout is performed'. You could just do:
bzr checkout sftp://desktop/~/code/programs/misc/foo

Which does both 'bzr branch' and 'bzr bind'.

I understand your desire to remember the previously bound location. I
agree this should probably be done (can you file a bug?).
Right now the presence of '.bzr/branch/bound' both tells us where we are
bound, and that we are currently bound.
I see 2 resolutions, 'unbind' could create '.bzr/branch/last-bound'. Or
we could store another flag somewhere to indicate if we are actually bound.

If it helps, I think the default location for 'bzr bind' is actually the
'parent'. So if you did 'bzr get sftp://desktop/...', 'bzr bind' should
want to bind to the same location.

> 
>>>   for d in `list_of_branches`; do
>>>     if [ "$d/.bzr/repository/revisions.kndx" -nt \
>>>          "$d/.bzr/checkout/last-revision" ]; then
>>>       bzr update "$d"
>>>     fi
>>>   done
> 
>> I really don't know what you are doing trying to read 'revisions.kndx',
>> considering it may not contain anything you actually care about updating
>> (yet).
> 
> Not reading, just looking at the timestamps. But...
> 
>> You may look into doing:
> 
>> if [ tail -n1 .bzr/branch/revision-history != cat
>> .bzr/checkout/last-revision ]; then
>> ...
> 
>> That is the actual markers for the branch's last revision, versus the
>> checkouts last revision.
> 
> Yes, this expresses more clearly the idea, and works even if the
> timestamps got changed for some reason. Thanks!
> 
>> Another possibility is to just always issue 'bzr update'. If it is a
>> local branch, it is very cheap, and just does the above check before
>> returning.
> 
> Yeah, but to slow for my taste over a medium-sized number of branches. :)
> 
> Cheers,
> 

Okay. The only thing to be concerned about is line-endings. But both of
these do not have a newline after the last entry.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060620/246923ad/attachment.pgp 


More information about the bazaar mailing list