7

I would like to know how to rename a branch specification (aka, a "branch mapping") in perforce. The P4V client does not allow you to edit the branch spec name.

Is it safe to just add another branch specification, copy the settings and remove the old one?

raven
  • 18,004
  • 16
  • 81
  • 112
sorin
  • 161,544
  • 178
  • 535
  • 806
  • Yes, but you will lose the file change history, see my answer below for renaming branchs and keeping the change history – mas_oz2k1 Nov 15 '11 at 00:14

4 Answers4

9

Perforce does not provide a mechanism to rename a branch specification. Perhaps they fear you may inadvertently break some scripts if you go and rename one?

Yes, it is safe to create a new one, copy the settings from the old and delete it (provided nothing is relying on a branch specification with that old name, of course).

raven
  • 18,004
  • 16
  • 81
  • 112
2

Lack of branch spec renaming extends to all specs (users, groups, clients, labels, jobs, etc.). This is where the command line can come in handy:

p4 branch -o OLDBRANCH | sed -e "s,OLDBRANCH,NEWBRANCH," | p4 branch -i && p4 branch -d OLDBRANCH
0

Check this link:

http://kb.perforce.com/article/24/renaming-depot-directories

The procedure depends on your server version. For example in the 2009+ servers you use pedit and pmove to rename and keep your file history.

mas_oz2k1
  • 2,851
  • 3
  • 34
  • 41
-1

Yes. But you need to do an p4 integrate to get the files over. That is what p4v "copy or rename" does. Use the rename option, that also deletes the old files.

Brian Carlton
  • 7,545
  • 5
  • 38
  • 47