Bug 694698

Summary: Request for "publican rename" feature
Product: [Community] Publican Reporter: Kate Grainger <kgrainge>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: Ruediger Landmann <rlandman>
Severity: low Docs Contact:
Priority: unspecified    
Version: futureCC: mmcallis, publican-list, rnewton
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-25 20:42:42 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Kate Grainger 2011-04-07 23:45:36 EDT
Description of problem:
When I change the title of a book, I have to change it in a billion (ok, 4) places and it's annoying and takes time better spent elsewhere.

How reproducible:
Very, with any new product comes name changes (and title changes). 

Steps to Reproduce:
1. Make a book with Title1.
2. Get word that your book now needs to have Title2.
3. Change the title in a billion places.
4. Get annoyed.
  
Actual results:
"Ugh, another name change?" and grumbling.

Expected results:
"Another name change? Sure, no problem!" and jubilation.

Additional info:
Please, sirs, can I have:
"publican rename" 
1. publican clean
2. change: the name of ent and xml files, and that entity, and the book_info <title> element, to be all the same thing
Comment 1 Rebecca Newton 2011-04-07 23:46:48 EDT
+1!
Comment 2 Jeff Fearn 2011-04-07 23:58:27 EDT
Well we have a distinct lack of jubilation, but the problem I see with this is SCM related. The files will no longer match what is in SVN/GIT/??? and that will have to be done manually.

Cheers, Jeff.
Comment 3 Jeff Fearn 2011-04-08 01:19:55 EDT
Just to clarify:

(In reply to comment #2)
> Well we have a distinct lack of jubilation,

This is sad but true, and it would be nice to get some jubilation!

> but the problem I see with this is
> SCM related. The files will no longer match what is in SVN/GIT/??? and that
> will have to be done manually.

If you are OK with this limitation then we can do this for Publican 3.

Cheers, Jeff.
Comment 4 Kate Grainger 2011-04-08 01:29:31 EDT
Hooray, I thought it was a rule that everyone's first RFE gets shot down, so that's great news! I feel...I feel...jubilant! 

I'm perfectly happy with that limitation, especially if publican rename gives me a friendly reminder to move about my files when it has successfully completed. (*hint hint*)
Comment 5 Jeff Fearn 2011-04-18 02:41:41 EDT
As part of #688585 a new parameter was added, mainfile, so I should be able to get this working without renaming any files, which makes the impact on repositories go away!
Comment 6 Kate Grainger 2011-04-18 03:02:19 EDT
<jubilation in the village>
:D
Comment 7 Jeff Fearn 2011-04-18 21:58:11 EDT
Added rename action.

Committed revision 1758.

$ publican --help rename
rename
    Rename a publican book

    Options:
<snip common options>
        --name=<NAME>             The name of the book, article, set, or brand
        --product=<PRODUCT>       The name of the product
        --version=<VERSION>       The version of the product


$ publican package --lang en-US
Wrote: /home/jfearn/Source/fedora/publican/trunk/publican/Users_Guide/build/rpm/Publican-Users_Guide-2.6-web-en-US-2.6-1.el5.src.rpm

$ publican rename --name "New Book Name" --product "New Product" --version 3.0

$ publican package --lang en-US
/Wrote: home/jfearn/Source/fedora/publican/trunk/publican/Users_Guide/build/rpm/New_Product-New_Book_Name-3.0-web-en-US-2.6-1.el5.src.rpm

$ svn status
M       en-US/Book_Info.xml
M       publican.cfg
Comment 8 Jeff Fearn 2011-07-07 06:16:42 EDT
Back ported to branches/publican-2x

Committed revision 1810.
Comment 9 Rebecca Newton 2011-07-12 02:43:01 EDT
Hi Jeff, I'm just testing this to make the stage all better, and I'm not sure what the expected behavior of this is. I thought it would rename the actual local .ent and .xml files or even the folder itself, but all I can see is it changing the <productname>, <productnumber> and <title> in the Book_Info.xml. 

I have probably completely misunderstood, haven't I?
Comment 10 Jeff Fearn 2011-07-12 02:51:18 EDT
(In reply to comment #9)
> Hi Jeff, I'm just testing this to make the stage all better, and I'm not sure
> what the expected behavior of this is. I thought it would rename the actual
> local .ent and .xml files or even the folder itself, but all I can see is it
> changing the <productname>, <productnumber> and <title> in the Book_Info.xml. 
> 
> I have probably completely misunderstood, haven't I?

Hi, changing the file names would mean having to work out what SCM was being used then supporting every SCM to rename the file and not lose history. This was deemed too error prone. So what we do is modify the publican config so that it uses the new book name and the old book file, meaning we keep SCM history and don't need to rename files. Building the package should use the new book name.

Cheers, Jeff.
Comment 11 Rebecca Newton 2011-07-12 19:36:10 EDT
Okay, thanks. In that case, I can verify that this works as expected!