Discussion:
Best way to correct directory error?
Bo Berglund
2018-08-11 14:41:27 UTC
Permalink
A collegue has put a project into our SVN server. The server is
organized such that every project is a top level directory.
This shall contain subdirs trunk, tags and branches.
Trunk is where the sources for the project live.

Now he has put his project sources into:
/Projectname/trunk/Projectname

What is the best way to fix this so it will reside in
/Projectname/trunk instead?

- Check out /Projectname/trunk and receive subdir Projectname
- Move to trunk on client
- svn mv Projectname/* ./*
- svn ci -m "log message"

Or after checkout:
- Move to trunk/Projectname on client
- svn mv * ../
- mv ..
- svn ci -m "log message"

I don't want to mess up the repository, so that is why I am asking....
--
Bo Berglund
Developer in Sweden
Daniel Shahaf
2018-08-11 16:37:23 UTC
Permalink
Post by Bo Berglund
/Projectname/trunk/Projectname
What is the best way to fix this so it will reside in
/Projectname/trunk instead?
- Check out /Projectname/trunk and receive subdir Projectname
- Move to trunk on client
- svn mv Projectname/* ./*
- svn ci -m "log message"
This is fine. Note that * does not usually match dotfiles, so you
should make sure to also 'svn mv Projectname/.foo .foo' for every
dotfile in Projectname/.

There are other ways but in this case there's no need for them.
(They're more useful in the opposite case, when one wants to switch from
a ^/<files> structure to a ^/trunk/<files> structure; or if there were
branches of /Projectname/trunk/Projectname around.)
Post by Bo Berglund
- Move to trunk/Projectname on client
- svn mv * ../
- mv ..
- svn ci -m "log message"
Assuming the second 'mv' was meant to be a 'cd', that's equivalent.

Cheers,

Daniel
Nico Kadel-Garcia
2018-08-12 07:26:38 UTC
Permalink
Post by Bo Berglund
A collegue has put a project into our SVN server. The server is
organized such that every project is a top level directory.
This shall contain subdirs trunk, tags and branches.
Trunk is where the sources for the project live.
/Projectname/trunk/Projectname
What is the best way to fix this so it will reside in
/Projectname/trunk instead?
- Check out /Projectname/trunk and receive subdir Projectname
- Move to trunk on client
- svn mv Projectname/* ./*
- svn ci -m "log message"
- Move to trunk/Projectname on client
- svn mv * ../
- mv ..
- svn ci -m "log message"
I don't want to mess up the repository, so that is why I am asking....
You can, in theory-arrange the content, ideally doing it one project
at a time. by moving the components with "mv" commands. I'd also
suggest doing the trunk, then the branches, then the tags, each as
their own distinct commit.

In practice, I may have a long-term better idea for you. Split the
projects, each into their own much smaller repository with only its
own history. This is also the only good chance you'r likely to get, to
*discard* inappropriate binary files, files that accidentally were
stored with passwords, and seriously obsolete branches.tags, or even
projects altogether.
Bo Berglund
2018-08-12 08:46:16 UTC
Permalink
On Sun, 12 Aug 2018 03:26:38 -0400, Nico Kadel-Garcia
Post by Nico Kadel-Garcia
In practice, I may have a long-term better idea for you. Split the
projects, each into their own much smaller repository with only its
own history. This is also the only good chance you'r likely to get, to
*discard* inappropriate binary files, files that accidentally were
stored with passwords, and seriously obsolete branches.tags, or even
projects altogether.
Our SVN repositories are organized in a similar way as the previous
CVS repositories were. I migrated the lot back in January and I had to
decide on the organization back then. We had about 10 CVS repositories
each with a lot of modules (= top level directories). Each repository
had different permission settings to allow some employees access while
denying all others.
To implement a per-project repository in SVN would lead to a
management nightmare as far as I could tell, first during migration
and second in operation when developers would add their projects to
SVN.
How could I enforce the permission restrictions in such a scenario?

So this is why I have this structure:

repository1
|- project1
| |- trunk
| |- tags
| |- branches
|- project2
| |- trunk
etc...

repository2
|- project1
| |- trunk
| |- tags
| |- branches
|- project2
| |- trunk
etc...
--
Bo Berglund
Developer in Sweden
Nico Kadel-Garcia
2018-08-12 16:38:31 UTC
Permalink
Post by Bo Berglund
On Sun, 12 Aug 2018 03:26:38 -0400, Nico Kadel-Garcia
Post by Nico Kadel-Garcia
In practice, I may have a long-term better idea for you. Split the
projects, each into their own much smaller repository with only its
own history. This is also the only good chance you'r likely to get, to
*discard* inappropriate binary files, files that accidentally were
stored with passwords, and seriously obsolete branches.tags, or even
projects altogether.
Our SVN repositories are organized in a similar way as the previous
CVS repositories were. I migrated the lot back in January and I had to
decide on the organization back then. We had about 10 CVS repositories
each with a lot of modules (= top level directories). Each repository
had different permission settings to allow some employees access while
denying all others.
To implement a per-project repository in SVN would lead to a
management nightmare as far as I could tell, first during migration
and second in operation when developers would add their projects to
SVN.
Do you really think so? I've grown very reluctant to mix many projects
into one repository. It only takes one mistake to commit 50,000
somewhat bulky files into a branch, copy or merge *one* file from that
commit into the master before you clean up, and burden the whole back
end database, and every checkout of master with that overwhelming
commit message. Smaller, more modular projects can be a very large
advantage in source control systems. I saw it.... a year ago? When
someone started loading their python "virtual environments" into a
repo, Hilarity ensued when someone didn't rea;oze tjat "pip install"
will merrily replace your core python if it detects the right version
dependencies.
Post by Bo Berglund
How could I enforce the permission restrictions in such a scenario?
repository1
|- project1
| |- trunk
| |- tags
| |- branches
|- project2
| |- trunk
etc...
repository2
|- project3
| |- trunk
| |- tags
| |- branches
|- project4
| |- trunk
etc...
I hope you don't mind that I numberd the projects individually in your
list. svnserve.conf supports having multiple groups, or admins, with
matching read and write access. It's possible to write a group for
each department, or a group for the sys-admins, that retains
administritive privileges for a set of repositories or all
repositories. Where it can get trick is when you want the people who
can *read* project1 to always, without extra fuss, include everyone
who can write half of the other projects.

Fortunately, read and write are handled distinctly, and modern LDAP
and NIS and other network compatible group privileges can *contain*
groups in other groups. So the project owner the group that owns, say
everyone in that oveseas qa group, gets write access in the
"offshoreqa" group. That group can be assigned read access to any or
all other projects individually or as part of a hierarchy of groups
and privileges. I don't recommend getting too cutesy with this. But
most of us need to control access privileges anyway, and spreading it
out to multiple svnserve.cnf files mans they can be managed
distinctly. Different project, different config file, which may match
others but doesn't have to. And my attempt to update permissions for
repository1 doesn't accidentally screw up access to all its underlying
projects.

Nathan Hartman
2018-08-12 13:32:05 UTC
Permalink
Post by Nico Kadel-Garcia
In practice, I may have a long-term better idea for you. Split the
projects, each into their own much smaller repository with only its
own history. This is also the only good chance you'r likely to get, to
*discard* inappropriate binary files, files that accidentally were
stored with passwords, and seriously obsolete branches.tags, or even
projects altogether.
svndumpfilter?
Loading...