Changeset 1666 in tailor


Ignore:
Timestamp:
03/27/09 11:26:03 (4 years ago)
Author:
lele@…
Hash name:
20090327102603-97f81-306859d2ffafa9d11b571c32fa33b962b2f8791d
Message:

Fix hg (in)compatibility of the week
This allows Mercurial 1.1 to delete files. This patch was first found
at  https://bugzilla.redhat.com/show_bug.cgi?id=478841, the "reverted
patch" by Dan Horak, 2009-01-07 12:32 EDT: hopefully this version
works also for older Mercurial versions.
Thanks to Chad Burrus for making me aware of the problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/repository/hg.py

    r1662 r1666  
    642642 
    643643        files = [] 
    644         for src, path in self._getRepo().dirstate.walk([subdir]): 
     644        try: 
     645            # hg >= 1.1 
     646            # def walk(self, match, unknown, ignored) 
     647 
     648            from mercurial import match 
     649 
     650            def get_paths(): 
     651                matcher = match.exact(self.repository.basedir, 
     652                                      self.repository.basedir, 
     653                                      [subdir]) 
     654                walk = self._getRepo().dirstate.walk 
     655                for path in walk(matcher, True, False): 
     656                    yield path 
     657        except ImportError: 
     658            # hg < 1.1 
     659            # def walk(self, files=None, match=util.always, badmatch=None) 
     660 
     661            def get_paths(): 
     662                walk = self._getRepo().dirstate.walk 
     663                for src, path in walk([subdir]): 
     664                    yield path 
     665 
     666        for path in get_paths(): 
    645667            # If subdir is a plain file, just return 
    646668            if path == subdir: 
     
    651673                tl = join(nt, tl) 
    652674            files.append(tl) 
     675 
    653676        return files 
Note: See TracChangeset for help on using the changeset viewer.