Beispiel #1
0
        void OnFileStatusChanged(FileUpdateEventInfo args)
        {
            VersionInfo newInfo = null;

            try {
                // Reuse remote status from old version info
                newInfo = changeSet.Repository.GetVersionInfo(args.FilePath);
            } catch (Exception ex) {
                LoggingService.LogError(ex.ToString());
            }
            AddFile(newInfo);
        }
Beispiel #2
0
        async void OnFileStatusChanged(FileUpdateEventInfo args)
        {
            VersionInfo newInfo = null;

            try {
                // Reuse remote status from old version info
                var token = destroyTokenSource.Token;
                newInfo = await changeSet.Repository.GetVersionInfoAsync(args.FilePath, cancellationToken : token);

                if (token.IsCancellationRequested)
                {
                    return;
                }
                await AddFile(newInfo);
            } catch (Exception ex) {
                LoggingService.LogError(ex.ToString());
            }
        }
Beispiel #3
0
		bool OnFileStatusChanged (FileUpdateEventInfo args)
		{
			if (!args.FilePath.IsChildPathOf (filepath) && args.FilePath != filepath)
				return true;

			if (args.IsDirectory) {
				StartUpdate ();
				return false;
			}

			bool found = false;
			bool wasExpanded = false;
			int oldStatusIndex;
			TreeIter oldStatusIter = TreeIter.Zero;

			// Locate the file in the status object list
			if (statuses == null)
				return false;

			for (oldStatusIndex = 0; oldStatusIndex < statuses.Count; oldStatusIndex++) {
				if (statuses [oldStatusIndex].LocalPath == args.FilePath) {
					found = true;
					break;
				}
			}

			// Locate the file in the treeview
			if (found) {
				found = false;
				if (filestore.GetIterFirst (out oldStatusIter)) {
					do {
						if (args.FilePath == (string) filestore.GetValue (oldStatusIter, ColFullPath)) {
							wasExpanded = filelist.GetRowExpanded (filestore.GetPath (oldStatusIter));
							found = true;
							break;
						}
					} while (filestore.IterNext (ref oldStatusIter));
				}
			}

			VersionInfo newInfo;
			try {
				// Reuse remote status from old version info
				newInfo = vc.GetVersionInfo (args.FilePath);
				if (found && newInfo != null) {
					VersionInfo oldInfo = statuses [oldStatusIndex];
					if (oldInfo != null) {
						newInfo.RemoteStatus = oldInfo.RemoteStatus;
						newInfo.RemoteRevision = oldInfo.RemoteRevision;
					}
				}
			}
			catch (Exception ex) {
				LoggingService.LogError (ex.ToString ());
				return true;
			}

			if (found) {
				if (!FileVisible (newInfo)) {
					// Just remove the file from the change set
					changeSet.RemoveFile (args.FilePath);
					statuses.RemoveAt (oldStatusIndex);
					filestore.Remove (ref oldStatusIter);
					return true;
				}

				statuses [oldStatusIndex] = newInfo;
				InvalidateDiffData (args.FilePath, false, newInfo);
				InvalidateDiffData (args.FilePath, true, newInfo);

				// Update the tree
				AppendFileInfo (newInfo, wasExpanded);
				filestore.Remove (ref oldStatusIter);
			}
			else {
				if (FileVisible (newInfo)) {
					statuses.Add (newInfo);
					changeSet.AddFile (newInfo);
					AppendFileInfo (newInfo, wasExpanded);
				}
			}
			return true;
Beispiel #4
0
        bool OnFileStatusChanged(FileUpdateEventInfo args)
        {
            if (!args.FilePath.IsChildPathOf(filepath) && args.FilePath != filepath)
            {
                return(true);
            }

            if (args.IsDirectory)
            {
                StartUpdate();
                return(false);
            }

            bool     found = false;
            int      oldStatusIndex;
            TreeIter oldStatusIter = TreeIter.Zero;

            // Locate the file in the status object list
            for (oldStatusIndex = 0; oldStatusIndex < statuses.Count; oldStatusIndex++)
            {
                if (statuses [oldStatusIndex].LocalPath == args.FilePath)
                {
                    found = true;
                    break;
                }
            }

            // Locate the file in the treeview
            if (found)
            {
                found = false;
                if (filestore.GetIterFirst(out oldStatusIter))
                {
                    do
                    {
                        if (args.FilePath == (string)filestore.GetValue(oldStatusIter, ColFullPath))
                        {
                            found = true;
                            break;
                        }
                    } while (filestore.IterNext(ref oldStatusIter));
                }
            }

            VersionInfo newInfo;

            try {
                // Reuse remote status from old version info
                newInfo = vc.GetVersionInfo(args.FilePath, false);
                if (found && newInfo != null)
                {
                    VersionInfo oldInfo = statuses [oldStatusIndex];
                    if (oldInfo != null)
                    {
                        newInfo.RemoteStatus   = oldInfo.RemoteStatus;
                        newInfo.RemoteRevision = oldInfo.RemoteRevision;
                    }
                }
            }
            catch (Exception ex) {
                LoggingService.LogError(ex.ToString());
                return(true);
            }

            if (found)
            {
                if (!FileVisible(newInfo))
                {
                    // Just remove the file from the change set
                    changeSet.RemoveFile(args.FilePath);
                    statuses.RemoveAt(oldStatusIndex);
                    filestore.Remove(ref oldStatusIter);
                    return(true);
                }

                statuses [oldStatusIndex] = newInfo;

                // Update the tree
                AppendFileInfo(newInfo);
                filestore.Remove(ref oldStatusIter);
            }
            else
            {
                if (FileVisible(newInfo))
                {
                    statuses.Add(newInfo);
                    changeSet.AddFile(newInfo);
                    AppendFileInfo(newInfo);
                }
            }
            return(true);
        }