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

merge with Simon

Changeset ac1a90bf293b

Parents dd3702788cde

Parents aaff0d60ad32

by Steve Borho

Changes to 5 files · Browse files at ac1a90bf293b Showing diff from parent dd3702788cde aaff0d60ad32 Diff from another changeset...

 
261
262
263
264
 
 
 
265
266
267
 
261
262
263
 
264
265
266
267
268
269
@@ -261,7 +261,9 @@
  cachethg.MODIFIED: ('cvs-modified', 'modified'),   cachethg.UNKNOWN: ('new', 'unrevisioned'),   cachethg.IGNORED: (None, 'ignored'), - cachethg.NOT_IN_REPO: (None, '')} + cachethg.NOT_IN_REPO: (None, ''), + cachethg.ROOT: ('generic', 'root'), + cachethg.UNRESOLVED: ('cvs-confilict', 'unresolved')}   emblem, status = cache2state.get(cachestate, (None, '?'))   return emblem, status  
 
1
2
 
3
4
5
 
35
36
37
38
39
40
41
42
43
44
 
 
 
 
 
45
46
47
 
68
69
70
71
 
 
72
73
74
 
94
95
96
97
 
98
99
 
100
101
102
 
106
107
108
109
 
110
111
112
 
115
116
117
118
 
119
120
121
 
123
124
125
126
 
127
128
129
130
131
 
132
133
134
 
143
144
145
146
 
147
148
149
150
151
 
152
153
154
155
156
 
157
158
159
 
164
165
166
167
 
168
169
170
 
 
 
171
172
173
174
175
176
177
178
179
180
181
 
 
 
 
 
 
 
 
 
 
 
 
 
182
183
184
185
186
187
188
 
 
189
190
191
192
193
194
195
 
 
1
 
2
3
4
5
 
35
36
37
 
 
 
 
 
 
 
38
39
40
41
42
43
44
45
 
66
67
68
 
69
70
71
72
73
 
93
94
95
 
96
97
 
98
99
100
101
 
105
106
107
 
108
109
110
111
 
114
115
116
 
117
118
119
120
 
122
123
124
 
125
126
127
128
129
 
130
131
132
133
 
142
143
144
 
145
146
147
148
149
 
150
151
152
153
154
 
155
156
157
158
 
163
164
165
 
166
167
168
 
169
170
171
172
173
174
 
 
 
 
 
 
 
 
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 
 
 
192
193
194
195
196
197
198
 
 
199
@@ -1,5 +1,5 @@
 import os -from mercurial import hg, cmdutil, util, ui +from mercurial import hg, cmdutil, util, ui, node, merge  import thgutil  import sys  try: @@ -35,13 +35,11 @@
  def debugf(str, args=None):   pass   -UNCHANGED = "unchanged" -ADDED = "added" -MODIFIED = "modified" -UNKNOWN = "unknown" -IGNORED = "ignored" -NOT_IN_REPO = "n/a" -ROOT = "root" +STATUS_STATES = 'MAR!?IC' +MODIFIED, ADDED, REMOVED, DELETED, UNKNOWN, IGNORED, UNCHANGED = STATUS_STATES +NOT_IN_REPO = ' ' +ROOT = "r" +UNRESOLVED = 'U'    # file status cache  overlay_cache = {} @@ -68,7 +66,8 @@
  """   Get the state of a given path in source control.   """ - return get_states(upath, repo)[-1] + states = get_states(upath, repo) + return states and states[0] or NOT_IN_REPO      def get_states(upath, repo=None): @@ -94,9 +93,9 @@
  if not status:   if os.path.isdir(os.path.join(path, '.hg')):   add(path, ROOT) - status = ROOT, + status = ROOT   else: - status = overlay_cache.get(pdir, [NOT_IN_REPO]) + status = overlay_cache.get(pdir, NOT_IN_REPO)   debugf("%s: %s (cached)", (path, status))   return status   else: @@ -106,7 +105,7 @@
  # path is a drive   if path.endswith(":\\"):   add(path, NOT_IN_REPO) - return [NOT_IN_REPO] + return NOT_IN_REPO   # open repo   if cache_pdir == pdir:   root = cache_root @@ -115,7 +114,7 @@
  root = thgutil.find_root(path)   if root == path:   add(path, ROOT) - return [ROOT] + return ROOT   cache_root = root   cache_pdir = pdir   @@ -123,12 +122,12 @@
  debugf("_get_state: not in repo")   overlay_cache = {None: None}   cache_tick_count = GetTickCount() - return [NOT_IN_REPO] + return NOT_IN_REPO   debugf("_get_state: root = " + root)   hgdir = os.path.join(root, '.hg', '')   if pdir == hgdir[:-1] or pdir.startswith(hgdir):   add(pdir, NOT_IN_REPO) - return [NOT_IN_REPO] + return NOT_IN_REPO   try:   tc1 = GetTickCount()   if not repo or (repo.root != root and repo.root != os.path.realpath(root)): @@ -143,17 +142,17 @@
  debugf("%s: overlayicons disabled", path)   overlay_cache = {None: None}   cache_tick_count = GetTickCount() - return [NOT_IN_REPO] + return NOT_IN_REPO   except RepoError:   # We aren't in a working tree   debugf("%s: not in repo", pdir)   add(pdir, IGNORED) - return [IGNORED] + return IGNORED   except StandardError, e:   debugf("error while handling %s:", pdir)   debugf(e)   add(pdir, UNKNOWN) - return [UNKNOWN] + return UNKNOWN   # get file status   tc1 = GetTickCount()   @@ -164,32 +163,37 @@
  except util.Abort, inst:   debugf("abort: %s", inst)   debugf("treat as unknown : %s", path) - return [UNKNOWN] + return UNKNOWN     debugf("status() took %g ticks", (GetTickCount() - tc1)) - modified, added, removed, deleted, unknown, ignored, clean = repostate + mergestate = repo.dirstate.parents()[1] != node.nullid and \ + hasattr(merge, 'mergestate') +   # cached file info   tc = GetTickCount()   overlay_cache = {} - for grp, st in ( - (ignored, IGNORED), - (unknown, UNKNOWN), - (clean, UNCHANGED), - (added, ADDED), - (removed, MODIFIED), - (deleted, MODIFIED), - (modified, MODIFIED)): + add(root, ROOT) + states = STATUS_STATES + if mergestate: + mstate = merge.mergestate(repo) + unresolved = [f for f in mstate if mstate[f] == 'u'] + if unresolved: + modified = repostate[0] + modified[:] = set(modified) - set(unresolved) + repostate.insert(0, unresolved) + states = [UNRESOLVED] + states + states = zip(repostate, states) + states[-1], states[-2] = states[-2], states[-1] #clean before ignored + for grp, st in states:   add_dirs(grp)   for f in grp:   fpath = os.path.join(root, os.path.normpath(f))   add(fpath, st) - add(root, ROOT) - status = overlay_cache.get(path, [UNKNOWN]) - debugf("\n%s: %s", (path, status)) + status = overlay_cache.get(path, UNKNOWN) + debugf("%s: %s", (path, status))   cache_tick_count = GetTickCount()   return status      def add(path, state): - c = overlay_cache.setdefault(path, []) - c.append(state) + overlay_cache[path] = overlay_cache.get(path, '') + state
 
