Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » usvn - SVN for dummies (and me)
Re: usvn - SVN for dummies (and me) [message #26515 is a reply to message #26507] Fri, 07 May 2010 13:47 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1792
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

ktj9 wrote on Thu, 06 May 2010 23:26

Hello Honza,
Thank you for pointing out an issue. Would you please indicate where and how you update the String filelist? Thanks!

Oups, I truncated the code too early, I'm sorry Embarassed
Here is the full function code:
void SvnSync::DoSync()
{
	SyncList();
	msgmap.Sweep();
again:
	if(Execute() != IDOK || list.GetCount() == 0) {
		int repoi = 0;
		for(int i = 0; i < list.GetCount(); i++)
			if(list.Get(i, 0) == MESSAGE)
				msgmap.GetAdd(works[repoi++].working) = list.Get(i, 3);
		return;
	}
	bool changes = false;
	for(int i = 0; i < list.GetCount(); i++) {
		int action = list.Get(i, 0);
		Value v = list.Get(i, 2);
		if(action == MESSAGE) {
			if(changes && IsNull(list.Get(i, 3))
			&& !PromptYesNo("Commit message is empty.&Do you want to continue?"))
				goto again;
			changes = false;
		}
		else if(action != REPOSITORY && IsNumber(v) && (int)v)
			changes = true;
	}
	SysConsole sys;
	int repoi = 0;
	int l = 0;
	bool commit = false;
	while(l < list.GetCount()) {
		SvnWork w = works[repoi++];
		l++;
		String message;
		String filelist;   // <-- list of files to update
		while(l < list.GetCount()) {
			int action = list.Get(l, 0);
			String path = list.Get(l, 1);
			if(action == MESSAGE && commit) {
				String msg = list.Get(l, 3);
				// now we commit only files in filelist
				if(sys.CheckSystem(SvnCmd("commit", w).Cat() << filelist << " -m \"" << msg << "\""))
					msgmap.GetAdd(w.working) = msg;
				l++;
				break;
			}
			if(action == REPOSITORY)
				break;
			Value v = list.Get(l, 2);
			if(IsNumber(v) && (int)v == 0) {
				if(action == REPLACE || action == ADD)
					DeleteFolderDeep(path);
				if(action != ADD)
					sys.CheckSystem("svn revert " + path);
			}else if(IsNumber(v)&&(int)v==2){   // <-- the file should be skipped
				l++;
				continue;
			}
			else {
				filelist+=" "+path;   // <-- add the file to the list
				commit = true;
				switch(action) {
				case ADD:
					SvnDel(path);
					sys.CheckSystem("svn add --force " + path);
					break;
				case REMOVE:
					sys.CheckSystem("svn delete " + path);
					break;
				case CONFLICT:
					sys.CheckSystem("svn resolved " + path);
					break;
				case REPLACE: {
						SvnDel(path);
						String tp = AppendFileName(GetFileFolder(path), Format(Uuid::Create()));
						FileMove(path, tp);
						sys.CheckSystem(SvnCmd("update", w).Cat() << ' ' << path);
						MoveSvn(path, tp);
						sDeleteFolderDeep(path);
						FileMove(tp, path);
						Vector<String> ln = Split(Sys("svn status " + path), CharFilterCrLf);
						for(int l = 0; l < ln.GetCount(); l++) {
							String h = ln[l];
							if(h.GetCount() > 7) {
								String file = h.Mid(7);
								if(IsFullPath(file)) {
									h.Trim(7);
									if(h == "?      ")
										sys.CheckSystem("svn add --force " + file);
									if(h == "!      ")
										sys.CheckSystem("svn delete " + file);
								}
							}
						}
					}
					break;
				case DELETEC:
					FileDelete(path);
					break;
				}
			}
			l++;
		}
		sys.CheckSystem(SvnCmd("update", w).Cat() << w.working);
	}
	sys.Perform();
}


Best regards,
Hozna
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Scatter Control
Next Topic: Svg Painter
Goto Forum:
  


Current Time: Mon Aug 25 06:13:00 CEST 2025

Total time taken to generate the page: 0.04373 seconds