'bzr mv' unwieldy

Asked by ToniMueller

I often work with Python namespace products, mostly in a Zope and/or Plone context. During development, I regularly find that I'd rather want to rename my product. So, eg. "name.space" becomes "other.name". In the context of a namespaced product, this means that

name.space/name/space will be transformed to other.name/other/name

More often than not, I say something like 'bzr mv --after name.space other.name", only to find that there is no way to rename the lower directories as well (bazaar says "directory ... is not versioned"), and I'm stuck with the bogus rename I have already done. I can't even 'bzr mv' the now renamed dir back to the original one, and restart the process bottom-up style, because now bzr says that the original dir is already versioned, and it can't rename the directory in question. What's the suggested way to get out of such a situation?

Question information

Language:
English Edit question
Status:
Expired
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Wouter van Heyst (larstiq) said :
#1

On Mon, Nov 03, 2008 at 11:05:41AM -0000, ToniMueller wrote:
> New question #49988 on Bazaar:
> https://answers.launchpad.net/bzr/+question/49988
>
> I often work with Python namespace products, mostly in a Zope and/or
> Plone context. During development, I regularly find that I'd rather
> want to rename my product. So, eg. "name.space" becomes "other.name".
> In the context of a namespaced product, this means that
>
> name.space/name/space will be transformed to other.name/other/name
>
> More often than not, I say something like 'bzr mv --after name.space
> other.name", only to find that there is no way to rename the lower
> directories as well (bazaar says "directory ... is not versioned"),
> and I'm stuck with the bogus rename I have already done. I can't even
> 'bzr mv' the now renamed dir back to the original one, and restart
> the process bottom-up style, because now bzr says that the original
> dir is already versioned, and it can't rename the directory in
> question. What's the suggested way to get out of such a situation?

Does it work to do:

bzr mv --after name.space/name/ other.name/other # so far what you did
bzr mv --after other.name/name/ other.name/other # use the new other.name/ but the old 'name'
bzr mv --after other.name/other/space other.name/other/name # use the new other.name/other/ but the new 'name'

In my quick testing, that workaround seemed to get it done.

I agree it would be more ideal if `bzr mv --after name.space/name
other.name/other` worked, and the helptext of mv suggests that it does,
so that is a bug imo.

Wouter

Revision history for this message
ToniMueller (support-oeko) said :
#2

Hi,

On Mon, 03.11.2008 at 19:39:26 -0000, Wouter van Heyst <email address hidden> wrote:
> Wouter van Heyst proposed the following answer:
> On Mon, Nov 03, 2008 at 11:05:41AM -0000, ToniMueller wrote:
> > New question #49988 on Bazaar:
> > https://answers.launchpad.net/bzr/+question/49988
> >
> > I often work with Python namespace products, mostly in a Zope and/or
> > Plone context. During development, I regularly find that I'd rather
> > want to rename my product. So, eg. "name.space" becomes "other.name".
> > In the context of a namespaced product, this means that
> >
> > name.space/name/space will be transformed to other.name/other/name
> >
> > More often than not, I say something like 'bzr mv --after name.space
> > other.name", only to find that there is no way to rename the lower
> > directories as well (bazaar says "directory ... is not versioned"),
> > and I'm stuck with the bogus rename I have already done. I can't even
> > 'bzr mv' the now renamed dir back to the original one, and restart
> > the process bottom-up style, because now bzr says that the original
> > dir is already versioned, and it can't rename the directory in
> > question. What's the suggested way to get out of such a situation?
>
> Does it work to do:
>
> bzr mv --after name.space/name/ other.name/other # so far what you did
> bzr mv --after other.name/name/ other.name/other # use the new other.name/ but the old 'name'
> bzr mv --after other.name/other/space other.name/other/name # use the new other.name/other/ but the new 'name'

none of these work. I have created a simple test case that shows the
error messages. I've attached a typescript, cleaned of control chars,
that demonstrates this.

Kind regards,
--Toni++

Revision history for this message
ToniMueller (support-oeko) said :
#3

Hi,

On Mon, 03.11.2008 at 21:16:28 +0100, Toni Mueller <email address hidden> wrote:
> none of these work. I have created a simple test case that shows the
> error messages. I've attached a typescript, cleaned of control chars,
> that demonstrates this.

I forgot to say that I'm still on bzr 1.5. Maybe this is the problem?

Kind regards,
--Toni++

Revision history for this message
Wouter van Heyst (larstiq) said :
#4

And now I don't see an option to attach anything, so:

#!/bin/bash

bzr=~/src/bzr/1.5/bzr\ --no-plugins
rm -rf move
$bzr init move
pushd move
$bzr mkdir name.space
$bzr mkdir name.space/name
$bzr mkdir name.space/name/space
$bzr ci -m 1
mv name.space other.name
mv other.name/name other.name/other
mv other.name/other/space other.name/other/name
$bzr st
echo -----------
$bzr mv --after name.space other.name
$bzr st
echo -----------
$bzr mv --after other.name/name other.name/other
$bzr st
echo -----------
$bzr mv --after other.name/other/space other.name/other/name
$bzr st

