equal
deleted
inserted
replaced
1117 self._extra = {} |
1117 self._extra = {} |
1118 if extra: |
1118 if extra: |
1119 self._extra = extra.copy() |
1119 self._extra = extra.copy() |
1120 if branch is not None: |
1120 if branch is not None: |
1121 self._extra['branch'] = encoding.fromlocal(branch) |
1121 self._extra['branch'] = encoding.fromlocal(branch) |
1122 elif 'branch' not in self._extra: |
1122 if not self._extra.get('branch'): |
1123 try: |
|
1124 branch = encoding.fromlocal(self._repo.dirstate.branch()) |
|
1125 except UnicodeDecodeError: |
|
1126 raise error.Abort(_('branch name not in UTF-8!')) |
|
1127 self._extra['branch'] = branch |
|
1128 if self._extra['branch'] == '': |
|
1129 self._extra['branch'] = 'default' |
1123 self._extra['branch'] = 'default' |
1130 |
1124 |
1131 def __bytes__(self): |
1125 def __bytes__(self): |
1132 return bytes(self._parents[0]) + "+" |
1126 return bytes(self._parents[0]) + "+" |
1133 |
1127 |
1240 changes - a list of file lists as returned by localrepo.status() |
1234 changes - a list of file lists as returned by localrepo.status() |
1241 or None to use the repository status. |
1235 or None to use the repository status. |
1242 """ |
1236 """ |
1243 def __init__(self, repo, text="", user=None, date=None, extra=None, |
1237 def __init__(self, repo, text="", user=None, date=None, extra=None, |
1244 changes=None): |
1238 changes=None): |
1245 super(workingctx, self).__init__(repo, text, user, date, extra, changes) |
1239 branch = None |
|
1240 if not extra or 'branch' not in extra: |
|
1241 try: |
|
1242 branch = repo.dirstate.branch() |
|
1243 except UnicodeDecodeError: |
|
1244 raise error.Abort(_('branch name not in UTF-8!')) |
|
1245 super(workingctx, self).__init__(repo, text, user, date, extra, changes, |
|
1246 branch=branch) |
1246 |
1247 |
1247 def __iter__(self): |
1248 def __iter__(self): |
1248 d = self._repo.dirstate |
1249 d = self._repo.dirstate |
1249 for f in d: |
1250 for f in d: |
1250 if d[f] != 'r': |
1251 if d[f] != 'r': |