Jump to content


Reconcile seems to need to have something added in order to work ?

reconcile

  • Please log in to reply
6 replies to this topic

#1 daveg

daveg

    Member

  • Members
  • PipPip
  • 18 posts

Posted 12 January 2018 - 10:20 PM

Hi:

New to P4, so please bear with...

I have a workspace that was populated with P4 sync and client created.  No changes were made.

- I go there and do a "p4 reconcile -n".   It seems to find everything in the workspace as needing to be "add"ed.
- If I create a simple test file somewhere and rerun, I get the same thing (except now it finds the test file too).
- If I "p4 add" this test file and rerun, it reports there are no differences.
- If I create another test file and rerun, it identifies the 2nd test file as needing to be added.

It's like it's initially lost, not knowing where I am or what to compare to, so it finds that everything needs to be added.  But once I add something, it's now grounded and works fine.

I guess I'm trying to understand what's happening, and then I need to know what to do to get it to work without having to "p4 add" something.

One caveat.... The client is old and doesn't support reconcile.  But my perl script (using P4) does work.  Here's the script I'm using to test this...

#!/usr/bin/env perl                                                                                                                    
use P4;      

$p4 = new P4;                                

my $client = $p4->GetClient();
print "client: $client \n";
$p4->SetClient($client);
$p4->Connect() or die "-F- Failed to p4->Connect to client \"$client\"\n";            
      
      
my @arr = $p4->Run("reconcile","-n");
if($p4->ErrorCount()) {
    foreach $err ($p4->Errors) {
        print "<<<P4 ERROR>>> $err\n";
    }
    print "\n";
    exit;
}

my $x = 0;
foreach my $hsh_ (@arr) {
    $action = $clientFile = $depotFile = "";
    $action = $hsh_->{action};
    $clientFile = $hsh_->{clientFile};
    $depotFile = $hsh_->{depotFile};

    print "$action : ${depotFile} - ${clientFile}\n";
    $x++;
}  

print "\n Total Num Discrepencies Found: $x\n";

exit;

#2 daveg

daveg

    Member

  • Members
  • PipPip
  • 18 posts

Posted 12 January 2018 - 11:34 PM

I think I may be able to answer my own question....

$p4->SetCwd("${ENV{WAREA}}/src");
$p4->SetClient($client);
$client = $p4->GetClient();
print "client: $client \n";
$p4->Connect()
  or die "-F- Failed to p4->Connect to client \"$client\"\n";            


If I scope the thing with SetCwd first, then it seems to behave.

Am I on the right track ?

#3 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 640 posts

Posted 12 January 2018 - 11:42 PM

Wait...

Quote

I have a workspace that was populated with P4 sync and client created.

not in that order, though, right?  Because if you create a new workspace on top of a bunch of files synced via another workspace you will absolutely get weird behavior like this.  :)

Reconcile operates relative to the tracked state of what the current client workspace has synced.  If you create a new workspace with no state and run reconcile, every file looks like a new file.  (You should never ever share a physical location between workspaces, because anything you do in one workspace is not going to be tracked by the other, and everything will be both confused and confusing.)

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 640 posts

Posted 13 January 2018 - 12:34 AM

Also:

Quote

The client is old and doesn't support reconcile.

If you have permissions on this system to write and execute a Perl script, you should have permissions to acquire and execute an updated p4 binary (even if you have to keep it in your home directory).  Do that and it'll make debugging *much* easier.  :)

#5 daveg

daveg

    Member

  • Members
  • PipPip
  • 18 posts

Posted 15 January 2018 - 04:19 PM

Unfortunately, I don't have the authority to update anything.  That belongs to someone who, for some reason, wants to leave it as it is.

To be quite honest, I don't know if the client was created before or after.  But I believe the client is created first, then there are several syncs to different areas of the depot inside the local linux dir struct that contains all the synced copies.  

Anyway, I reran the project script (that someone else wrote) which creates the dir struct that has the p4 workareas.  Each of these areas is populated with files from the depot, lets call them 'src', '_env', 'import'.  If I run my script (above)  from anywhere in the linux dir struct, it does seem to sense the fact that I SetCWD to, for example, "_env" and only reports on files in that area.  However, now it reports that all files in the _env dir need to be "add"ed.  I think it seemed to work right before because I was running my script after I did a "p4 add" in my experiments.  So back to square 1.  It thinks everything needs to be added.  

Looking closer at my script, the " print "$action : ${depotFile} - ${clientFile}\n";" line in side the loop, I get lines like...

add : //thetop/proj1/main/_env/cbwa.type - /proj/me/MYTESTDIR/_env/cbwa.type

IOW, "p4 reconcile" seems to find $depotFile and $clientFile OK.  It seems to know where in the depot the file came from and where it is in the local linux dir.  But then it reports that it needs to be added ?  That doesn't make any sense.  

If I do a "p4 filelog cbwa.wt", it returns "cbwa.wt_type - file(s) not on client."  
But it is on the client, it's " /proj/me/MYTESTDIR/_env/cbwa.type" just as it was found by "p4 reconcile"

Does the "client" need to exist in order for my reconcile test script to work?  Does it create its own client?  Why is it it works after a "p4 add" ?

#6 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 640 posts

Posted 15 January 2018 - 06:35 PM

Yes, the client needs to exist, and no, reconcile doesn't automatically create a client -- but maybe some other part of the script does?  Hard for me to debug it blind, and it's going to be very hard for you to learn Perforce usage to be able to debug it yourself if you're not allowed to install Perforce. (For some UTTERLY BIZARRE REASON -- I cannot stress enough that the person who is preventing you from updating p4 is literally preventing you from doing your job.  I don't think it's possible to learn Perforce well enough to script it if you aren't able to try things out at the command prompt.)  :\

Could you set up a test installation on your own machine?  (It should still be free to do this unless they've changed the licensing again.)

#7 daveg

daveg

    Member

  • Members
  • PipPip
  • 18 posts

Posted 15 January 2018 - 06:55 PM

Wait a minute.  Someone here set me straight on something regarding which dirs are synced and I withdraw my question/problem.  I did find a 2016 version of P4 and it seems to work fine, including reconcile.  It's not the default by I'll just alias it.  Sorry for the false alarm.  You've been very helpful Sambwise and tolerant of this novice :-}





Also tagged with one or more of these keywords: reconcile

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users