Detecting out of date checkouts, plus bind without arguments

Adeodato Simó dato at net.com.org.es
Tue Jun 20 16:05:05 BST 2006


* John Arbash Meinel [Tue, 20 Jun 2006 09:43:55 -0500]:

> Adeodato Simó wrote:

> > P.S.: I don't know if it has been proposed before, but would you think
> > it'd make sense for `bzr bind $foo` to record $foo as the default bind
> > location (a-la-pull), so that `bzr unbind; bzr bind` works and is a
> > noop? I guess you can see the usefulness of it in a scenario like the
> > above, when the location to bind to is always the same (a pretty common
> > scenario, I'd say?)

> 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

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.

> >   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,

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
The easy way is the wrong way, and the hard way is the stupid way. Pick one.





More information about the bazaar mailing list