← Back to team overview

syncany-team team mailing list archive

[Bug 1029349] [NEW] Resolve Conflict Bug

 

Public bug reported:

Hi,

I found another bug in remotewatcher/ChangeManager.java in function
private void resolveConflict(CloneFile firstConflictingVersion, Update
conflictUpdate)

When it renames the name of the firstConflictversion and laters versions, it needs to set a new FileId.
I fixed with this:

for (CloneFile cf : versionsToAdjust) {
            CloneFile cfclone = (CloneFile) cf.clone();

            // New filename
            String newFileName =
                    FileUtil.getBasename(cf.getName())
                    + " (" + config.getMachineName()
                    + (config.getMachineName().endsWith("s") ? "'" : "'s")
                    + " conflicting copy, "
                    + dateFormat.format(cfclone.getUpdated())
                    + ")" + FileUtil.getExtension(cf.getName(), true);

            // New file 
            cfclone.setStatus(Status.NEW);
            cfclone.setName(newFileName);
            cfclone.setVersion(version);
            cfclone.setFileId(new Random().nextLong());

            newConflictingLocalFile = cfclone;

            logger.info("- Removing version " + cf + " from DB: " + cf.getAbsolutePath());
            em.remove(em.merge(cf));

            logger.info("- Adding adjusted version " + cfclone + " from DB: " + cfclone.getAbsolutePath());
            em.persist(cfclone);

            version++;
        }


Regards!

** Affects: syncany
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Syncany
Team, which is subscribed to Syncany.
https://bugs.launchpad.net/bugs/1029349

Title:
  Resolve Conflict Bug

Status in Syncany:
  New

Bug description:
  Hi,

  I found another bug in remotewatcher/ChangeManager.java in function
  private void resolveConflict(CloneFile firstConflictingVersion, Update
  conflictUpdate)

  When it renames the name of the firstConflictversion and laters versions, it needs to set a new FileId.
  I fixed with this:

  for (CloneFile cf : versionsToAdjust) {
              CloneFile cfclone = (CloneFile) cf.clone();

              // New filename
              String newFileName =
                      FileUtil.getBasename(cf.getName())
                      + " (" + config.getMachineName()
                      + (config.getMachineName().endsWith("s") ? "'" : "'s")
                      + " conflicting copy, "
                      + dateFormat.format(cfclone.getUpdated())
                      + ")" + FileUtil.getExtension(cf.getName(), true);

              // New file 
              cfclone.setStatus(Status.NEW);
              cfclone.setName(newFileName);
              cfclone.setVersion(version);
              cfclone.setFileId(new Random().nextLong());

              newConflictingLocalFile = cfclone;

              logger.info("- Removing version " + cf + " from DB: " + cf.getAbsolutePath());
              em.remove(em.merge(cf));

              logger.info("- Adding adjusted version " + cfclone + " from DB: " + cfclone.getAbsolutePath());
              em.persist(cfclone);

              version++;
          }

  
  Regards!

To manage notifications about this bug go to:
https://bugs.launchpad.net/syncany/+bug/1029349/+subscriptions


Follow ups

References