Update based on reviewer comments
This commit is contained in:
parent
3f8308cfc1
commit
98b7665249
@ -175,11 +175,7 @@ func (c *onedriveCollection) withFile(
|
|||||||
name+onedrive.DataFileSuffix,
|
name+onedrive.DataFileSuffix,
|
||||||
fileData))
|
fileData))
|
||||||
|
|
||||||
case 1:
|
case 1, 2, 3:
|
||||||
fallthrough
|
|
||||||
case 2:
|
|
||||||
fallthrough
|
|
||||||
case 3:
|
|
||||||
c.items = append(c.items, onedriveItemWithData(
|
c.items = append(c.items, onedriveItemWithData(
|
||||||
c.t,
|
c.t,
|
||||||
name+onedrive.DataFileSuffix,
|
name+onedrive.DataFileSuffix,
|
||||||
@ -208,14 +204,10 @@ func (c *onedriveCollection) withFolder(
|
|||||||
roles []string,
|
roles []string,
|
||||||
) *onedriveCollection {
|
) *onedriveCollection {
|
||||||
switch c.backupVersion {
|
switch c.backupVersion {
|
||||||
case 0:
|
case 0, 3:
|
||||||
fallthrough
|
|
||||||
case 3:
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
case 1:
|
case 1, 2:
|
||||||
fallthrough
|
|
||||||
case 2:
|
|
||||||
c.items = append(
|
c.items = append(
|
||||||
c.items,
|
c.items,
|
||||||
onedriveMetadata(
|
onedriveMetadata(
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
|
||||||
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||||
"github.com/alcionai/corso/src/internal/connector/support"
|
"github.com/alcionai/corso/src/internal/connector/support"
|
||||||
"github.com/alcionai/corso/src/internal/data"
|
"github.com/alcionai/corso/src/internal/data"
|
||||||
@ -563,19 +564,24 @@ func (c *Collections) UpdateCollections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
folderPath path.Path
|
itemPath path.Path
|
||||||
isFolder = item.GetFolder() != nil || item.GetPackage() != nil
|
isFolder = item.GetFolder() != nil || item.GetPackage() != nil
|
||||||
)
|
)
|
||||||
|
|
||||||
if item.GetName() != nil {
|
if item.GetDeleted() == nil {
|
||||||
folderPath, err = collectionPath.Append(*item.GetName(), !isFolder)
|
name := ptr.Val(item.GetName())
|
||||||
|
if len(name) == 0 {
|
||||||
|
return clues.New("non-deleted item with empty name").With("item_id", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
itemPath, err = collectionPath.Append(name, !isFolder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip items that don't match the folder selectors we were given.
|
// Skip items that don't match the folder selectors we were given.
|
||||||
if shouldSkipDrive(ctx, folderPath, c.matcher, driveName) &&
|
if shouldSkipDrive(ctx, itemPath, c.matcher, driveName) &&
|
||||||
shouldSkipDrive(ctx, collectionPath, c.matcher, driveName) {
|
shouldSkipDrive(ctx, collectionPath, c.matcher, driveName) {
|
||||||
logger.Ctx(ctx).Infof("Skipping path %s", collectionPath.String())
|
logger.Ctx(ctx).Infof("Skipping path %s", collectionPath.String())
|
||||||
continue
|
continue
|
||||||
@ -625,9 +631,9 @@ func (c *Collections) UpdateCollections(
|
|||||||
// Moved folders don't cause delta results for any subfolders nested in
|
// Moved folders don't cause delta results for any subfolders nested in
|
||||||
// them. We need to go through and update paths to handle that. We only
|
// them. We need to go through and update paths to handle that. We only
|
||||||
// update newPaths so we don't accidentally clobber previous deletes.
|
// update newPaths so we don't accidentally clobber previous deletes.
|
||||||
updatePath(newPaths, *item.GetId(), folderPath.String())
|
updatePath(newPaths, *item.GetId(), itemPath.String())
|
||||||
|
|
||||||
found, err := updateCollectionPaths(*item.GetId(), c.CollectionMap, folderPath)
|
found, err := updateCollectionPaths(*item.GetId(), c.CollectionMap, itemPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -635,7 +641,7 @@ func (c *Collections) UpdateCollections(
|
|||||||
if !found {
|
if !found {
|
||||||
col := NewCollection(
|
col := NewCollection(
|
||||||
c.itemClient,
|
c.itemClient,
|
||||||
folderPath,
|
itemPath,
|
||||||
prevPath,
|
prevPath,
|
||||||
driveID,
|
driveID,
|
||||||
c.service,
|
c.service,
|
||||||
|
|||||||
@ -41,7 +41,10 @@ const (
|
|||||||
// name.
|
// name.
|
||||||
// TODO(ashmrtn): Update this to a real value when we merge the file name
|
// TODO(ashmrtn): Update this to a real value when we merge the file name
|
||||||
// change. Set to MAXINT for now to keep the if-check using it working.
|
// change. Set to MAXINT for now to keep the if-check using it working.
|
||||||
versionWithNameInMeta = math.MaxInt
|
versionWithNameInMeta = math.MaxInt
|
||||||
|
// versionWithDataAndMetaFilesInDir moves the .dirmeta entries to the
|
||||||
|
// directory they belong to instead of being in the parent of the directory
|
||||||
|
// they belong to.
|
||||||
versionWithDataAndMetaFilesInDir = 3
|
versionWithDataAndMetaFilesInDir = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user