Jump to content

Renaming files with Mercurial


Recommended Posts

Hi there,

 

I've been experimenting with using Mercurial for my SCC.  I've come up against this problem and I'm wondering if anyone else has found a good way of dealing with it...

If I want to rename a file that is in the repository then I would use the Mercurial Rename function so that all the history is kept.  However, if I do this then the LabVIEW project doesn't know the file has been renamed and gets upset that it can no longer find it.

If I do it the other way round and rename the file within the LabVIEW project and commit the changes, then Mercurial things I've jsut removed the old file and added the new and the history is lost.

Can anyone help with this please?

 

Thanks,

 

 

Martin

LabVIEW 2013 | CLA

Link to comment
If I do it the other way round and rename the file within the LabVIEW project and commit the changes, then Mercurial things I've jsut removed the old file and added the new and the history is lost.

Can anyone help with this please?

 

If you rename in LabVIEW, I believe you can "Detect" renames in the Mercurial commit dialog.

It is still a bit of manual work, but I think the history is preserved.

 

/J

Link to comment

I had similar issues with SVN.  To resolve it I now use a SVN plugin to perform the rename for me, which renames it in SVN and in LabVIEW at once, so there is no issue.  I wonder if the Mercurial API could help with this tool.

 

http://lavag.org/files/file/162-mercurial-api/

 

That being said before using that API what I would do is a rename in LabVEW, then an update in SVN.  This would cause both files to be there on disk.  Then I did an SVN delete on the old one, and an SVN add on the new one.

Link to comment

Hoovah's suggestion is certainly failsafe; however, I have a question for the OP.  What's the purpose of the rename?  Depending on the rename's purpose you may want to consider using a branch: e.g., if the renaming indicates an architectural change in the overall software.  Otherwise, if the renaming isn't indicative of some larger "structural" issues, why do it?

Link to comment

I often rename when a VI no longer means what the file name may suggest.

 

I may have a VI that determines the pass/fail status of some DAQ measurements so I name it "Determine DAQ Pass Fail.vi", then I realize my software needs change and I now need to determine pass and fail status for many other mixed signals like CAN, I2C, calculated information, and other data, so I modify my VI to now handle determining Pass or Fail status for any data type but the VI name just states it works with DAQ.  So I rename the VI to be "Determine Pass Fail.vi".

Link to comment
  • 11 months later...

 

....If I want to rename a file that is in the repository then I would use the Mercurial Rename function so that all the history is kept....

 

Martin

LabVIEW 2013 | CLA

 

Open the VI in the LabVIEW project.

Rename through TortoiseHg.

From the VI:  File » Save As » Rename » select the file on disk that you just renamed via TortoiseHg

(Do not revert if prompted.)

From TortoiseHg, commit changes with "Renamed VI" comment.

 

Aside:  I've been having issues with renaming through Tortoise lately, so you may have to use the command line.

Link to comment

I have a VI that I use for renaming when Tortoise flakes out.  Open, populate the path controls (repo folder path, old file path, new file path), and run.  I can't seem to figure out how to post it here (VI nor snippet).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.