# # # patch "netxx_pipe.cc" # from [6dcfc8169b0df0041a2df3cd02574177e12dee35] # to [9b0c7df48d0c9d3e4654c8f590460a419b8e70d3] # # patch "paths.cc" # from [c2bbab0e0a0e50607f11cf4b1833cb1467fac0e6] # to [7eb02c15c3c4715e94626ec5f89e5f1b01886e29] # # patch "tests/commit_validation_lua_hook/__driver__.lua" # from [19367c5014ec6d8704e3f94916c96ba06a17a8d3] # to [598c1dc5e31b3c52a3a0296b14f59e4a76fec5b0] # # patch "tests/resolve_conflicts_errors/__driver__.lua" # from [778859aa71ac1c88a29ba030936ca462478d30f8] # to [7688ba18626d29beb5aec22e208b74551bf4baa1] # # patch "win32/fs.cc" # from [952077b15aa3f8774b6261e37237472815a7c0ae] # to [9dee8425649922f9cf98200c8d79c3a0b01f8290] # # patch "win32/ssh_agent_platform.cc" # from [10a2ac556b690343bcda3eee48f7112bf3b6f799] # to [9dd114aa8691e56fe4b0990eff53bdda704b1b21] # # patch "win32/tester-plaf.cc" # from [1b3bbd387a0e96810e68da14fe6c0aef9c25225c] # to [3515a1b8a6a7fa2a45dbaddb933239fef3c18823] # ============================================================ --- netxx_pipe.cc 6dcfc8169b0df0041a2df3cd02574177e12dee35 +++ netxx_pipe.cc 9b0c7df48d0c9d3e4654c8f590460a419b8e70d3 @@ -46,7 +46,7 @@ Netxx::PipeStream::PipeStream(int _readf #endif { #ifdef WIN32 - E(0, F("this transport not supported on native Win32; use Cygwin")); + E(0, origin::system, F("this transport not supported on native Win32; use Cygwin")); // keeping code in case someone wants to try fixing it @@ -58,7 +58,7 @@ Netxx::PipeStream::PipeStream(int _readf named_pipe = (HANDLE)_get_osfhandle(_readfd); - E(named_pipe != INVALID_HANDLE_VALUE, + E(named_pipe != INVALID_HANDLE_VALUE, origin::system, F("pipe handle is invalid")); // Create infrastructure for overlapping I/O @@ -178,7 +178,7 @@ Netxx::PipeStream::PipeStream (const str #ifdef WIN32 - E(0, F("this transport not supported on native Win32; use Cygwin")); + E(0, origin::system, F("this transport not supported on native Win32; use Cygwin")); // keeping code in case someone wants to try fixing it @@ -201,7 +201,7 @@ Netxx::PipeStream::PipeStream (const str 1000, 0); - E(named_pipe != INVALID_HANDLE_VALUE, + E(named_pipe != INVALID_HANDLE_VALUE, origin::system, F("CreateNamedPipe(%s,...) call failed: %s") % pipename % err_msg()); @@ -218,7 +218,7 @@ Netxx::PipeStream::PipeStream (const str OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED,0); - E(hpipe != INVALID_HANDLE_VALUE, + E(hpipe != INVALID_HANDLE_VALUE, origin::system, F("CreateFile(%s,...) call failed: %s") % pipename % err_msg()); @@ -312,7 +312,7 @@ Netxx::PipeStream::write(const void *buf #ifdef WIN32 DWORD written = 0; BOOL ok = WriteFile(named_pipe, buffer, length, &written, NULL); - E(ok, F("WriteFile call failed: %s") % err_msg()); + E(ok, origin::system, F("WriteFile call failed: %s") % err_msg()); #else size_t written = ::write(writefd, buffer, length); #endif @@ -403,7 +403,7 @@ Netxx::PipeCompatibleProbe::ready(const // Issue an async request to fill our buffer. BOOL ok = ReadFile(pipe->named_pipe, pipe->readbuf, sizeof(pipe->readbuf), NULL, &pipe->overlap); - E(ok || GetLastError() == ERROR_IO_PENDING, + E(ok || GetLastError() == ERROR_IO_PENDING, origin::system, F("ReadFile call failed: %s") % err_msg()); pipe->read_in_progress = true; } @@ -438,7 +438,7 @@ Netxx::PipeCompatibleProbe::ready(const FALSE, milliseconds); - E(wstatus != WAIT_FAILED, + E(wstatus != WAIT_FAILED, origin::system, F("WaitForMultipleObjects call failed: %s") % err_msg()); if (wstatus == WAIT_OBJECT_0 + 1) @@ -448,7 +448,7 @@ Netxx::PipeCompatibleProbe::ready(const { wstatus = WaitForSingleObject(pipe->overlap.hEvent, milliseconds); - E(wstatus != WAIT_FAILED, + E(wstatus != WAIT_FAILED, origin::system, F("WaitForSingleObject call failed: %s") % err_msg()); } @@ -468,7 +468,7 @@ Netxx::PipeCompatibleProbe::ready(const else { // We did not complete our read. - E(GetLastError() == ERROR_IO_INCOMPLETE, + E(GetLastError() == ERROR_IO_INCOMPLETE, origin::system, F("GetOverlappedResult call failed: %s") % err_msg()); } ============================================================ --- paths.cc c2bbab0e0a0e50607f11cf4b1833cb1467fac0e6 +++ paths.cc 7eb02c15c3c4715e94626ec5f89e5f1b01886e29 @@ -944,7 +944,7 @@ find_and_go_to_workspace(string const & { #ifdef WIN32 std::string cur_str = get_current_working_dir(); - current = cur_str; + current = system_path(cur_str, origin::system); if (cur_str[0] == '/' || cur_str[0] == '\\') { if (cur_str.size() > 1 && (cur_str[1] == '/' || cur_str[1] == '\\')) @@ -952,16 +952,16 @@ find_and_go_to_workspace(string const & // UNC name string::size_type uncend = cur_str.find_first_of("\\/", 2); if (uncend == string::npos) - root = system_path(cur_str + "/"); + root = system_path(cur_str + "/", origin::system); else - root = system_path(cur_str.substr(0, uncend)); + root = system_path(cur_str.substr(0, uncend), origin::system); } else root = system_path("/"); } else if (cur_str.size() > 1 && cur_str[1] == ':') { - root = system_path(cur_str.substr(0,2) + "/"); + root = system_path(cur_str.substr(0,2) + "/", origin::system); } else I(false); #else ============================================================ --- tests/commit_validation_lua_hook/__driver__.lua 19367c5014ec6d8704e3f94916c96ba06a17a8d3 +++ tests/commit_validation_lua_hook/__driver__.lua 598c1dc5e31b3c52a3a0296b14f59e4a76fec5b0 @@ -8,7 +8,7 @@ check(mtn("--branch=testbranch", "--rcfi check(mtn("add", "input.txt"), 0, false, false) check(get("errmsg")) check(mtn("--branch=testbranch", "--rcfile=commit_validate.lua", "commit", "-m", "denyme"), 1, false, true) -canonicalize("stderr") check(grep("-v", "detected at", "stderr"), 0, true) +canonicalize("stdout") check(samefile("errmsg", "stdout")) check(mtn("--branch=testbranch", "--rcfile=commit_validate.lua", "commit", "-m", "allowme"), 0, false, false) ============================================================ --- tests/resolve_conflicts_errors/__driver__.lua 778859aa71ac1c88a29ba030936ca462478d30f8 +++ tests/resolve_conflicts_errors/__driver__.lua 7688ba18626d29beb5aec22e208b74551bf4baa1 @@ -43,8 +43,8 @@ check(mtn("conflicts", "--conflicts-file ---------- -- specify conflicts file not in bookkeeping dir check(mtn("conflicts", "--conflicts-file", "conflicts", "store", left_1, right_1), 1, nil, true) -canonicalize("stderr") check(grep("-v", "detected at", "stderr"), 0, true) +canonicalize("stdout") check(samefilestd("conflicts-attr-store-2", "stdout")) ---------- @@ -57,8 +57,8 @@ check(mtn("merge", "--resolve-conflicts" -- attempt merge with old conflict file check(mtn("merge", "--resolve-conflicts"), 1, nil, true) -canonicalize("stderr") check(grep("-v", "detected at", "stderr"), 0, true) +canonicalize("stdout") check(samefilestd("merge-old-conflicts-file", "stdout")) @@ -87,8 +87,8 @@ check(mtn("conflicts", "resolve_first_ri -- both sides specify user file check(mtn("conflicts", "resolve_first_left", "user", "checkout.sh"), 0, nil, nil) check(mtn("conflicts", "resolve_first_right", "user", "checkout.sh"), 1, nil, true) -canonicalize("stderr") check(grep("-v", "detected at", "stderr"), 0, true) +canonicalize("stdout") check("mtn: misuse: left and right resolutions cannot both be 'user'\n" == readfile("stdout")) -- end of file ============================================================ --- win32/fs.cc 952077b15aa3f8774b6261e37237472815a7c0ae +++ win32/fs.cc 9dee8425649922f9cf98200c8d79c3a0b01f8290 @@ -19,7 +19,7 @@ get_current_working_dir() get_current_working_dir() { char buffer[4096]; - E(getcwd(buffer, 4096), + E(getcwd(buffer, 4096), origin::system, F("cannot get working directory: %s") % strerror(errno)); std::string str(buffer); @@ -35,7 +35,7 @@ change_current_working_dir(std::string c void change_current_working_dir(std::string const & to) { - E(!chdir(to.c_str()), + E(!chdir(to.c_str()), origin::system, F("cannot change to directory %s: %s") % to % strerror(errno)); } @@ -53,7 +53,7 @@ get_default_confdir() if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szPath))) base = szPath; } - N(!base.empty(), F("could not determine configuration path")); + E(!base.empty(), origin::system, F("could not determine configuration path")); return base + "\\monotone"; } @@ -138,7 +138,7 @@ get_path_status(std::string const & path || err == ERROR_BAD_NETPATH) return path::nonexistent; - E(false, F("%s: GetFileAttributes error: %s") % path % os_strerror(err)); + E(false, origin::system, F("%s: GetFileAttributes error: %s") % path % os_strerror(err)); } else if (attrs & FILE_ATTRIBUTE_DIRECTORY) return path::directory; @@ -166,7 +166,7 @@ namespace if (GetLastError() == ERROR_FILE_NOT_FOUND) // zero files in dir last = true; else - E(false, F("could not open directory '%s': %s") + E(false, origin::system, F("could not open directory '%s': %s") % path % os_strerror(GetLastError())); } } @@ -187,7 +187,7 @@ namespace } if (FindNextFile(h, data)) return true; - E(GetLastError() == ERROR_NO_MORE_FILES, + E(GetLastError() == ERROR_NO_MORE_FILES, origin::system, F("error while reading directory: %s") % os_strerror(errno)); last = true; return false; @@ -241,14 +241,14 @@ do_remove(std::string const & path) // the path doesn't exist. break; } - E(false, + E(false, origin::system, F("could not remove '%s': %s") % path % os_strerror(GetLastError())); } void do_mkdir(std::string const & path) { - E(CreateDirectoryA(path.c_str(), 0) != 0, + E(CreateDirectoryA(path.c_str(), 0) != 0, origin::system, F("could not create directory '%s': %s") % path % os_strerror(GetLastError())); } @@ -322,8 +322,9 @@ rename_clobberingly(std::string const & if (sleepTime < 250) sleepTime *= 2; } - E(false, F("renaming '%s' to '%s' failed: %s (%d)") % from % to - % os_strerror(lastError) % lastError); + E(false, origin::system, + F("renaming '%s' to '%s' failed: %s (%d)") % from % to + % os_strerror(lastError) % lastError); } // Create a temporary file in directory DIR, writing its name to NAME and @@ -382,7 +383,7 @@ make_temp_file(std::string const & dir, // ERROR_ALREADY_EXISTS means we should go 'round again. Any other // GetLastError() value is a plain error. (Presumably, just as for // Unix, there are values that would represent bugs.) - E(GetLastError() == ERROR_ALREADY_EXISTS, + E(GetLastError() == ERROR_ALREADY_EXISTS, origin::system, F("cannot create temp file %s: %s") % tmp % os_strerror(GetLastError())); @@ -390,7 +391,7 @@ make_temp_file(std::string const & dir, // 'value' will visit every number in its range. value += 7777; } - E(false, + E(false, origin::system, F("cannot find a temporary file (tried %d possibilities)") % limit); } @@ -443,13 +444,14 @@ write_data_worker(std::string const & fn { DWORD written; E(WriteFile(h, (LPCVOID)ptr, remaining, &written, (LPOVERLAPPED)0), + origin::system, F("error writing to temp file %s: %s") % tmp % os_strerror(GetLastError())); if (written == 0) { deadcycles++; - E(deadcycles < 4, + E(deadcycles < 4, origin::system, FP("giving up after four zero-length writes to %s " "(%d byte written, %d left)", "giving up after four zero-length writes to %s " ============================================================ --- win32/ssh_agent_platform.cc 10a2ac556b690343bcda3eee48f7112bf3b6f799 +++ win32/ssh_agent_platform.cc 9dd114aa8691e56fe4b0990eff53bdda704b1b21 @@ -80,7 +80,7 @@ ssh_agent_platform::write_data(string co L(FL("ssh_agent_platform::write_data: writing %u bytes to %s") % data.length() % mapname); - E(data.length() < AGENT_MAX_MSGLEN, + E(data.length() < AGENT_MAX_MSGLEN, origin::system, F("Asked to write more than %u to pageant.") % AGENT_MAX_MSGLEN); memcpy(filemap_view, data.c_str(), data.length()); @@ -90,7 +90,7 @@ ssh_agent_platform::write_data(string co id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds); - E(id > 0, F("Error sending message to pageant (%d).") % id); + E(id > 0, origin::system, F("Error sending message to pageant (%d).") % id); //Start our read counter again read_len = 0; @@ -103,7 +103,7 @@ ssh_agent_platform::read_data(u32 const L(FL("ssh_agent: read_data: asked to read %u bytes") % len); - E((read_len + len) < AGENT_MAX_MSGLEN, + E((read_len + len) < AGENT_MAX_MSGLEN, origin::system, F("Asked to read more than %u from pageant.") % AGENT_MAX_MSGLEN); out.append(filemap_view + read_len, len); ============================================================ --- win32/tester-plaf.cc 1b3bbd387a0e96810e68da14fe6c0aef9c25225c +++ win32/tester-plaf.cc 3515a1b8a6a7fa2a45dbaddb933239fef3c18823 @@ -12,10 +12,10 @@ void make_accessible(std::string const & void make_accessible(std::string const & name) { DWORD attrs = GetFileAttributes(name.c_str()); - E(attrs != INVALID_FILE_ATTRIBUTES, + E(attrs != INVALID_FILE_ATTRIBUTES, origin::system, F("GetFileAttributes(%s) failed: %s") % name % os_strerror(GetLastError())); - E(SetFileAttributes(name.c_str(), attrs & ~FILE_ATTRIBUTE_READONLY), + E(SetFileAttributes(name.c_str(), attrs & ~FILE_ATTRIBUTE_READONLY), origin::system, F("SetFileAttributes(%s) failed: %s") % name % os_strerror(GetLastError())); } @@ -23,11 +23,11 @@ time_t get_last_write_time(char const * { HANDLE h = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - E(h != INVALID_HANDLE_VALUE, + E(h != INVALID_HANDLE_VALUE, origin::system, F("CreateFile(%s) failed: %s") % name % os_strerror(GetLastError())); FILETIME ft; - E(GetFileTime(h, NULL, NULL, &ft), + E(GetFileTime(h, NULL, NULL, &ft), origin::system, F("GetFileTime(%s) failed: %s") % name % os_strerror(GetLastError())); CloseHandle(h); @@ -44,7 +44,7 @@ void do_copy_file(std::string const & fr void do_copy_file(std::string const & from, std::string const & to) { // For once something is easier with Windows. - E(CopyFile(from.c_str(), to.c_str(), true), + E(CopyFile(from.c_str(), to.c_str(), true), origin::system, F("copy %s to %s: %s") % from % to % os_strerror(GetLastError())); } @@ -99,7 +99,7 @@ char * make_temp_dir() // GetTempFileName wants 14 characters at the end of the path. { DWORD ret = GetTempPath(DIR_MAX_SIZE - 14, dir); - E(ret > 0 && ret <= DIR_MAX_SIZE - 14, + E(ret > 0 && ret <= DIR_MAX_SIZE - 14, origin::system, F("GetTempPath failed: %s") % os_strerror(GetLastError())); } @@ -112,16 +112,16 @@ char * make_temp_dir() if (base + i == 0) continue; - E(GetTempFileName(dir, "MTN", base + i, name) != 0, + E(GetTempFileName(dir, "MTN", base + i, name) != 0, origin::system, F("GetTempFileName failed: %s") % os_strerror(GetLastError())); if (CreateDirectory(name, NULL)) return name; - E(GetLastError() == ERROR_ALREADY_EXISTS, + E(GetLastError() == ERROR_ALREADY_EXISTS, origin::system, F("CreateDirectory(%s) failed: %s") % name % GetLastError()); } - E(false, F("All temporary directory names are already in use.")); + E(false, origin::system, F("All temporary directory names are already in use.")); } bool running_as_root()