No problem, thanks Paul for working on this - its a really neat tool, I'm looking forward to figuring out how it all works.

--ben

Paul Welter wrote:

Ben,

Thanks for taking the time to fix this.  If you send me the patch or the
file itself, I will commit the fix.

Thanks
Paul


-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Joldersma Sent: Monday, February 07, 2005 11:56 AM To: draconet-users@lists.sourceforge.net Subject: Re: [Draconet-users] Problem with Vault - moving a file in repository

Hello,

I've sorted out this problem, at least for my team. The issue lies in that in the Modification.CompareTo implementation, nulls are not checked

for when doing the comparisons. The Vault does not really consider a move an atomic operation. It notes that an operation occurs to remove the file from the source folder, and a separate operation to insert it into the new folder. I don't know if this is how other source control systems work, but this is apparently what the vault does. Since the dateTime and the user fields are identical, the CompareTo method attempts to sort by comment. Since Vault does not allow comments for move operations, this throws an exception, and the build pukes.

Personally, I don't see a great purpose in sorting by comment, or really

by anything other than DateTime - the odds that multiple users will check in code at the exact same moment are very slim. SmallDateTime's in SqlServer are only accurate down to the minute, and the Vault returns

DateTimes down to the second, so they must be extremely accurate. Anyways, and regardless, I fixed the file, but I don't know how to make the patch file, so if anyone is interested in me submitting a fix - please let me know what the process is.

--ben joldersma

Benjamin Joldersma wrote:



Hello all,

I've seen some emails about this - it seems that the problem that triggers the GetModifications error:

System.InvalidOperationException: Specified IComparer threw an
exception. ---> System.NullReferenceException: Object reference not


set


to an instance of an object.
  at Draco.Core.Scc.Modification.CompareTo(Object obj)
  at System.Collections.Comparer.Compare(Object a, Object b)
  at System.SorterObjectArray.QuickSort(Int32 left, Int32 right)
  --- End of inner exception stack trace ---
  at System.SorterObjectArray.QuickSort(Int32 left, Int32 right)
  at System.Array.Sort(Array keys, Array items, Int32 index, Int32
length, IComparer comparer)
  at System.Array.Sort(Array array)
  at Draco.Core.Runtime.BuildRunner.GetModifications(DateTime
earliestModificationTime)
  at Draco.Core.Runtime.BuildRunner.CheckForChanges(BuildType
buildType, Boolean& changesSinceLastBuild)
  at Draco.Core.Runtime.BuildRunner.Start(BuildType buildType)

happens when we move a file into a different directory. This makes sense. Deleting the build.info and log files fixes it, but I don't want to have to do this every time we move our files around. Any suggestions?

--ben joldersma




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive


Reporting


Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Draconet-users mailing list
Draconet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/draconet-users





-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Draconet-users mailing list
Draconet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/draconet-users


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Draconet-users mailing list Draconet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/draconet-users



/*
 * $Id: Modification.cs,v 1.3 2004/11/04 01:07:52 pwelter34 Exp $
 * Copyright (c) 2002-2003, Chive Software Limited
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 2. Neither the name of Chive Software Limited nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

using System;
using System.Collections;
using System.Xml.Serialization;

namespace Draco.Core.Scc {

    public enum ModificationType {
        Add,
        Remove,
        Update,
        Other
    }

    /// <summary>
    ///     A representation of a SCC operation that should be independent of
    ///     a particular SCC implementation.  For example both CVS and VSS
    ///     repositories should return instances of this class to allow the
    ///     core of Draco to be SCC independent.
    /// </summary>
    public class Modification : IComparable {
                private static readonly log4net.ILog log = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public static readonly Modification[] EmptyArray = new Modification[0];

        private DateTime date;

        private string user;

        private string comment;

        private ArrayList fileInfo = new ArrayList();

        public Modification() {}

        public Modification(
            DateTime date,
            string user,
            string comment) {

            this.date = date;
            this.user = user;
            this.comment = comment;
        }

        public DateTime Date {
            get {
                return date;
            }
            set {
                date = value;
            }
        }

        public string User {
            get {
                return user;
            }
            set {
                user = value;
            }
        }

        public string Comment {
            get {
                return comment;
            }
            set {
                comment = value;
            }
        }

        [XmlArray(ElementName="Files")]
        [XmlArrayItem(ElementName="File", Type=typeof(FileInfo))]
        public ArrayList Files {
            get {
                return fileInfo;
            }
            set {
                fileInfo = value;
            }
        }

        public void AddFileInfo(
            ModificationType type,
            string directory,
            string file,
            string revision) {

            fileInfo.Add(new FileInfo(type, directory, file, revision));
        }

        public class FileInfo {

            private ModificationType type;

            private string directory;

            private string file;

            private string revision;

            public FileInfo() {}

            public FileInfo(
                ModificationType type,
                string directory,
                string file,
                string revision) {

                this.type = type;
                this.file = file;
                this.directory = directory;
                this.revision = revision;
            }

            public ModificationType Type {
                get {
                    return type;
                }
                set {
                    type = value;
                }
            }

            public string Directory {
                get {
                    return directory;
                }
                set {
                    directory = value;
                }
            }

            public string File {
                get {
                    return file;
                }
                set {
                    file = value;
                }
            }

            public string Revision {
                get {
                    return revision;
                }
                set {
                    revision = value;
                }
            }

        }

        public int CompareTo(object obj)
        {
                                        try
                                        {
                                                Modification mod = 
(Modification)obj;

                                                // first compare by date
                                                int x = 
date.CompareTo(mod.Date);

                                                // if still equal...
                                                if (x == 0 && user != null && 
mod.User != null ) 
                                                {
                                                        // then by user
                                                        x = 
user.CompareTo(mod.User);
                                                }

                                                // if still equal...
                                                if (x == 0 && comment != null 
&& mod.Comment != null ) 
                                                {
                                                        // then by comment
                                                        x = 
comment.CompareTo(mod.Comment);
                                                }
            
                                                return x;
                                        }
                                        catch( Exception e )
                                        {
                                                log.Debug( "error in sort.", e 
);
                                                return 0;
                                        }
        }
    }
}

Reply via email to