Monday, 16 July 2007

svn switch in svn FAQ (and posting patch without attatchment - DOH!)

Yay! :) The svn people go fast.

FAQ into svn svn and onto web while we were away visiting Cobh for the weekend.
http://subversion.tigris.org/faq.html#switch-problems

I investigated the svn switch thing and make a FAQ entry but then
started to understand the problem so had to investigate more and
revise emails and the FAQ entry I had made. A few late nights last week.

Anyway eventually got everything together and posted to the svn dev list.
WITHOUT the patch for the FAQ entry!!! :( DOH.
But clever svn person Karl Fogel got it from the copy I put up for review.
And everyone is very nice on the dev and users list.

For Thunderbird I have found this: Check and Send extension:
https://addons.mozilla.org/en-US/thunderbird/addon/2281
YouI have to configure it and add list of attach keywords "attach|patch|attached|attachment"
it works! Warning dialog and lots of lovely yellow highlighting.

My internal paranoid over-shoulder watcher has not been good last week.
With root too :(
It's very twitchy now though.

  user@develop$ cd
  user@develop$ ls -al
   [ lots of stuff owned as root ]
  user@develop$  su -
  password:
  root@develop$ chown -r user:user .
  *AUGH!*

  telnet was method of connecting to machine and telnet in broken after that  spectacularily unspectacular method of making a huge mess. :(

Wednesday, 11 July 2007

svn switch problem - cannot switch from ''unclean'' checkout

Is this true? svn switch will only work if switching from a clean checkout i.e. no unversioned files and no changes of any type. (I would guess a very new and simple repository might not have this problem.)

Let's see if we can find out if people know about the "svn switch problem"
Post to svn users list and also logged comment in svn bug 2505.

http://svn.haxx.se/users/archive-2007-07/0276.shtml

Subject: svn switch problem - cannot switch from ''unclean'' checkout

Hello,

We had a bit of a problem with using svn switch.
If doing a switch and there are unversioned (maybe ignored) items in the checkout
then you can get errors and end up with an unusable repository.
We now keep a ''pristine'' clean checkout of any trunk or branch that is worked off of
and update it then copy and switch when we need to checkout.

I think this is this issue:
http://subversion.tigris.org/issues/show_bug.cgi?id=2505
http://subversion.tigris.org/issues/show_bug.cgi?id=2466

The bugs there last had activity July 2006 so I don't think they're in line to be
fixed? 

Do many large projects with lots of parallel development and branches use svn?
I wonder are people seeing this issue and giving up on using svn switch?
I was surprised this isn't better known? Or is it?

I think any project that made use of branches could benefit from having this
documented. A "bugfix" and better error would be nice also in time :)
It would be very nice if there was a note in FAQ or manual on svn switch.
If people agree this is an issue we could submit some content for that.
For now I'd like to hear what you think.

The switch is used at sites remote to the svn server to avoid doing a checkout
every time a developer moves to working in another branch.
Move to another branch is done frequently enough as all work is done on branches
using Trac tickets.

I think the switch problem is a puzzling one as to me it seems natural that if
an svn status reported that there were no changes to versioned files then a
svn switch would do the right thing and warn and move unversioned files out
of the way. The need to do switch only from pristine checkout is also not
mentioned in svn manual.

Thanks,

James.

=== Using svn switch instead of svn checkout to save time ===

A full checkout of a large repository branch may take a long time >15 mins :(
This is a problem for users who are not in same site as svn repository.
Instead of doing a checkout every time a user may checkout the trunk (or SDB) of the
project they are working on initially. They take a copy of that clean trunk and
use ''svn switch'' to change it to the branch ticket instead of checking out the
branch ticket.

Setup (initial checkout of pristine copy):
  mkdir /pristine
  cd /pristine
  svn co $SVNROOT/${project}/trunk ${project}_trunk
  gtar -zcvf ${project}_trunk.tgz ${project}_trunk

Switch (user updates pristine copy from svn, then copies it and does the switch):
  # '''Note: It is very important that the pristine copy is kept absolutely clean'''
  cd /pristine/${project}_trunk
  svn up
  cd ..
  gtar -zcvf ${project}_trunk.tgz ${project}_trunk
  cd /checkedout
  gtar -zxvf /pristine/${project}_trunk.tgz ${project}-xxx
  svn switch $SVNROOT/${project}/branches/ticket-xxx

==== support scripts and Pristine server ====

A server can be set up in each site which will keep
''pristine'' clean copies of project trunks and SDBs. The copies would be
checked out afresh once and updated nightly. (by script setup as a service)

Users on a site would use those ''pristine'' clean copies to switch from and
this would be supported by a script. A script to clear out and make ''pristine'' a checkout  is left
as an exercise to the student :-P :)

Switch from pristine: (recordings share must be mounted)
  cd /checkedout
  gtar -zxvf $SVNPRISTINE/${project}_trunk.tgz ${project}-xxx
  svn switch $SVNROOT/${project}/branches/ticket-xxx

Thursday, 5 July 2007

Gödel, Fermat and everything2.com

GEB == a book by Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid

The GEB page on everything2.com doesn't say much on the self-reference and layers of self-reference that build complex system (such as human intelligence). This for me was a puzzling thing. How come we have this "feeling" of  being/thinking?   Is there a God? :-P I wondered about that for years before I read bits in EGB again on recursive self reference. And then read the intro again. He says everything in the intro :). I had that mind opening inspiration feeling.
Godel's theorem applied to God on everything2.com

Fionn thinks I'm a bit weird I think and doesn't get the self-referential jokes. Oh well.
xkcd.com has some self-referential jokes. :)

The explaination of how we have this feeling of "I" is cool.
It could lead us into discussion of atheism.  Hmm, maybe not now. 
Belief of God as such isn't a problem as such. Wrong maybe :).
The problem is that people seem very inclined to turn over their thinking/actions to their religious leaders and also happy to obey random thoughts inside their heads if they have a belief in some higher power.
Sentient beings have to take full responsibility for themselves. (we're doomed! :) )
"This is my simple religion. There is no need for temples; no need for complicated philosophy. Our own brain, our own heart is our temple; the philosophy is kindness." -- Dalai Lama


other cute stuff from everything2.com:

Godel: any sufficiently strong axiomatic system is either inconsistent or incomplete
http://www.everything2.com/index.pl?node_id=1189604
it can be proved that if it can be proved that it can't be proved that two plus two is five, then it can be proved that two plus two is five
(from Godel's Second Incompleteness Theorem explained in words of one syllable)
Haiku: Gödel's theorem. Complete? Then inconsistent!

"1 + 1 = 2" - Principia Mathematica


"Any sufficiently advanced technology is indistinguishable from magic." - http://en.wikipedia.org/wiki/Clarke's_three_laws (3rd law)


if n is an integer larger than 2, then the equation an + bn = cn has no solution for which a, b, and c are integers larger than zero - Fermat
Demonstrationem mirabilem hanc marginis exigiutas non caperet  - Fermat
Occam's Razor ... and checking is it plugged in.


The "i" in "slithy" is long, as in "writhe"; and "toves" is pronounced so as to rhyme with "groves." Again, the first "o" in "borogoves" is pronounced like the "o" in "borrow." I have heard people try to give it the sound of the "o" in "worry. Such is Human Perversity. -- Lewis Carroll

Kitten principle: any amount more of kittens are not capable of creating more chaos than one kitten is capable of creating, but are in fact capable of being cuter.

notepad quote 0xa1 not 0x22 ? php

Fionn has a php problem and I notice in email her quotes don't look the same.
She is editing in windows notepad.

but you have bad quotes!!

  good: ">",
  bad:  ”>”,

0000130: 2e22 3e22 2c0a 0a20 2067 6f6f 643a 2022  .">",..  good: "
0000140: 3e22 2c0a 2020 6261 643a 2020 a13e a12c  >",.  bad:  .>.,
0000150: 0a0a 0a                                  ...

good quotes are 0x22  your bad quotes are 0xa1  some extended ascii character

HTH  == hopefully this helps  (or appropriately scary Hand-To-Hand ascii-jujitsu),

Thursday, 28 June 2007

graphviz bug 1042 (right-click mouse menus not selectable) is probably 524 (numlock)

Yesterday I discovered that NumLock being on made mouse menus in graphviz tools not work.
Stupid silly thing but actually not intuitively solved.
Poking around (on nternet with google) further I think this could be a more general X programming problem.
My problem is with cygwin and solaris X clients (and cygwin X server[you know about that weird X server-client switcheroo don't you?]).

Further poking:

  Use 'xev' to trace X events
  Only difference is with NumLock on event state is 0x10 and 0x410, with off state is 0 and 0x400.

  On solaris truss dotty process (lefty) truss -u a.out and truss -u lib,libX* -t '!all'
  Interesting to note that with NumLock on then there are no events when scrolling or selecting
  mouse menu item.  So it is as if the application just has not registered for those events.
  So it is a problem at X setup/initialise time.

  checkout cvs source, update cygwin dependancies (autoconf, gd, libtool, more!),
   # augh! autoconf fails because it thinks gettext is not there :(

 download latest stable graphviz source
  ./configure; make; make install
  # That works now, hurmmm. Yikers, Okay there is windows, gtk and X gui interface.  (in  cmd/lefty/ws/)

 take a simple X  application.
 That works and isn't bothered by numlock.
 Has very different X initialisation though, leaves much more to default X stuff.
 Humm. If could find a very simple example which had the numlock bad behaviour it would make finding the
 solution easier.
 Humm :-7 http://www.xfree86.org/4.4.0/XtAppAddActions.3.html
 http://www.xfree86.org/current/XtAddCallback.3.html
 http://www.cs.cf.ac.uk/Dave/X_lecture/X_book_caller/ push me!

Oh, By the way. For graphviz on cygwin (and a couple of other things) add this to  your  cygwin download sites (in Setup): http://lassauge.free.fr/cygwin



graphviz bug 1042 description isn't great, "right-click mouse menus not selectable" would be better.
A right click raises menu but nothing may be selected.

I saw bug 524 (old and closed) to do with num-lock.
It looks to me that 524 is duplicate of 1042.

I also of course see this bug (solaris and cygwin).
I toggled num-lock and hey presto the menus work.
This behaviour is very puzzling and most new users would not find the very simple solution!

It should not matter about numlock.

dot version 2.2 (Wed Mar 23 14:44:07 UTC 2005)
 on cygwin

also:
dot version 1.10 (Wed Jan  5 16:56:31 GMT 2005)
 on solaris 10(sparc)
from sunfreeware.com package:
/usr/sbin/pkgchk -l -p `which dot`
        SFWgviz

both using cygwin as X server


http://www.graphviz.org/bugs/b1042.html

http://www.graphviz.org/bugs/b524.html

http://www.google.ie/search?as_q=mouse&hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=G2&num=10&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=http%3A%2F%2Fwww.graphviz.org%2Fbugs%2F&as_rights=&safe=images

subversion move/rename and branch merge problem

Fionn is reading writing books at the moment and I find myself trying to  express and craft a warning about svn. "We want to give instructions to people on how to avoid problems I think. (and not confuse them too much with details - keep the details for our reference) It's difficult to write something simple and yet cover the problem entirely! :)" - me


WARNING: Everyone should be cautious renaming or moving things in svn.

If someone is moving(or renaming)(or deleting) directories/files then all people working off of the same branch should be notified.  It would actually be best if all work was finished up and the move/rename done while there were as few other branches off of the same branch as possible. (as few as possible = zero! - :) ) If anyone has changes to files that are renamed or moved they should be aware that their changes will be lost by any merge.

Why?

Subversion rename/move is implemented as seperate Delete and Add and this means it is as if a new entity is added at the point the rename/move is comitted. Any changes to moved entities done in parallel (and comitted after move) will be merged out and lost.




A simplest example (not with branches/merge), but results in the same problem.
Essentially a directory move was committed.
Another user had edited the files in that directory.
When that user updated from trunk the file changes were "lost".

# mary edits file
"fudir/new-fu-file.c" 3 lines, 36 characters

mary$ svn status
M      fudir/new-fu-file.c


# Meanwhile Tom is reorganising stuff. (move dir and COMMIT)

tom$ svn mv fudir/ fu-moved/
A         fu-moved
D         fudir/new-fu-file.c
D         fudir

tom$ svn ci -m"mv fudir to fu-moved"
Deleting       fudir
Adding         fu-moved

Committed revision 12.


# Mary can see there are updates and she cannot commit until after update.

mary$ svn status
M      fudir/new-fu-file.c

mary$ svn status -u
       *            fu-moved/new-fu-file.c
       *            fu-moved
M              11   fudir/new-fu-file.c
       *       11   fudir
Status against revision:     12

mary$ svn ci -m"commit to file moved away by other checkout"
Sending        trunk
svn: Commit failed (details follow):
svn: Out of date: '/trunk' in transaction '12-1'

mary$ svn up
D    fudir
A    fu-moved
A    fu-moved/new-fu-file.c
Updated to revision 12.


# hey!  Mary's changes are not lost,
# but they are now unversioned and not in svn (still in fudir)
# and the fu-moved dir contains the new-fu-file.c version that was last seen by tom
# SO if they were part of many changes it would be easy to miss them
# the only clue to this problem is the "? fudir"

mary$ svn status -u
?                   fudir
Status against revision:     12

# The correct thing to do is for Mary to restore each of her changes by hand.
# Her svn status should as a general rule have the same number of Modified/Added/... files
#  before her checkin.
# She can copy in this case as there were no modifications to the file by Tom BUT
#  copying might be the wrong thing to do if there were changes.
#  (see svn manual Branching and Merging: Resurrecting Deleted Items)

mary$ cp fudir/new-fu-file.c fu-moved/

mary$ svn status -u
?                   fudir
M              12   fu-moved/new-fu-file.c
Status against revision:     13

mary$ svn ci -m"redo change to file after dir was moved"
Sending        trunk/fu-moved/new-fu-file.c
Transmitting file data .
Committed revision 14.


http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.ref.svn.c.status



I'm very surprised this move problem is not in the manual or FAQ (or is it?)
svn manual: svn.c.move  svn.c.merge svn.branchmerge
I think it is covered in the manual:
 svn manual Branching and Merging: Resurrecting Deleted Items

This issue is documented in the wikipedia: (Current issues)
http://en.wikipedia.org/wiki/Subversion_%28software%29
And in svn roadmap: http://subversion.tigris.org/roadmap.html
 http://subversion.tigris.org/issues/show_bug.cgi?id=898
I guess this problem isn't an issue really unless a lot of parallel development and
branch/merging is being done as we are doing.
Anyway, I'm surprised it isn't highlighted more.

Friday, 22 June 2007

svn-follow-log.sh

Script to see svn branch log,
 and follow on from the log if earliest entry was a "rebranch",
 and keep on doing that until branch was really created.

Trac and mergebot very very useful for managing svn branches.
Manages making of branches and essentially  branch merges or rebranch very nicely.
 (works with branches with a parent branch too instead of trunk)

We seem to have been burnt by a big merge out on a branch.
Many revisions and a good few rebranches and merges back to parent.
So need to follow log revisions.

On command line svn log --stop-on-copy reports how to get "Previous log" revision. And now that I know what to look for I see a "Previous log" link in the trac log of any changeset which is a rebranch merge.

~/bin/svn-follow-log.sh
#!/bin/bash

if [[ "$1" == "" ]] ; then
  echo "usage: xt <ticket-nnn>"
  #TICKET=ticket-720
  exit
fi

TICKET=$1

touch ${TICKET}follow.log
BRANCHREV=quantiqa/branches/${TICKET}
SVNROOT=https://source.commprove.internal/repository

while [[ $BRANCHREV != "" ]] ; do
#echo go go go;
svn log  ${SVNROOT}/${BRANCHREV} --stop-on-copy >> ${TICKET}follow.log
BRANCHREV=`tail -2 ${TICKET}follow.log |grep "Previous log" | sed "s/.*log:\(.*\) Previous.*/\1/"`
echo $BRANCHREV
done;

http://trac.edgewall.org/

http://en.wikipedia.org/wiki/Subversion_(software)