Discussion:
[p4] Moving folders to another depot?
Gabor Maghera
2012-11-12 18:35:01 UTC
Permalink
Posted on behalf of forum user 'Gabor Maghera'.

You mentioned moving workspace in your question, and it's a little unclear
to me what you are trying to move. If you mean moving a file structure from one
depot to another, you can use the move/rename functionality available in P4V and
P4. It will preserve the history of the files and will show them having
originated in the original depot.

Another technique you could use is p4 duplicate followed by p4 obliterate on the
set files you are trying to move. That sequence of steps will make the history
of the moved files to look as if they were always in the new depot (the target
of your move).



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-12 19:25:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6557]
Gabor Maghera, on 2012/11/12 18:30:47 UTC, said:
> You mentioned moving workspace in your question - it's a little unclear to me what you are trying to move. If you mean moving a file structure from one depot to another, you can use the move/rename functionality available in P4V and P4. It will preserve the history of the files and will show them having originated in the original depot.
>
> Another technique you could use is p4 duplicate followed by p4 obliterate on the set files you are trying to move. That sequence of steps will make the history of the moved files to look as if they were always in the new depot (the target of your move).
>

Gabor thanks for the follow up on this.

I have posted this question on Stackoverflow forums but I did not get any real
answers.


So here is what I want

-- Current

//Depot-A
-->folder1
-->folder2

-- I want

//Depot-A
-->folder1

//Depot-B
-->folder2



I tried the move rename solution based on a knowledge base article but it game
me some errors that I do not remember now. I am pretty sure that I did not have
any unresolved conflict or checkout files on the intended folder. I am really
not sure if the KB article was meant for moving within the same depot.

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

Would you mind articulating your second solution better?

thanks



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Gabor Maghera
2012-11-12 19:45:01 UTC
Permalink
Posted on behalf of forum user 'Gabor Maghera'.

Certainly.

Here are the steps to take for the case you described:



- p4 duplicate //Depot-A/ folder2/... //Depot-B/ folder2/...
- p4 obliterate //Depot-A/ folder2/...


Step 1 duplicates the files and history of folder2 to under Depot-B. Step 2
removes the redundant files and history from Depot-A. Be careful with this last
step, there's no undo.

Hope this explains it a little better. Feel free to ping me if still unclear.

Cheers,
Gabor



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-12 21:00:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6560]
Gabor Maghera, on 2012/11/12 19:44:52 UTC, said:
> Certainly.
>
> Here are the steps to take for the case you described:
>

>
> - p4 duplicate //Depot-A/ folder2/... //Depot-B/ folder2/...
> - p4 obliterate //Depot-A/ folder2/...

>
> Step 1 duplicates the files and history of folder2 to under Depot-B. Step 2 removes the redundant files and history from Depot-A. Be careful with this last step, there's no undo.
>
> Hope this explains it a little better. Feel free to ping me if still unclear.
>
> Cheers,
> Gabor
>

Gabor thanks

Here is a message that I am getting

p4 duplicate //depot/folder2/... //Project/folder2/...

//Project/folder2/... - must refer to client 'k_PRJ'.

"k_PRJ" is my current workspace name

thanks



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Gabor Maghera
2012-11-12 23:15:01 UTC
Permalink
Posted on behalf of forum user 'Gabor Maghera'.

That error message is misleading. Posted Image

