Jump to content


p4 python - how to tell if there is a conflict that needs resolution when unshelving or integrating?

p4 unshelve

  • Please log in to reply
2 replies to this topic

#1 mcru

mcru

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts

Posted 18 December 2017 - 03:53 AM

I'm writing a cli wrapper that does a bunch of automated stuff to fit our development process, and I've ran into an issue where I need to be able to tell a user if there will be merge conflicts between files they are going to shelve and @HEAD (preferably without needing to have an active workspace), or if there are merge conflicts that need to be resolved when doing a merge/copy to a parent stream or merging to a branch spec target.

So far, the only way I can figure out to do this is to actually do the integrate or unshelve with the -n flag, iterate over the output, and search each element for 'must resolve' to match on any warnings that say a file must be resolved.

There's gotta be a better way, any ideas? Is there a way you would do this from the CLI that would return a boolean flag or the same effect if there was a conflict?

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1065 posts

Posted 18 December 2017 - 06:02 AM

I'm not 100% certain whether you're asking about whether a file will need to be resolved, or whether a file will need resolve AND have merge conflicts during resolve.  You used the word "conflict" but in describing your solution so far it sounds like you're just looking for "must resolve", which doesn't necessarily mean a merge conflict.

For the shelving case, just look at the open revision vs #head -- if they're the same number, no resolve is needed.  

For the integrate case, as you said, if you use "-Or" (or "p4 merge") you get information about what resolves are being scheduled.

If you want to figure out whether there's going to be an actual conflict for a given resolve, you need to run the merge, e.g. with "p4 merge3", and look for conflicting blocks.

#3 mcru

mcru

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts

Posted 01 April 2018 - 09:55 PM

View PostSambwise, on 18 December 2017 - 06:02 AM, said:

If you want to figure out whether there's going to be an actual conflict for a given resolve, you need to run the merge, e.g. with "p4 merge3", and look for conflicting blocks.

I know this is old, but this was key, thanks!





Also tagged with one or more of these keywords: p4 unshelve

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users