Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

tortoise\shellext\common.cpp: convert to LF, use spaces instead of tabs

Changeset a2f929b610bf

Parent 1b7225d16fc7

by Adrian Buehlmann

Changes to one file · Browse files at a2f929b610bf Showing diff from parent 1b7225d16fc7 Diff from another changeset...

Change 1 of 1 Show Entire File tortoise/​shellext/​common.cpp Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
@@ -1,54 +1,54 @@
-// CuteHg - Qt4 Dialog Extension of Mercurial -// Copyright (C) 2009 Stefan Rusek -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see <http://www.gnu.org/licenses/>. - -#include <string> -#include <shlwapi.h> - - -bool HgFindRoot(char* path, std::string* root) -{ - char temp1[MAX_PATH]; - char temp2[MAX_PATH]; - - char* dir = temp1; - char* other = temp2; - - if (!GetFullPathName(path, MAX_PATH, dir, NULL)) - return false; - - bool found = false; - while (dir) - { - other = PathCombine(other, dir, ".\\.hg\\store"); - if (found = PathIsDirectory(other)) - break; - - // search parent - if (PathIsRoot(dir)) - dir = NULL; - else - { - char* temp = PathCombine(other, dir, ".."); - other = dir; - dir = temp; - } - } - - if (found) - *root = dir; - return found; -} - +// CuteHg - Qt4 Dialog Extension of Mercurial +// Copyright (C) 2009 Stefan Rusek +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. + +#include <string> +#include <shlwapi.h> + + +bool HgFindRoot(char* path, std::string* root) +{ + char temp1[MAX_PATH]; + char temp2[MAX_PATH]; + + char* dir = temp1; + char* other = temp2; + + if (!GetFullPathName(path, MAX_PATH, dir, NULL)) + return false; + + bool found = false; + while (dir) + { + other = PathCombine(other, dir, ".\\.hg\\store"); + if (found = PathIsDirectory(other)) + break; + + // search parent + if (PathIsRoot(dir)) + dir = NULL; + else + { + char* temp = PathCombine(other, dir, ".."); + other = dir; + dir = temp; + } + } + + if (found) + *root = dir; + return found; +} +