You need to create the depot you are going to duplicate to beforehand
(//Project). The duplicate operation cannot create depots.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-13 06:35:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6564]
Gabor Maghera, on 2012/11/12 23:12:02 UTC, said:
> That error message is misleading. Posted Image
>
> You need to create the depot you are going to duplicate to beforehand (//Project). The duplicate operation cannot create depots.
>


Gabor,

This worked great. Thanks for your helped



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-17 18:20:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6564]
Gabor Maghera, on 2012/11/12 23:12:02 UTC, said:
> That error message is misleading. Posted Image
>
> You need to create the depot you are going to duplicate to beforehand (//Project). The duplicate operation cannot create depots.
>

Hi

I just want to check one thing here. It seems like when I duplicated the folder
under another depot, it did not seem to actually move the folder. The duplicated
folder yet lives under the depotA(in the file system) but in the admin panel the
folder shows up under the DepotB. Is that how it is supposed to work with the
duplication?


thanks



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-18 06:40:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.

This is really disappointing :( I have wasted over 3 days and yet I do not
have a clear solution. The folders look like they moved in the P4V however in
the server root folder they are living in the original folder they were in prior
to moving. I am thinking that Perforce is not really for me, This is just too
much work with little gain for a contractor setup.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Matt Janulewicz
2012-11-18 07:17:50 UTC
Permalink
There is a fundamental concept behind Perforce you need to understand, and that is that the metada is stored and queried on the server. The idea that there is a database tracking files on the server is really important to understand.

When you duplicate a file (or branch it), it just makes a new reference in the database that points to the same physical archive file. Once you duplicate a file you'll notice that they both show up in the original changelist that added them. You'll also notice that if you duplicate a million files that take up hundreds of gigs worth of space on the server, it will do this very quickly because it's not actually copying hundreds of gigs of files, it's just making new database entries that reference the same thing.

And once you obliterate the old files, after you have duplicated them, you'll notice that the archive tree *still* looks the same. P4 does a lot of magic in the database only. It doesn't waste its time copying big chunks of archive files since the database obscures all that. Why bother?

So just understand that what the p4 client(s) say is truth. The second you do anything with a p4 server that branches or duplicates the file, the structure of your archive files will not match up to what you see in the client. I'd guess that most p4 servers deviate almost immediately, which is why you'll rarely hear anything on this mailing list or when speaking with p4 support that mentions the archives, or manipulating the archives, or anything like that. Perforce does not work in an archive-centric way like a lot of other tools do.

The only time I concern myself with the archives is when I have a partition that runs out of space and I have to move a depot somewhere else. I don't think any p4 admin would be able to look at their archive files and be able to tell you what the structure of the actual code is. It's a moot point when you have a database directing traffic.


--
Matt Janulewicz
Lucasfilm Entertainment Company Ltd.


________________________________________
From: perforce-user-***@perforce.com [perforce-user-***@perforce.com] on behalf of yarun [perforce-user-***@forums.perforce.com]
Sent: Saturday, November 17, 2012 10:40 PM
To: perforce-***@perforce.com
Subject: Re: [p4] Moving folders to another depot?

Posted on behalf of forum user 'yarun'.

This is really disappointing :( I have wasted over 3 days and yet I do not
have a clear solution. The folders look like they moved in the P4V however in
the server root folder they are living in the original folder they were in prior
to moving. I am thinking that Perforce is not really for me, This is just too
much work with little gain for a contractor setup.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
yarun
2012-11-18 07:45:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.

Matt

I appreciate the insight. I understand that perforce keeps things intact while
maintaining a database that is superior to the file system. My problem is that
it is a bit disorienting to see that my file structure does not match my p4
structure. Normally that would not be a problem if perforce was using some
jumbled letters to maintain a file system but that is not the case it follows
what the user logically structures(at least in the beginning). It is like a
trail left that is never going to disappear.

It is good to know that what I see in the p4v is the truth however I would
really like to move that darn folder out of the depot folder for my own sanity
for the time being. If there is no way(obviously without loosing changelist),
then I have to accept it as it is and move on to another app solution because
that is not a good fit for my own work flow.

thanks



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Matt Janulewicz
2012-11-18 08:08:46 UTC
Permalink
I guarantee you will drive yourself insane if you try to reconcile the archive structure to the actual code structure on the client end. It's just not important in the Perforce world. There are advantages to a system that doesn't use brute-force filesystem queries (speed.)

Just let it go, man. Just let it go. :)


--
Matt Janulewicz
Lucasfilm Entertainment Company Ltd.


________________________________________
From: perforce-user-***@perforce.com [perforce-user-***@perforce.com] on behalf of yarun [perforce-user-***@forums.perforce.com]
Sent: Saturday, November 17, 2012 11:45 PM
To: perforce-***@perforce.com
Subject: Re: [p4] Moving folders to another depot?

Posted on behalf of forum user 'yarun'.

Matt

I appreciate the insight. I understand that perforce keeps things intact while
maintaining a database that is superior to the file system. My problem is that
it is a bit disorienting to see that my file structure does not match my p4
structure. Normally that would not be a problem if perforce was using some
jumbled letters to maintain a file system but that is not the case it follows
what the user logically structures(at least in the beginning). It is like a
trail left that is never going to disappear.

It is good to know that what I see in the p4v is the truth however I would
really like to move that darn folder out of the depot folder for my own sanity
for the time being. If there is no way(obviously without loosing changelist),
then I have to accept it as it is and move on to another app solution because
that is not a good fit for my own work flow.

thanks



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
Robert Cowham
2012-11-19 09:19:35 UTC
Permalink
Yarun

> It is good to know that what I see in the p4v is the truth however I would
> really like to move that darn folder out of the depot folder for my own sanity
> for the time being.

Why is this important to you? What difference does it make where it is on the server?

Robert
yarun
2012-11-19 15:25:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.

@Matt thanks for reiterating the point. I have already driven myself crazy over
the weekend while trying to achieve what I needed. I am not sure if things can
get much worse for me:)

@Mailman,
Because where I created my folder was a mistake. I am very structured and I do
not move things around normally. I like to set things properly from the start. A
project folder under an existing folder called "depot" is like a
deadly sin to me, knowing that next time I create a depot called
"project" in Perforce will make a named "project" folder.
The sad thing is that couple of my projects will be in a folder called
"depot" while properly created ones will be in a folder called
"project". It makes little sense.

I understand how Perforce operates. I just do not understand why Perforce does
not permit or have tools in place to shuffle folders physically around when
needed. I am wondering how that is not a problem where one might have to go
though new drives with every project, especially on Windows where symlinks and
hardlinks are somewhat limited.










[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6593]
Mailman Sync, on 2012/11/19 09:20:04 UTC, said:
> Originally posted to the perforce-user mailing list by: Robert Cowham
>
>
> Yarun
>
>
>
> Why is this important to you? What difference does it make where it is on the server?
>
> Robert
>
> _______________________________________________
> perforce-user mailing list - perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Robert Cowham
2012-11-19 15:58:41 UTC
Permalink
> Because where I created my folder was a mistake. I am very structured and I
> do not move things around normally. I like to set things properly from the
> start. A project folder under an existing folder called "depot" is like a deadly
> sin to me, knowing that next time I create a depot called "project" in
> Perforce will make a named "project" folder.
> The sad thing is that couple of my projects will be in a folder called "depot"
> while properly created ones will be in a folder called "project". It makes little
> sense.

If it is the top level depot that is wrong, then you can easily move it:

Run command:

P4 depot

Change:

Map: depot/...

To:

Map: project/...

And rename the directory locally. You can also fully root the path, e.g.

Map: c:/some/other/dir/project/...

Worth checking that everything is correctly working - there should be no output from:

P4 verify -q //...

HTH
Robert
yarun
2012-11-19 17:00:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6596]
Mailman Sync, on 2012/11/19 16:00:03 UTC, said:
> Originally posted to the perforce-user mailing list by: Robert Cowham
>
>
>
>
> If it is the top level depot that is wrong, then you can easily move it:
>
> Run command:
>
> perforce-user mailing list - perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>

Thank you, sounds easy and this is probably what I have to know for now.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
G Barthelemy
2012-11-21 15:00:01 UTC
Permalink
Posted on behalf of forum user 'G Barthelemy'.



[http://forums.perforce.com/index.php?app=forums&module=forums&section=findpost&pid=6595]
yarun, on 2012/11/19 15:21:10 UTC, said:
> I understand how Perforce operates. I just do not understand why Perforce does not permit or have tools in place to shuffle folders physically around when needed. I am wondering how that is not a problem where one might have to go though new drives with every project, especially on Windows where symlinks and hardlinks are somewhat limited.
>

You may want to look at the (unsupported) p4 snap command. Provided - to take
your example - that //Depot-A/folder2/... has not been integrated anywhere else,
then it would make sense to move the librarian files and references in
db.archmap such that the "add" revision actions in
//Depot-B/folder2/... are not lazy copies. As pointed out by Matt this
shouldn't matter, but like you, I find it difficult to "let it
go".

After the p4 duplicate and before the p4 obliterate, you should have run: p4
snap //Depot-B/folder2/... //Depot-A/folder2/... (try a dry run with -n first
to see what would happen).
Doing this would have freed //Depot-A/folder2/... of lazy copies (again,
provided it hasn't been integrated outside //Depot-A/folder2/...) and the
obliterate would have got rid of the physical librarian path corresponding to
//Depot-A/folder2/...

Now that you seem to have duplicated and obliterating the source, it may still
be possible to get rid of it by running p4 snap. What I would do first is check
that Depot-A/folder2 doesn't contain lazy copies (other than Depot-B/folder2
of course). The "-n" is important here:

p4 snap -n //... //Depot-A/folder2/...
That should output lines such as:
//Depot-B/folder2/foo.c#1 - copy from //Depot-A/folder2/foo.c 1 123456
...

Provided the path on the left is not outside of //Depot-B/folder2/..., then it
should be perfectly safe to run:

p4 snap //Depot-B/folder2/... //Depot-A/folder2/...
Then check again by running p4 snap -n //... //Depot-A/folder2/... . This time
it should not return anything, and you should then be able to manually delete
the files corresponding to //Depot-A/folder2/... directly in the archive file
system on disk.

This, of course, does not constitute official support advice, I am not
responsible for the loss of your data and there is no substitute for adequate
backup measures before attempting any of the above, yadayada... :P

Sorry for re-opening a dead thread, but no one mentioned this. My main
justification for using this technique is that you'll thank yourself for
doing that the day you'll need to move //depot-B/folder2/... to another
Perforce domain using perfsplit++, for instance.

Guillaume



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
yarun
2012-11-22 07:00:01 UTC
Permalink
Posted on behalf of forum user 'yarun'.

G Barthelemy

Thanks for the new tip. I am going to restore my prev database and try this
method as a test case to see if it is better for me.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2152-moving-folders-to-another-depot
Loading...