Nice Friday afternoon easy one for you :D
I've got 2 SVN repositories that were created from a single initial code
base.
Over a few weeks they are slightly out of sync, in some places on
purpose and in other places beacuse I haven't pushed the same changes
into both repositories when I really should have done.
Is there a reasonably straight forward way to compare the repositories
and get an overview of which files are not the same (given that the
folder structures are identical-ish etc), was thinking something like
winmerge but am looking for guidance from anyone with experience in this.
Cheers
Toby
--
Toby Skinner
Global Optima
+44 (0)7971 076226
Portfolio
http://www.globaloptima.co.uk
Linked In
http://uk.linkedin.com/pub/toby-skinner/1b/313/620
--
BNM Subscribe/Unsubscribe:
http://www.brightonnewmedia.org/options/bnmlist
BNM powered by Wessex Networks:
http://www.wessexnetworks.com
On 25 Feb 2011, at 15:39, Toby Skinner wrote:
> Hi all.
>
> Nice Friday afternoon easy one for you :D
>
> I've got 2 SVN repositories that were created from a single initial code
> base.
>
> Over a few weeks they are slightly out of sync, in some places on
> purpose and in other places beacuse I haven't pushed the same changes
> into both repositories when I really should have done.
>
> Is there a reasonably straight forward way to compare the repositories
> and get an overview of which files are not the same (given that the
> folder structures are identical-ish etc), was thinking something like
> winmerge but am looking for guidance from anyone with experience in this.
(assuming you are using a unix like os) If you just want to see which files are different/not in one repo etc etc you can just do something like:
cd /treea && find . -type f -exec md5sum {} >> ~/a.sums \;
cd /treeb && find . -type f -exec md5sum {} >> ~/b.sums \;
cd && diff -u a.sum b.sums
That will of course contain all the .svn directories too. If treea and treeb are directories obtained via 'svn export' then you won't have that problem.
Cheers
H
> Hi,
>
> On 25 Feb 2011, at 15:39, Toby Skinner wrote:
>
> > Hi all.
> >
> > Nice Friday afternoon easy one for you :D
> >
> > I've got 2 SVN repositories that were created from a single initial code
> > base.
> >
> > Over a few weeks they are slightly out of sync, in some places on
> > purpose and in other places beacuse I haven't pushed the same changes
> > into both repositories when I really should have done.
> >
> > Is there a reasonably straight forward way to compare the repositories
> > and get an overview of which files are not the same (given that the
> > folder structures are identical-ish etc), was thinking something like
> > winmerge but am looking for guidance from anyone with experience in this.
>
>
> (assuming you are using a unix like os) If you just want to see which files
> are different/not in one repo etc etc you can just do something like:
>
>
> cd /treea && find . -type f -exec md5sum {} >> ~/a.sums \;
> cd /treeb && find . -type f -exec md5sum {} >> ~/b.sums \;
> cd && diff -u a.sum b.sums
>
> That will of course contain all the .svn directories too. If treea and
> treeb are directories obtained via 'svn export' then you won't have that
> problem.
>
You can exclude the .svn directories:
(cd /treea && find . -name .svn -prune -o -type f -print | xargs md5sum) >>
~/a.sums
(cd /treeb && find . -name .svn -prune -o -type f -print | xargs md5sum) >>
~/b.sums
comm -3 ~/[ab].sums
Man, I hate find.
However, it's probably easier to just use git. First, make /treea into a
git repository.
(cd /treea && git init && echo '.svn/' >.gitignore && git add . && git
commit -a -m 'Initial commit.')
Then, make treeb into the same git repository. :)
cd /treeb && ln -s /treea/.git
Now, you can see what's different easily!
git status
git diff
etc…
When you're done, just rm -rf /treea/.git /treeb/.git to clean up.
-Dom
(cd /treea && find . -name .svn -prune -o -type f -print0 | xargs -0 md5sum) >> ~/a.sums
Notice the -print0 instead of -print and the -0 to xargs. This uses null
delimiters rather than whitespace. The alternative is to use:
(cd /treea && find . -name .svn -prune -o -type f -exec md5sum {} \; ) >> ~/a.sums
However this isn't very efficient as you create an md5sum process for
every file. In GNU find, you can use:
(cd /treea && find . -name .svn -prune -o -type f -exec md5sum {} + ) >> ~/a.sums
which does a similar thing to xargs, but within find.
--
David Pashley
da...@davidpashley.com
Nihil curo de ista tua stulta superstitione.
> On Feb 25, 2011 at 21:31, Dominic Mitchell praised the llamas by saying:
> >
> > You can exclude the .svn directories:
> >
> > (cd /treea && find . -name .svn -prune -o -type f -print | xargs md5sum)
> >> ~/a.sums
> > (cd /treeb && find . -name .svn -prune -o -type f -print | xargs md5sum)
> >> ~/b.sums
> > comm -3 ~/[ab].sums
> >
> Bad man. Think of the spaces:
>
> (cd /treea && find . -name .svn -prune -o -type f -print0 | xargs -0
> md5sum) >> ~/a.sums
>
> Notice the -print0 instead of -print and the -0 to xargs. This uses null
> delimiters rather than whitespace.
>
>
Surely nobody would ever use whitespace in filenames!?! That's just
bonkers. :)
-Dom
Sadly they do, and they use them just at the most inopportune moment,
just to screw up your beautifully written scripts. Being a sysadmin
would be so easy if it wasn't for those bloody users.
--
David Pashley
da...@davidpashley.com
Nihil curo de ista tua stulta superstitione.