comparison mercurial/commands.py @ 227:f57519cddd3d

move repo.current to dirstate.parents() -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 move repo.current to dirstate.parents() dirstate now tracks the parents for the working dir add a parents command to show them manifest hash: cd69237838c3f69f7937723c4a6803d47cb27cfa -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoMGuywK+sNU5EO8RAg5UAKCVLUrsJtkoIOTM+e0BLqEVN3Ni3gCeNDyy ZF8jD728cl9K7S4sIN4gX4Y= =P4bu -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 03 Jun 2005 12:46:38 -0800
parents 2bfe525ef6ca
children 00ea3613f82c
comparison
equal deleted inserted replaced
226:1536ccac47e9 227:f57519cddd3d
100 opmap = [['user', getname], ['number', str], ['changeset', getnode]] 100 opmap = [['user', getname], ['number', str], ['changeset', getnode]]
101 if not ops['user'] and not ops['changeset']: 101 if not ops['user'] and not ops['changeset']:
102 ops['number'] = 1 102 ops['number'] = 1
103 103
104 args = relpath(repo, args) 104 args = relpath(repo, args)
105 node = repo.current 105 node = repo.dirstate.parents()[0]
106 if ops['revision']: 106 if ops['revision']:
107 node = repo.changelog.lookup(ops['revision']) 107 node = repo.changelog.lookup(ops['revision'])
108 change = repo.changelog.read(node) 108 change = repo.changelog.read(node)
109 mmap = repo.manifest.read(change[0]) 109 mmap = repo.manifest.read(change[0])
110 maxuserlen = 0 110 maxuserlen = 0
140 time.localtime(float(changes[2].split(' ')[0]))) 140 time.localtime(float(changes[2].split(' ')[0])))
141 if ui.verbose: print "files:", " ".join(changes[3]) 141 if ui.verbose: print "files:", " ".join(changes[3])
142 print "description:" 142 print "description:"
143 print changes[4] 143 print changes[4]
144 144
145 def parents(ui, repo, node = None):
146 '''show the parents of the current working dir'''
147 if node:
148 p = repo.changelog.parents(repo.lookup(hg.bin(node)))
149 else:
150 p = repo.dirstate.parents()
151
152 for n in p:
153 if n != hg.nullid:
154 ui.write("%d:%s\n" % (repo.changelog.rev(n), hg.hex(n)))
155
145 def status(ui, repo): 156 def status(ui, repo):
146 '''show changed files in the working directory 157 '''show changed files in the working directory
147 158
148 C = changed 159 C = changed
149 A = added 160 A = added
170 [('r', 'revision', '', 'revision'), 181 [('r', 'revision', '', 'revision'),
171 ('u', 'user', None, 'show user'), 182 ('u', 'user', None, 'show user'),
172 ('n', 'number', None, 'show revision number'), 183 ('n', 'number', None, 'show revision number'),
173 ('c', 'changeset', None, 'show changeset')], 184 ('c', 'changeset', None, 'show changeset')],
174 'hg annotate [-u] [-c] [-n] [-r id] [files]'), 185 'hg annotate [-u] [-c] [-n] [-r id] [files]'),
186 "parents": (parents, [], 'hg parents [node]'),
175 "status": (status, [], 'hg status'), 187 "status": (status, [], 'hg status'),
176 "undo": (undo, [], 'hg undo'), 188 "undo": (undo, [], 'hg undo'),
177 } 189 }
178 190
179 norepo = "init branch help" 191 norepo = "init branch help"