Revision history for this message
Wouter van Heyst (larstiq) said :
#5

On Mon, Nov 03, 2008 at 08:18:16PM -0000, ToniMueller wrote:
> Question #49988 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/49988
>
> ToniMueller gave more information on the question:
>
> Hi,
>
> On Mon, 03.11.2008 at 21:16:28 +0100, Toni Mueller <email address hidden> wrote:
> > none of these work. I have created a simple test case that shows the
> > error messages. I've attached a typescript, cleaned of control chars,
> > that demonstrates this.
>
> I forgot to say that I'm still on bzr 1.5. Maybe this is the problem?

Hmm, I don't think so. The script I'm about to attach works with 1.5 as
well. I didn't see your typescript yet, could you compare what we're
doing, and tell me what I'm missing?

Wouter

Revision history for this message
ToniMueller (support-oeko) said :
#6

Hi,

On Mon, 03.11.2008 at 21:01:01 -0000, Wouter van Heyst <email address hidden> wrote:
> Hmm, I don't think so. The script I'm about to attach works with 1.5 as

the typescript was attached to the message with the message id
<email address hidden>

Ie, my first answer to the ticket. It seems to have been stripped, so I
include it verbatim below:

---------------------------------------------------- snip
$ paster create -t plone name.space
Selected and implied templates:
  ZopeSkel#basic_namespace A project with a namespace package
  ZopeSkel#plone A Plone project

Variables:
  egg: name.space
  package: namespace
  project: name.space
Enter namespace_package (Namespace package (like plone)) ['plone']: name
Enter package (The package contained namespace package (like example)) ['example']: space
Enter zope2product (Are you creating a Zope 2 Product?) [False]:
Enter version (Version) ['0.1']:
Enter description (One-line description of the package) ['']: bla
Enter long_description (Multi-line description (in reST)) ['']: bla
Enter author (Author name) ['Plone Foundation']:
Enter author_email (Author email) ['<email address hidden>']:
Enter keywords (Space-separated keywords/tags) ['']:
Enter url (URL of homepage) ['http://svn.plone.org/svn/plone/plone.example']:
Enter license_name (License name) ['GPL']:
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]:
Creating template basic_namespace
Creating directory ./name.space
  Recursing into +namespace_package+
    Creating ./name.space/name/
    Recursing into +package+
      Creating ./name.space/name/space/
      Copying __init__.py_tmpl to ./name.space/name/space/__init__.py
    Copying __init__.py_tmpl to ./name.space/name/__init__.py
  Copying README.txt_tmpl to ./name.space/README.txt
  Recursing into docs
    Creating ./name.space/docs/
    Copying HISTORY.txt_tmpl to ./name.space/docs/HISTORY.txt
  Copying setup.cfg to ./name.space/setup.cfg
  Copying setup.py_tmpl to ./name.space/setup.py
Creating template plone
  Recursing into +namespace_package+
    Recursing into +package+
      ./name.space/name/space/__init__.py already exists (same content)
      Copying configure.zcml_tmpl to ./name.space/name/space/configure.zcml
      Copying tests.py_tmpl to ./name.space/name/space/tests.py
  Recursing into docs
    Copying INSTALL.txt_tmpl to ./name.space/docs/INSTALL.txt
    Copying LICENSE.GPL to ./name.space/docs/LICENSE.GPL
    Copying LICENSE.txt_tmpl to ./name.space/docs/LICENSE.txt
Replace 1009 bytes with 1039 bytes (0/32 lines changed; 1 lines added)
  Copying setup.py_tmpl to ./name.space/setup.py
