Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8462583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:12:16+00:00 2026-06-10T14:12:16+00:00

Context: Someone does some restructuring work on a large Perforce depot under active development,

  • 0

Context: Someone does some restructuring work on a large Perforce depot under active development, and p4 moves files around while they are still being worked on. Everyone else needs to keep their pending changes, but move them to the new locations in the new directory structure.

Consider my pending changelist with adds, edits, deletes and moves of various files.

If another user submits a p4 move of all those files into a sub-directory, while my changelist is still pending, how do I resolve so that the same changes are applied to the same files in their new location?

After the other user moves the files and I do a p4 sync which makes the files in their new location in my workspace, p4 resolve just says there are No file(s) to resolve.

I have tried to do a p4 move path newdir/path for every file in my change, this doesn’t quite work:

  • Files I have added are moved to be an add at the new location. GOOD.
  • Files I have edited require use of the -f flag on p4 move (without it you get //depot/newdir/path - is synced; use -f to force move). OK.
  • Files I have deleted cannot be moved (//depot/path - can't move (already opened for delete)). BAD
  • Files I have moved can’t be moved again. If my pending change was moving from //depot/path to //depot/newpath, and the other change has moved //depot/path to //depot/newdir/path then I can p4 move newpath newdir/newpath to pick up the “move/add” part of the change but I cannot p4 move path newdir/path to also pick up the “move/delete” part of the change (same error as previous point). BAD.

If bare p4 commands won’t work, I’ll have to bust out the bash-fu to move files and glue together the right commands. I need an automated solution, as there may be a large number of pending changes across a large number of users all affected by the move, and these all need resolving as easily as possible.

I’ve also considered adapting the Working Disconnected From The Perforce Server method to apply my changes in the new location, but this loses the “move” metadata and, more importantly, won’t work if multiple people have to do the same thing as they will have to resolve with the changes made by me if I get in before them.

If you want to play along with a toy example, here are my reproducing test case steps:

# Get p4 client and server, install in path (~/bin for me)
cd ~/bin
wget http://www.perforce.com/downloads/perforce/r12.1/bin.linux26x86/p4
chmod +x p4
wget http://www.perforce.com/downloads/perforce/r12.1/bin.linux26x86/p4d
chmod +x p4d

# Start p4 server in a test area (server dumps files in CWD)
mkdir -p ~/p4test/server
cd ~/p4test/server
p4d&
sleep 3
export P4PORT=localhost:1666
unset P4CONFIG # In case you use elsewhere :)

# Create some default client specs and workspaces for them.
mkdir ../workspace1
cd ../workspace1
export P4CLIENT=client1
p4 client -o | p4 client -i
mkdir ../workspace2
cd ../workspace2
export P4CLIENT=client2
p4 client -o | p4 client -i

# Create files and commit initial depot from client1
cd ../workspace1
export P4CLIENT=client1
for i in 1 2 3 4; do echo "This is file $i" > file$i; done
p4 add file*
p4 submit -d 'Initial files'

# Now make some changes to the files. But do not submit - leave pending.
# Add
echo "New file 0" > file0
p4 add file0
# Edit
p4 edit file1
echo "Edited $(date)" >> file1
# Delete
p4 delete file2
# Move
p4 edit file3
p4 move file3 file3.1

# Pending changelist looks like this:
# p4 opened
#//depot/file0#1 - add default change (text)
#//depot/file1#1 - edit default change (text)
#//depot/file2#1 - delete default change (text)
#//depot/file3#1 - move/delete default change (text)
#//depot/file3.1#1 - move/add default change (text)

# Meanwhile, in client2, another user moves everything to a new dir
cd ../workspace2
export P4CLIENT=client2
p4 sync
p4 edit file*
p4 move ... main/...
p4 submit -d 'Move everything to new "main" directory'

# Now what happens in client1?
cd ../workspace1
export P4CLIENT=client1
p4 sync

# //depot/file4#1 - deleted as /home/day/p4test/workspace1/file4
# //depot/file1#1 - is opened for edit - not changed
# //depot/file2#1 - is opened for delete - not changed
# //depot/file3#1 - is opened for move/delete - not changed
# //depot/file3.1#1 - is opened for move/add - not changed
# //depot/main/file1#1 - added as /home/day/p4test/workspace1/main/file1
# //depot/main/file2#1 - added as /home/day/p4test/workspace1/main/file2
# //depot/main/file3#1 - added as /home/day/p4test/workspace1/main/file3
# //depot/main/file4#1 - added as /home/day/p4test/workspace1/main/file4
# day@office:~/p4test/workspace1$ tree
# .
# ├── file0
# ├── file1
# ├── file3.1
# └── main
#     ├── file1
#     ├── file2
#     ├── file3
#     └── file4
#
# 1 directory, 7 files

# Now ... how to resolve?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:12:18+00:00Added an answer on June 10, 2026 at 2:12 pm

    In theory, you should now be able to do this:

    p4 move -f ... main/...             # meld your opened files to their renamed files
    p4 move -f main/file3.1 main/file3  # meld your renamed file to their renamed file
    p4 revert '*'                       # revert your now-spurious pending deletes
    p4 move main/file3 main/file3.1     # move their renamed file to the name you wanted
    p4 resolve                          # merge their edits with your edits
    

    But there seems to be a bug with that third ‘p4 move’, and it’s dropping the pending resolve on main/file3.1 (fka main/file3).

    However, it does seem to work right if you do it in this order:

    p4 move -f ... main/...
    p4 move -f main/file3.1 main/file3
    p4 revert '*'
    p4 resolve
    p4 move main/file3 main/file3.1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I am running into a context issue and hoping someone can shed
We are loading data from db: var somethings = Context.SomethingSet.ToList(); Then someone deletes or
I remember someone telling me that gzipped content is not cached on some browsers?
In another question , someone mentioned this site which blew me away: http://zoomii.com Does
Context When iterating over a set of Rdata files (each containing a character vector
Someone else on my team has created a form - for some reason the
I have a battery widget, and for some reason it does not receive the
does someone know how to filter in admin based on comparison on model fields
I need some help dealing with timeouts in a Grails app. Context: In my
I've been using spring for some time, but I always wondered how does it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.