Request: add an ability to refactor (rename ) the project

Bug #667492 reported by Alex Wolfson
50
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Quickly
New
Undecided
Unassigned

Bug Description

It would be nice to have an ability to rename the project.

I created an AppTimer project(https://launchpad.net/apptimer) and originally named it AppTime
It was impossible to correct a mistake manually, because names were used in too many places with too many combinations of upper lower cases, so I wrote a python script to do rename. Hopefully others could benefit of it as well.

Revision history for this message
Alex Wolfson (awolfson) wrote :
Revision history for this message
Tony Byrne (tony-badwolf) wrote :

I like this command. It doesn't cope with spaces in project name so I include a patch for that.
I have had this before but there is a fairly simple way to process the changes using meld.

quickly create ubuntu-application AppTime
quickly create ubuntu-application AppTimer
meld apptimer apptime
Change the filenames (in nautilus) for the green entries (mismatched filenames)
restart meld
Change the contents line by line for the red entries (mismatched contents)

There is a problem with the automatic renaming, if the old project_name (camel_case_name etc) matches a python keyword or a dictionary key it could screw up the code logic without warning. Perhaps the rename logic should test for a relevant project_name (camel_case_name etc) in the template.

Revision history for this message
Alex Wolfson (awolfson) wrote :

Thank you for the patch.

The meld process would not work for me directly. At the time I realised that I named project wrong, code had significantly deviated from the original project template, so it would be difficult to compare.

Revision history for this message
Schwarzburg (stefan-schwarzburg) wrote :

maybe it would be simpler to remove most of the locations, where the project name is used:
Example:

import projectname
projectname.projectnameconfig.__projectname_data_directory__

could easily and without any losses be named as:

import projectname
projectname.config.__data_directory__

Since all is in the "projectname" namespace, everything is unambiguous.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.