Running /usr/bin/python setup.py egg_info
$ ls -al
total 8
drwxrwx--- 3 toni toni 1024 2008-11-03 21:07 .
drwxrwxrwt 13 root root 4096 2008-11-03 21:06 ..
drwxrwx--- 5 toni toni 1024 2008-11-03 21:07 name.space
-rw-rw---- 1 toni toni 2048 2008-11-03 21:07 typescript
$ ls -al name.space/
total 9
drwxrwx--- 5 toni toni 1024 2008-11-03 21:07 .
drwxrwx--- 3 toni toni 1024 2008-11-03 21:07 ..
-rw-rw---- 1 toni toni 31 2008-11-03 21:07 README.txt
drwxrwx--- 2 toni toni 1024 2008-11-03 21:07 docs
drwxrwx--- 3 toni toni 1024 2008-11-03 21:07 name
drwxrwx--- 2 toni toni 1024 2008-11-03 21:07 name.space.egg-info
-rw-rw---- 1 toni toni 51 2008-11-03 21:07 setup.cfg
-rw-rw---- 1 toni toni 1039 2008-11-03 21:07 setup.py
$ bzr init
$ bzr add name.space
added name.space
added name.space/README.txt
added name.space/docs
added name.space/name
added name.space/name.space.egg-info
added name.space/setup.cfg
added name.space/setup.py
added name.space/docs/HISTORY.txt
added name.space/docs/INSTALL.txt
added name.space/docs/LICENSE.GPL
added name.space/docs/LICENSE.txt
added name.space/name/__init__.py
added name.space/name/space
added name.space/name.space.egg-info/PKG-INFO
added name.space/name.space.egg-info/SOURCES.txt
added name.space/name.space.egg-info/dependency_links.txt
added name.space/name.space.egg-info/entry_points.txt
added name.space/name.space.egg-info/namespace_packages.txt
added name.space/name.space.egg-info/not-zip-safe
added name.space/name.space.egg-info/paster_plugins.txt
added name.space/name.space.egg-info/requires.txt
added name.space/name.space.egg-info/top_level.txt
added name.space/name/space/__init__.py
added name.space/name/space/configure.zcml
added name.space/name/space/tests.py
spruce 21:07:38 /tmp/t
$ bzr commit -m 'initial import'
Committing to: /tmp/t/
added name.space
added name.space/README.txt
added name.space/docs
added name.space/name
added name.space/name.space.egg-info
added name.space/setup.cfg
added name.space/setup.py
added name.space/docs/HISTORY.txt
added name.space/docs/INSTALL.txt
added name.space/docs/LICENSE.GPL
added name.space/docs/LICENSE.txt
added name.space/name/__init__.py
added name.space/name/space
added name.space/name/space/__init__.py
added name.space/name/space/configure.zcml
added name.space/name/space/tests.py
added name.space/name.space.egg-info/PKG-INFO
added name.space/name.space.egg-info/SOURCES.txt
added name.space/name.space.egg-info/dependency_links.txt
added name.space/name.space.egg-info/entry_points.txt
added name.space/name.space.egg-info/namespace_packages.txt
added name.space/name.space.egg-info/not-zip-safe
added name.space/name.space.egg-info/paster_plugins.txt
added name.space/name.space.egg-info/requires.txt
added name.space/name.space.egg-info/top_level.txt
Committed revision 1.
$ mv name.space other.name
$ mv other.name/name other.name/other
$ mv other.name/other/space other.name/other/name
$ find other.name
other.name
other.name/README.txt
other.name/name.space.egg-info
other.name/name.space.egg-info/PKG-INFO
other.name/name.space.egg-info/not-zip-safe
other.name/name.space.egg-info/entry_points.txt
other.name/name.space.egg-info/top_level.txt
other.name/name.space.egg-info/requires.txt
other.name/name.space.egg-info/namespace_packages.txt
other.name/name.space.egg-info/paster_plugins.txt
other.name/name.space.egg-info/SOURCES.txt
other.name/name.space.egg-info/dependency_links.txt
other.name/docs
other.name/docs/LICENSE.txt
other.name/docs/HISTORY.txt
other.name/docs/LICENSE.GPL
other.name/docs/INSTALL.txt
other.name/setup.cfg
other.name/other
other.name/other/name
other.name/other/name/__init__.py
other.name/other/name/configure.zcml
other.name/other/name/tests.py
other.name/other/__init__.py
other.name/setup.py
spruce 21:08:46 /tmp/t
$ bzr st
removed:
  name.space/
  name.space/README.txt
  name.space/docs/
  name.space/docs/HISTORY.txt
  name.space/docs/INSTALL.txt
  name.space/docs/LICENSE.GPL
  name.space/docs/LICENSE.txt
  name.space/name/
  name.space/name.space.egg-info/
  name.space/name.space.egg-info/PKG-INFO
  name.space/name.space.egg-info/SOURCES.txt
  name.space/name.space.egg-info/dependency_links.txt
  name.space/name.space.egg-info/entry_points.txt
  name.space/name.space.egg-info/namespace_packages.txt
  name.space/name.space.egg-info/not-zip-safe
  name.space/name.space.egg-info/paster_plugins.txt
  name.space/name.space.egg-info/requires.txt
  name.space/name.space.egg-info/top_level.txt
  name.space/name/__init__.py
  name.space/name/space/
  name.space/name/space/__init__.py
  name.space/name/space/configure.zcml
  name.space/name/space/tests.py
  name.space/setup.cfg
  name.space/setup.py
unknown:
  other.name/
  typescript
$ bzr mv --after name.space/name/ other.name/other
bzr: ERROR: Could not move name => other: other.name is not versioned.
$ bzr mv --after other.name/name/ other.name/other
bzr: ERROR: Could not move to other: other.name/other is not versioned.
$ bzr mv --after other.name/other/space other.name/other/name
bzr: ERROR: Could not move to name: other.name/other/name is not versioned.
$
---------------------------------------------------- snip

> well. I didn't see your typescript yet, could you compare what we're
> doing, and tell me what I'm missing?

I thought I'd have cut&paste'd the commands you sent above, but I
also ran the script you posted, and your script worked quite well.

Now... something in there must still be missing.

Kind regards,
--Toni++

Revision history for this message
Launchpad Janitor (janitor) said :
#7

This question was expired because it remained in the 'Open' state without activity for the last 15 days.