58
59
60
61
 
62
63
64
 
93
94
95
96
97
98
 
 
 
 
 
 
 
 
 
58
59
60
 
61
62
63
64
 
93
94
95
 
 
 
96
97
98
99
100
101
102
103
@@ -58,7 +58,7 @@
  try:   cache_lock.acquire()   tc = win32api.GetTickCount() - if cachethg.get_state(path) == self.state: + if cachethg.get_state(path) in self.state:   return S_OK   return S_FALSE   finally: @@ -93,6 +93,11 @@
  globals()[classname] = cls    _overlay_classes = [] -make_icon_overlay("Changed", "Modified", cachethg.MODIFIED, "{4D0F33E1-654C-4A1B-9BE8-E47A98752BAB}") -make_icon_overlay("Unchanged", "Normal", cachethg.UNCHANGED, "{4D0F33E2-654C-4A1B-9BE8-E47A98752BAB}") -make_icon_overlay("Added", "Added", cachethg.ADDED, "{4D0F33E3-654C-4A1B-9BE8-E47A98752BAB}") +THG_CLSID = "{4D0F33E1-654C-4A1B-9BE8-E47A98752BAB}" +modified = cachethg.REMOVED + cachethg.DELETED + cachethg.MODIFIED + +make_icon_overlay("Changed", "Modified", modified, THG_CLSID) +make_icon_overlay("Unchanged", "Normal", cachethg.UNCHANGED, THG_CLSID) +make_icon_overlay("Added", "Added", cachethg.ADDED, THG_CLSID) +make_icon_overlay("Ignored", "Ignored", cachethg.IGNORED, THG_CLSID) +make_icon_overlay("Conflict", "Conflict", cachethg.UNRESOLVED, THG_CLSID)
 
147
148
149
150
 
151
152
153
154
155
156
157
 
158
159
160
 
147
148
149
 
150
151
152
153
154
155
156
 
157
158
159
160
@@ -147,14 +147,14 @@
  drag_repo = None   drop_repo = None   - drag_path = self.srcfiles[0] + drag_path = srcfiles[0]   drag_repo = open_repo(drag_path)   if not drag_repo:   return []   if drag_repo and drag_repo.root != drag_path:   return [] # dragged item must be a hg repo root directory   - drop_repo = open_repo(self._folder) + drop_repo = open_repo(destfolder)     menu = thg_menu(drag_repo.ui, self.name)   menu.add_menu(_("Create Clone"),
Change 1 of 2 Show Entire File tortoisehg.py Stacked
 
17
18
19
20
 
 
 
 
21
22
23
 
50
51
52
53
54
55
 
 
56
57
58
59
60
61
62
63
 
 
64
65
66
 
17
18
19
 
20
21
22
23
24
25
26
 
53
54
55
 
 
 
56
57
58
59
60
61
62
 
 
 
63
64
65
66
67
@@ -17,7 +17,10 @@
   # shell extension classes  from tortoise.contextmenu import ContextMenuExtension -from tortoise.iconoverlay import ChangedOverlay, AddedOverlay, UnchangedOverlay +import tortoise.iconoverlay + +overlays = [getattr(tortoise.iconoverlay, overlay) for overlay in + tortoise.iconoverlay.__dict__ if overlay.endswith('Overlay')]    bin_path = os.path.dirname(os.path.join(os.getcwd(), sys.argv[0]))  print "bin path = ", bin_path @@ -50,17 +53,15 @@
 def DllRegisterServer():   check_tortoise_overlays()   RegisterServer(ContextMenuExtension) - RegisterServer(ChangedOverlay) - RegisterServer(AddedOverlay) - RegisterServer(UnchangedOverlay) + for overlay in overlays: + RegisterServer(overlay)   register_tortoise_path()    # for COM registration via py2exe  def DllUnregisterServer():   UnregisterServer(ContextMenuExtension) - UnregisterServer(ChangedOverlay) - UnregisterServer(AddedOverlay) - UnregisterServer(UnchangedOverlay) + for for overlay in overlays: + UnregisterServer(overlay)   register_tortoise_path(unregister=True)    def RegisterServer(cls):