Revision f4f39ccb trunk/Pithos.Core/Agents/PollAgent.cs

b/trunk/Pithos.Core/Agents/PollAgent.cs
545 545
                                                                tuple.ObjectInfo.X_Object_Hash);
546 546

  
547 547
                                StatusKeeper.StoreInfo(targetPath, tuple.ObjectInfo);
548

  
549
                                AddRootFolderToSelectives(accountInfo, tuple, targetPath);
548 550
                            }
549 551

  
550 552
                            /*
......
555 557
                    }
556 558
                }
557 559
                else
558
                {
560
                {                   
561

  
559 562
                    //Local changes found
560 563

  
561 564
                    //Server unchanged?
......
610 613
                                //Detect server moves
611 614
                                var targetPath = MoveForServerMove(accountInfo, tuple);
612 615
                                StatusKeeper.StoreInfo(targetPath, tuple.ObjectInfo);
616
                                
617
                                AddRootFolderToSelectives(accountInfo, tuple, targetPath);
613 618
                            }
614 619
                            else
615 620
                            {
......
653 658
            }
654 659
        }
655 660

  
661
        private void AddRootFolderToSelectives(AccountInfo accountInfo, StateTuple tuple, string targetPath)
662
        {
663
            //Also ensure that any newly created folders are added to the selectives, if the original folder was selected
664
            var containerPath = Path.Combine(accountInfo.AccountPath, tuple.ObjectInfo.Container);
665

  
666
            //If this is a root folder encountered for the first time
667
            if (tuple.L == null && Directory.Exists(tuple.FileInfo.FullName) 
668
                && (tuple.FileInfo.FullName.IsAtOrDirectlyBelow(containerPath)))
669
            {
670
                
671
                var relativePath = tuple.ObjectInfo.RelativeUrlToFilePath(accountInfo.UserName);
672
                var initialPath = Path.Combine(accountInfo.AccountPath, relativePath);
673

  
674
                var hasMoved = true;// !initialPath.Equals(targetPath);
675
                if (hasMoved && Selectives.IsSelected(accountInfo, initialPath))
676
                {
677
                    Selectives.AddUri(accountInfo, tuple.ObjectInfo.Uri);
678
                    Selectives.Save(accountInfo);
679
                }
680
            }
681
        }
682

  
656 683
        private string MoveForServerMove(AccountInfo accountInfo, StateTuple tuple)
657 684
        {
658 685
            if (tuple.ObjectInfo == null)

Also available in: Unified diff